1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| keggL <- keggList("pathway","hsa") F_m <- openxlsx::read.xlsx(xlsxFile = "../01/HSD17B2_selected_for_gene_heatmap.xlsx", sheet = 1, colNames = F) M_g <- f_KEGG_name2id(keggL, unlist(F_m)) M_g <- f_KEGG_id2symbol(M_g) M_g <- M_g[M_g %in% rownames(F_c)] grp_ <- f_metaG2G(metaG = F_c[['patient_id']], downSample = F_c[['group']], matrixN = F) sR_d <- f_DEmetabolism(F_c[M_g,], grp_, 'group', normal_distribution = T, matrixN = F) sR_d <- sR_d[order(sR_d$dif, decreasing = T),] sR_d <- sR_d[sR_d$lfdr<0.001,] write.csv(sR_d, file='05.HSPC vs CRPC_F_gene_H.csv') sR <- rownames(sR_d)
xlev = c('patient1','patient5','patient3', 'patient4') p <- f_matrix_heatmap(scale(f_matrix_groupMean(F_c@assays$RNA@data[unlist(sR),], group = grp_, autoG2G = F, normal_distribution = T, matrixN = F)), levels = unlist(sR), xlevels = xlev) ggsave(p, filename = '05.HSPC vs CRPC_F_gene_H.pdf', dpi = 1200, width = 4, height = 10, device = 'pdf', limitsize = FALSE)
p <- f_matrix_heatmap(scale(f_matrix_groupMean_g(F_c[['group']],F_c@assays$RNA@data[unlist(sR),], group = grp_, autoG2G = F, normal_distribution = T, matrixN = F)), levels = unlist(sR)) ggsave(p, filename = '05.HSPC vs CRPC_F_g_gene_H.pdf', dpi = 1200, width = 3, height = 6, device = 'pdf', limitsize = FALSE)
|