PCA_Plot_3=function (data,Annotation,VAR,Color) {
# logcountdata row:genes,column: samples
pca <- prcomp(data)
pca_out<-as.data.frame(pca$x)
df_out<- pca_out %>%tibble::rownames_to_column(var=VAR) %>% left_join(., Annotation)
#df_out<- merge (pca_out,Annotation,by.x=0,by.y=0)
# label_color<- factor(df_out[,group])
ggplot(df_out,aes_string(x="PC1",y="PC2")) +geom_point(aes_string(colour = Color))
}
Deseq2_Deseq_function_2=function (Countdata,Coldata) {
dds_fil <- DESeq2:: DESeqDataSetFromMatrix(countData =Countdata, colData = Coldata,
design = ~Group)
dds_fil_Deg<- DESeq2::DESeq(dds_fil)
return(dds_fil_Deg)
}
pheatmap_singscore=function (pathways,data,Annotation) {
Gene_select_anno= data[,colnames(data) %in% pathways] %>%t()%>%.[,rownames(Annotation)]
# return(Gene_select_anno)
# Anno_expression_data=Gene_select_anno[,c("SYMBOL",Group_select)] %>% as.data.frame() %>% distinct() %>% na.omit()
# rownames(Anno_expression_data)=Anno_expression_data[,"SYMBOL"]
# Annotation=group_anno["Gene_type"]
# input= Anno_expression_data[,Group_select]
# F2_pheatmap <- pheatmap::pheatmap(input, cellwigermline calling GATKdth = 10, cellheight = 12, scale = "row",
# treeheight_row = 5,
# show_rownames = T,show_colnames = T,
# annotation_col= Annotation,
# # annotation_row=Annotation,
# annotation_legend=Label_def,
# cluster_rows = T, cluster_cols = F,clustering_distance_rows = "euclidean")
pheatmap::pheatmap(Gene_select_anno, cellwigermline=5, cellheight = 10,cellwidth = 10, scale = "row",
treeheight_row = 5,
show_rownames = T,show_colnames = F,
annotation_col= Annotation,
# annotation_row=Annotation,
#annotation_legend=Label_def,
cluster_rows = T, cluster_cols = F,clustering_distance_rows = "euclidean")
}
matrix.please<-function(x) {
m<-as.matrix(x[,-1])
rownames(m)<-x[,1]
m
}
这是r语言的代码,告诉我每一条代码的作用和意义