{"action":"closed","issue":{"url":"https://api.github.com/repos/trinityrnaseq/trinityrnaseq/issues/175","repository_url":"https://api.github.com/repos/trinityrnaseq/trinityrnaseq","labels_url":"https://api.github.com/repos/trinityrnaseq/trinityrnaseq/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/trinityrnaseq/trinityrnaseq/issues/175/comments","events_url":"https://api.github.com/repos/trinityrnaseq/trinityrnaseq/issues/175/events","html_url":"https://github.com/trinityrnaseq/trinityrnaseq/issues/175","id":179730433,"number":175,"title":"Heatmap is not being generated","user":{"login":"abhisheksinghnl","id":20971751,"avatar_url":"https://avatars.githubusercontent.com/u/20971751?v=3","gravatar_id":"","url":"https://api.github.com/users/abhisheksinghnl","html_url":"https://github.com/abhisheksinghnl","followers_url":"https://api.github.com/users/abhisheksinghnl/followers","following_url":"https://api.github.com/users/abhisheksinghnl/following{/other_user}","gists_url":"https://api.github.com/users/abhisheksinghnl/gists{/gist_id}","starred_url":"https://api.github.com/users/abhisheksinghnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhisheksinghnl/subscriptions","organizations_url":"https://api.github.com/users/abhisheksinghnl/orgs","repos_url":"https://api.github.com/users/abhisheksinghnl/repos","events_url":"https://api.github.com/users/abhisheksinghnl/events{/privacy}","received_events_url":"https://api.github.com/users/abhisheksinghnl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-28T10:02:12Z","updated_at":"2016-09-28T11:14:41Z","closed_at":"2016-09-28T11:14:41Z","body":"Hi,\r\n\r\nThis might be a very naive question, somehow I am not able to generate heatmaps for my data.\r\n\r\nThe command that I am using is:\r\n\r\n`perl ~/Softwares/Trinity/trinityrnaseq-2.2.0/Analysis/DifferentialExpression/analyze_diff_expr.pl --matrix ~/Desktop/AgeingRatRNA/Developmental/Trinity/FPKMTrinitymatrix --order_columns_by_samples_file --samples ~/Desktop/AgeingRatRNA/Developmental/Trinity/referencetrinity.txt -P 0.001 -C 4 --max_genes_clust 1000 --max_DE_genes_per_comparison 100 --output ~/Desktop/AgeingRatRNA/Developmental/Trinity/DEG/`\r\n\r\n```\r\n** Found 463 features as differentially expressed.\r\n\r\nCMD: /home/luna.kuleuven.be/u0106457/Softwares/Trinity/trinityrnaseq-2.2.0/Analysis/DifferentialExpression/PtR -m /home/luna.kuleuven.be/u0106457/Desktop/AgeingRatRNA/Developmental/Trinity/DEG/.100_max_DE_eachcompare.matrix --log2 --heatmap --min_colSums 0 --min_rowSums 0 --gene_dist euclidean --sample_dist euclidean --sample_cor_matrix --center_rows --save  -s /home/luna.kuleuven.be/u0106457/Desktop/AgeingRatRNA/Developmental/Trinity/referencetrinity.txt --order_columns_by_samples_file \r\nCMD: R --vanilla -q < .100_max_DE_eachcompare.matrix.R\r\n> library(cluster)\r\n> library(Biobase)\r\nLoading required package: BiocGenerics\r\nLoading required package: parallel\r\n\r\nAttaching package: ‘BiocGenerics’\r\n\r\nThe following objects are masked from ‘package:parallel’:\r\n\r\n    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,\r\n    clusterExport, clusterMap, parApply, parCapply, parLapply,\r\n    parLapplyLB, parRapply, parSapply, parSapplyLB\r\n\r\nThe following objects are masked from ‘package:stats’:\r\n\r\n    IQR, mad, xtabs\r\n\r\nThe following objects are masked from ‘package:base’:\r\n\r\n    anyDuplicated, append, as.data.frame, cbind, colnames, do.call,\r\n    duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect,\r\n    is.unsorted, lapply, lengths, Map, mapply, match, mget, order,\r\n    paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind,\r\n    Reduce, rownames, sapply, setdiff, sort, table, tapply, union,\r\n    unique, unsplit\r\n\r\nWelcome to Bioconductor\r\n\r\n    Vignettes contain introductory material; view with\r\n    'browseVignettes()'. To cite Bioconductor, see\r\n    'citation(\"Biobase\")', and for packages 'citation(\"pkgname\")'.\r\n\r\n> library(qvalue)\r\n> NO_REUSE = F\r\n> \r\n> # try to reuse earlier-loaded data if possible\r\n> if (file.exists(\".100_max_DE_eachcompare.matrix.RData\") && ! NO_REUSE) {\r\n+     print('RESTORING DATA FROM EARLIER ANALYSIS')\r\n+     load(\".100_max_DE_eachcompare.matrix.RData\")\r\n+ } else {\r\n+     print('Reading matrix file.')\r\n+     primary_data = read.table(\"/home/luna.kuleuven.be/u0106457/Desktop/AgeingRatRNA/Developmental/Trinity/DEG/.100_max_DE_eachcompare.matrix\", header=T, com='', sep=\"\\t\", row.names=1, check.names=F)\r\n+     primary_data = as.matrix(primary_data)\r\n+ }\r\n[1] \"RESTORING DATA FROM EARLIER ANALYSIS\"\r\n> source(\"/home/luna.kuleuven.be/u0106457/Softwares/Trinity/trinityrnaseq-2.2.0/Analysis/DifferentialExpression/R/heatmap.3.R\")\r\n> source(\"/home/luna.kuleuven.be/u0106457/Softwares/Trinity/trinityrnaseq-2.2.0/Analysis/DifferentialExpression/R/misc_rnaseq_funcs.R\")\r\n> source(\"/home/luna.kuleuven.be/u0106457/Softwares/Trinity/trinityrnaseq-2.2.0/Analysis/DifferentialExpression/R/pairs3.R\")\r\n> data = primary_data\r\n> samples_data = read.table(\"/home/luna.kuleuven.be/u0106457/Desktop/AgeingRatRNA/Developmental/Trinity/referencetrinity.txt\", header=F, check.names=F, fill=T)\r\n> samples_data = samples_data[samples_data[,2] != '',]\r\n> sample_types = as.character(unique(samples_data[,1]))\r\n> rep_names = as.character(samples_data[,2])\r\n> data = data[, colnames(data) %in% samples_data[,2], drop=F ]\r\n> nsamples = length(sample_types)\r\n> sample_colors = rainbow(nsamples)\r\n> names(sample_colors) = sample_types\r\n> sample_type_list = list()\r\n> for (i in 1:nsamples) {\r\n+     samples_want = samples_data[samples_data[,1]==sample_types[i], 2]\r\n+     sample_type_list[[sample_types[i]]] = as.vector(samples_want)\r\n+ }\r\n> sample_factoring = colnames(data)\r\n> for (i in 1:nsamples) {\r\n+     sample_type = sample_types[i]\r\n+     replicates_want = sample_type_list[[sample_type]]\r\n+     sample_factoring[ colnames(data) %in% replicates_want ] = sample_type\r\n+ }\r\n> # reorder according to sample type.\r\n> tmp_sample_reordering = order(sample_factoring)\r\n> data = data[,tmp_sample_reordering,drop=F]\r\n> sample_factoring = sample_factoring[tmp_sample_reordering]\r\n> initial_matrix = data # store before doing various data transformations\r\n> data = log2(data+1)\r\n> sample_factoring = colnames(data)\r\n> for (i in 1:nsamples) {\r\n+     sample_type = sample_types[i]\r\n+     replicates_want = sample_type_list[[sample_type]]\r\n+     sample_factoring[ colnames(data) %in% replicates_want ] = sample_type\r\n+ }\r\n> sampleAnnotations = matrix(ncol=ncol(data),nrow=nsamples)\r\n> for (i in 1:nsamples) {\r\n+   sampleAnnotations[i,] = colnames(data) %in% sample_type_list[[sample_types[i]]]\r\n+ }\r\n> sampleAnnotations = apply(sampleAnnotations, 1:2, function(x) as.logical(x))\r\n> sampleAnnotations = sample_matrix_to_color_assignments(sampleAnnotations, col=sample_colors)\r\n> rownames(sampleAnnotations) = as.vector(sample_types)\r\n> colnames(sampleAnnotations) = colnames(data)\r\n> data = as.matrix(data) # convert to matrix\r\n> write.table(data, file=\".100_max_DE_eachcompare.matrix.log2.dat\", quote=F, sep='\t');\r\n> sample_cor = cor(data, method='pearson', use='pairwise.complete.obs')\r\n> write.table(sample_cor, file=\".100_max_DE_eachcompare.matrix.log2.sample_cor.dat\", quote=F, sep='\t')\r\n> sample_dist = dist(t(data), method='euclidean')\r\n> hc_samples = hclust(sample_dist, method='complete')\r\n> pdf(\".100_max_DE_eachcompare.matrix.log2.sample_cor_matrix.pdf\")\r\n> sample_cor_for_plot = sample_cor\r\n> heatmap.3(sample_cor_for_plot, dendrogram='both', Rowv=as.dendrogram(hc_samples), Colv=as.dendrogram(hc_samples), col = greenred(75), scale='none', symm=TRUE, key=TRUE,density.info='none', trace='none', symkey=FALSE, symbreaks=F, margins=c(10,10), cexCol=1, cexRow=1, cex.main=0.75, main=paste(\"sample correlation matrix\r\n+ \", \".100_max_DE_eachcompare.matrix.log2\") , ColSideColors=sampleAnnotations, RowSideColors=t(sampleAnnotations))\r\nfor plotting:: min.raw: -0.128063529381365 max.raw: 1\r\n> dev.off()\r\nnull device \r\n          1 \r\n> gene_cor = NULL\r\n> gene_dist = dist(data, method='euclidean')\r\n> if (nrow(data) <= 1) { message('Too few genes to generate heatmap'); quit(status=0); }\r\n> hc_genes = hclust(gene_dist, method='complete')\r\n> myheatcol = colorpanel(75, 'purple','black','yellow')\r\n> data = t(scale(t(data), scale=F)) # center rows, mean substracted\r\n> write.table(data, file=\".100_max_DE_eachcompare.matrix.log2.centered.dat\", quote=F, sep='\t');\r\n> # redo the sample clustering according to the centered distance values.\r\n> sample_dist = dist(t(data), method='euclidean')\r\n> # redo the sample clustering\r\n> hc_samples = hclust(sample_dist, method='complete')\r\n> # redo the gene clustering according to centered distance values.\r\n> gene_dist = dist(data, method='euclidean')\r\n> # redo the gene clustering\r\n> hc_genes = hclust(gene_dist, method='complete')\r\n> heatmap_data = data\r\n> pdf(\".100_max_DE_eachcompare.matrix.log2.centered.genes_vs_samples_heatmap.pdf\")\r\n> heatmap_data = heatmap_data[,rep_names]\r\n> sampleAnnotations = sampleAnnotations[,rep_names]\r\n> heatmap.3(heatmap_data, dendrogram='row', Rowv=as.dendrogram(hc_genes), Colv=F, col=myheatcol, scale=\"none\", density.info=\"none\", trace=\"none\", key=TRUE, keysize=1.2, cexCol=1, margins=c(10,10), cex.main=0.75, main=paste(\"samples vs. features\r\n+ \", \".100_max_DE_eachcompare.matrix.log2.centered\" ) , ColSideColors=sampleAnnotations)\r\nfor plotting:: min.raw: -15.0094347269859 max.raw: 15.0094347269859\r\n> dev.off()\r\nnull device \r\n          1 \r\n> save(list=ls(all=TRUE), file=\".100_max_DE_eachcompare.matrix.RData\")\r\n> \r\n\r\n```\r\nThe file numDE_feature_counts.P0.001_C4.matrix is generated and is: \r\n\r\n\t```\r\n        D1\tD10\tD3\tE18\tM12\tM24\tM3\r\nD1\t0\t22\t3\t9\t815\t338\t533\r\nD10\t22\t0\t5\t98\t436\t114\t141\r\nD3\t3\t5\t0\t17\t730\t301\t386\r\nE18\t9\t98\t17\t0\t883\t564\t750\r\nM12\t815\t436\t730\t883\t0\t2\t66\r\nM24\t338\t114\t301\t564\t2\t0\t8\r\nM3\t533\t141\t386\t750\t66\t8\t0\r\n```\r\n\r\nI am unable to figure out where I am making the mistake.  Could you please help.\r\n\r\nThank you\r\n\r\nBest regards\r\nAbhishek\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"abhisheksinghnl"}}