# Downstream data analysis # Laod library # # require("ggplot2") require("ComplexHeatmap") #require("ggplot") th0th9 <- read.table(file = "~/Dropbox/suyasha/Th0_th9.txt",header = T) th9_aregko <- read.table(file = "~/Dropbox/suyasha/Th9_Th9_aregko.txt",header = T) sel_genes_values <- read.table(file = "~/Dropbox/suyasha/selected_genes_with_values.txt",header = T,row.names = 1) colnames(sel_genes_values) <- c("Th9 WT","Th9 Areg-/-") ######## cmn_genes <- intersect(th0th9$gene,th9_aregko$gene) th0th9_cmn <- th0th9[th0th9$gene %in% cmn_genes,] th9aregko_cmn <- th9_aregko[th9_aregko$gene %in% cmn_genes,] rownames(th0th9_cmn) <- th0th9_cmn$gene rownames(th9aregko_cmn) <- th9aregko_cmn$gene #### thoth9_lfc <- th0th9_cmn[cmn_genes,"log2.fold_change."] th9aregko_lfc <- th9aregko_cmn[cmn_genes,"log2.fold_change."] lfc_data <- cbind(thoth9_lfc,th9aregko_lfc) colnames(lfc_data) <- c("Th9 WT","Th9 Areg-/-") library(circlize) col_fun = colorRamp2(c(-1, 0, 1), c("green", "white", "red")) col_fun(seq(-3, 3)) Heatmap(as.matrix(lfc_data),cluster_columns =F,name = "LFC",col = col_fun,column_names_rot = 0, column_names_centered = T, column_names_gp = gpar(fontsize=14)) Heatmap(as.matrix(sel_genes_values),cluster_columns =F,name = "LFC",col = col_fun,column_names_rot = 0, column_names_centered = T, column_names_gp = gpar(fontsize=14), row_names_centered = F, row_names_gp = gpar(fontsize=14)) ############################################################################################# setwd("~/Dropbox/suyasha/remetabolitesheatmap") cell_global <- read.table(file = "~/Dropbox/suyasha/remetabolitesheatmap/Cell_extract_global.txt",header = T,sep = "\t") cell_wt <- cell_global[cell_global$Condition == "Th9-WT",] cell_th9 <- cell_global[cell_global$Condition == "Th9-HIF1? KO",] #cell_data <- cbind(cell_wt,cell_th9) cell_data <- cbind(cell_th9, cell_wt) cell_data_gene_name <- cell_data$Name cell_data_hm <- cell_data[,c(3:5,8:10)] rownames(cell_data_hm) <- cell_data_gene_name # Changed the oriantation th9 was first initiallt colnames(cell_data_hm) <- c("Th9-HIF1α.1","Th9-HIF1α.2","Th9-HIF1α.3","Th9-WT.1","Th9-WT.2","Th9-WT.3") #xn <- c("5-Oxoproline","5-Oxoproline","Ac-choline","Ac-choline","Aconitate","Aconitate","AMP","AMP","AMP/ATP","AMP/ATP","Arg","Arg","Carbamoyl-Asp","Carbamoyl-Asp","Cit","Cit","Creatine/P-Creatine","Creatine/P-Creatine","Creatinine","Creatinine","Cys","Cys","Cytosine","Cytosine","dA","dA","dC","dC","DMG","DMG","dU","dU","Folate","Folate","Fru","Fru","Glc","Glc","GlcN","GlcN","GlcNAc","GlcNAc","GlucA","GlucA","Glycerol","Glycerol","GSH","GSH","GSH/GSSG","GSH/GSSG","His","His","Homocysteine","Homocysteine","HS2O3","HS2O3","Hypoxanthine","Hypoxanthine","Leu/Ile","Leu/Ile","Lys","Lys","Met","Met","Nicotinamide","Nicotinamide","Ornithine","Ornithine","P-Creatine","P-Creatine","P-EtA","P-EtA","Palmitate","Palmitate","PEP","PEP","Phe","Phe","Pipecolate","Pipecolate","PO4","PO4","PPi","PPi","Pyr","Pyr","Rib","Rib","Sorbitol","Sorbitol","Succ","Succ","T","T","Trp","Trp","Tyr","Tyr","UDP-Glc","UDP-Glc","Uracil","Uracil","Val","Val","Vit-C","Vit-C","Xanthine","Xanthine") xm <- c("13BPG","13BPG","2-HG","2-HG","2-Oxoadipate","2-Oxoadipate","2-Oxosuccinamate","2-Oxosuccinamate","3PG","3PG","4-OH-PheLac","4-OH-PheLac","5M-adenosine","5M-adenosine","a-KG","a-KG","Ac-carnitine","Ac-carnitine","Adenine","Adenine","ADP","ADP","ADP/ATP","ADP/ATP","Ala","Ala","Arg-Succ","Arg-Succ","Asn","Asn","Asp","Asp","ATP","ATP","C","C","Carnitine","Carnitine","CDP","CDP","CDP-EtA","CDP-EtA","Choline","Choline","Citrulline","Citrulline","CMP","CMP","CoA","CoA","Creatine","Creatine","CTP","CTP","Cys Sulfinic Acid","Cys Sulfinic Acid","Cystathionine","Cystathionine","dG","dG","DHAP","DHAP","F16BP","F16BP","Fum","Fum","G","G","G6P-F6P","G6P-F6P","GABA","GABA","GDP","GDP","GlcA","GlcA","GlcN-6P","GlcN-6P","GlcNAc-6P","GlcNAc-6P","Gln","Gln","Glu","Glu","Gly","Gly","Glycerol-3-P","Glycerol-3-P","GMP","GMP","GSSG","GSSG","IMP","IMP","Inosine","Inosine","Inositol","Inositol","Isobutyryl-CoA","Isobutyryl-CoA","Lac","Lac","Mal","Mal","NAD+","NAD+","NADH","NADH","NADP+","NADP+","Orotate","Orotate","Orotidine","Orotidine","P-Choline","P-Choline","P-Ser","P-Ser","Pantothenate","Pantothenate","Pro","Pro","Pro-OH","Pro-OH","R5P","R5P","S7P","S7P","SAM","SAM","Sarc","Sarc","Ser","Ser","Thr","Thr","Thymine","Thymine","Tyramine","Tyramine","UDP","UDP","UDP-GlcNAc","UDP-GlcNAc","UMP","UMP") cell_data_hm <- cell_data_hm[unique(xm),] n <- t(apply(cell_data_hm, 1, function(x)(x-min(x))/(max(x)-min(x)))) n_scaled <- scale(n) n_scaled_NA <- na.omit(n_scaled) # color function col_func = colorRamp2(c(-2, 0, 2), c("blue", "white", "red")) col_func(seq(-3, 3)) dev.off() #Heatmap(as.matrix(n_scaled_NA),cluster_columns =F,column_title = "Global", col = col_func, # name = "exp",show_row_names = T, show_column_names = T,column_dend_reorder = F,column_names_rot = 0, # column_names_centered = T, column_names_gp = gpar(fontsize=14)) Heatmap(as.matrix(n_scaled_NA),cluster_columns =T,column_title = "Global", col = col_func, name = "exp",show_row_names = T, show_column_names = T,column_dend_reorder = F, column_names_centered = T, row_names_gp = gpar(fontsize=12,fontface="bold"),column_km = 2,border = T) cell_data_hm_scaled <- n_scaled_NA Glycolytic_Metabolites <- c("13-BPG","3PG","Ala","DHAP","F16BP","Fru","G6P-F6P","Glc","Gly","Lac","P-Ser","PEP","Pyr","Ser","UDP-Glc") Glyco <- intersect(rownames(cell_data_hm_scaled),Glycolytic_Metabolites) dev.off() Heatmap(as.matrix(cell_data_hm_scaled[Glyco,]),cluster_columns =F,column_title = "Glycolytic Metabolites", name = "exp",show_row_names = T, show_column_names = T,column_dend_reorder = F, column_names_centered = T, row_names_gp = gpar(fontsize=12,fontface="bold"),border = T) TCA_Metabolites <- c("a-KG","Aconitate","Asn","Asp","Cit","Fum","Gln","Glu","Lac","Mal","Palmitate","Pyr","Succ") TCA <- intersect(rownames(cell_data_hm_scaled),TCA_Metabolites) dev.off() Heatmap(as.matrix(cell_data_hm_scaled[TCA,]),cluster_columns =F,column_title = "TCA Metabolites", name = "exp",show_row_names = T, show_column_names = T,column_dend_reorder = F, column_names_centered = T, row_names_gp = gpar(fontsize=12,fontface="bold"),border = T) PPP_Metabolites <- c("G6P-F6P","Glc","GlcA","IMP","Lac","R5P","Rib","S7P","UMP") PPP <- intersect(rownames(cell_data_hm_scaled),PPP_Metabolites) dev.off() Heatmap(as.matrix(cell_data_hm_scaled[PPP,]),cluster_columns =F,column_title = "PPP Metabolites", name = "exp",show_row_names = T, show_column_names = T,column_dend_reorder = F, column_names_centered = T, row_names_gp = gpar(fontsize=12,fontface="bold"),border = T) Currency_Metabolites <- c("ADP","ADP/ATP","AMP","AMP/ATP","ATP","Creatine","Creatine/P-Creatine","Creatinine","GSH","GSH/GSSG","GSSG","NAD+","NADH","NADP+","P-Creatine") Currency <- intersect(rownames(cell_data_hm_scaled),Currency_Metabolites) dev.off() Heatmap(as.matrix(cell_data_hm_scaled[Currency,]),cluster_columns =F,column_title = "Currency Metabolites", name = "exp",show_row_names = T, show_column_names = T,column_dend_reorder = F, column_names_centered = T, row_names_gp = gpar(fontsize=12,fontface="bold"),border = T) Amino_acids <- c("2-HG","Ala","Arg","Asn","Asp","Cys","Gln","Glu","Gly","His","Leu/Ile","Lys","Met","Phe","Pro","Ser","Thr","Trp","Tyr","Val") Amino <- intersect(rownames(cell_data_hm_scaled),Amino_acids) dev.off() Heatmap(as.matrix(cell_data_hm_scaled[Amino,]),cluster_columns =F,column_title = "Amino acids", name = "exp",show_row_names = T, show_column_names = T,column_dend_reorder = F, column_names_centered = T, row_names_gp = gpar(fontsize=12,fontface="bold"),border = T) Fatty_Acids_Intermediates <- c("Ac-carnitine","Ac-choline","CDP-EtA","Choline","Glycerol-3-P","Glycerol","P-Choline","P-EtA","Palmitate") Fatty <- intersect(rownames(cell_data_hm_scaled),Fatty_Acids_Intermediates) dev.off() Heatmap(as.matrix(cell_data_hm_scaled[Fatty,]),cluster_columns =F,column_title = "Fatty Acids Intermediates", name = "exp",show_row_names = T, show_column_names = T,column_dend_reorder = F, column_names_centered = T, row_names_gp = gpar(fontsize=12,fontface="bold"),border = T) footprint_data <- read.table(file = "~/Dropbox/suyasha/remetabolitesheatmap/Footprint_data.txt",header = T,sep = "\t") foot_wt <- footprint_data[footprint_data$Condition == "Th9-WT",] foot_th9 <- footprint_data[footprint_data$Condition == "Th9-HIF1? KO",] #foot_data <- cbind(foot_wt,foot_th9) foot_data <- cbind(foot_th9,foot_wt) #foot_data[is.na(foot_data)] <- 0 foot_data_gene_name <- foot_data$Name foot_data_hm <- foot_data[,c(3:5,8:10)] #rownames(foot_data_hm) <- foot_data_gene_name colnames(foot_data_hm) <- c("Exp1.ko","Exp2.ko","Exp3.ko", "Exp1.wt","Exp2wt","Exp3wt") rownames(foot_data_hm) <- foot_data_gene_name foot_genes <- c("Ala","Ala","Cys","Cys","dC","dC","Glc","Glc","Glu","Glu","Gly","Gly","Lac","Lac","Lys","Lys","Met","Met","Phe","Phe","Ser","Ser","Trp","Trp","Tyr","Tyr") foot_data_hm <- foot_data_hm[unique(foot_genes),] foot_data_hm <- na.omit(foot_data_hm) m <- t(apply(foot_data_hm, 1, function(x)(x-min(x))/(max(x)-min(x)))) foot_data_hm_scaled <- scale(m) #foot_data_hm_scaled <- scale(foot_data_hm) Heatmap(as.matrix(foot_data_hm_scaled),cluster_columns =F,name = "exp",show_row_names = T, show_column_names = T,column_title = "Footprinting", column_names_centered = T, row_names_gp = gpar(fontsize=12,fontface="bold"),border = T) #cluster_columns = cluster_within_group(mat, group) ################### PCA ######################################################## cell_pca_data <- read.table(file = "~/Dropbox/suyasha/remetabolitesheatmap/Cell extract(Suyasha)-PCA.csv",header = T,sep = ",") colors <- c("red","red","red", "green","green","green") scatterplot3d(x = cell_pca_data$PC1,y = cell_pca_data$PC2,z = cell_pca_data$PC3, xlab='PCA.1', ylab='PCA.2', zlab='PCA.3', color = colors, pch=16, main = "Principal Component Analysis") legend("topright", legend = c("Th9 Hif1αkd","Th9 WT"), col = c("red", "green"), pch = 16)