Hi everyone, I am a totally newbie in anayzing microbial community. I am trying to plot heatmap with heatmap.2 My data contains over 2000 OTUs for 40 samples. And I only want to show the top 20 abundant OTUs in the heatmap.( Something similar to the figure from this.
Anyone has an idea how to do that in R?
Thanks a lot.
When Using Heatmap.2 From R To Make A Heatmap Of Microarray Data, How Are The Genes Clustered?
https://www.r-bloggers.com/from-otu-table-to-heatmap/
http://www.molecularecologist.com/2013/08/making-heatmaps-with-r-for-microbiome-analysis/
Thanks a lot! Thanks a lot! (Finally over 20 characters..)
when you say your data is having top 2000 OTU's are they ranked on the basis of any significance of fold changes or any other metric? If so then your dataframe should have the first 20 rows as your top 20 if there are some rankings. You need to rank them otherwise based on significance or any metric that can make your dataframe or file.txt in order of highest ranking and down. Then select as @Forever suggested and just plot the heatmap of the top 20 rows.
Thanks so much for your reply. I think the 2000 OTUs are ranked. But the thing is, I have over 40 samples which are from different experimental groups. Say, if I want to separate the 40 samples into 3 groups, the rank of the OTUs will definitely be different. If I separate the original OTU table into 3 tables, how can I rank them separately based on the significance or any metric?
Ignore the above if differential testing is already done and 2k OTU is a result of that, then simply group your 40 samples in a data-frame to 3 groups(am sure you will know which 3 groups comprise to give 40 samples) and use them as label taking the top 20 OTUs (as I mentioned in the previous comment). Use annotation labels that will also provide the group labels of 40 samples into 3.
Thanks very much! Finally figured this out.