joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
584 stars 187 forks source link

Defining sample order in heatmap x-axis #1189

Open MissMcDolly opened 5 years ago

MissMcDolly commented 5 years ago

Dear all, I'm still quite a newbie to phyloseq and R, currently I'm struggling with the issue that I can't structure my heatmap (see picture attached) in the way I want it. The issue is that I want to present the samples on the x-axis in a specific order. I tried the following code, but it is not working: "plot_heatmap(maizestrawk1_abund, method = "NMDS", distance = "bray",taxa.label = "Genus", sample.label = "Probe", sample.order = "DFK18_0004_DNA","DFK18_0004_cDNA","DFK18_0017_DNA","DFK18_0017_cDNA","DFK18_0023_DNA","DFK18_0023_cDNA","DFK18_0043_DNA","DFK18_0043_cDNA","DFK18_0049_DNA","DFK18_0049_cDNA") Error in 1:rankcol : argument of length 0 I think the issue is that my data was maybe not formatted in the right way, so that the sample names are not grasped by R. Could you help me identifying the problem? Heatmap_K1

roey-angel commented 5 years ago

It seems you're trying to pass a character vector to sample.order but your syntax is wrong and should be c("DFK18_0004_DNA",...). This is basic R syntax and not phyloseq related.