1

I have data with OTUs representing fungal taxa I have discovered through metabarcoding of moths with ITS2 primers. I have a phyloseq object with an otu_table, tax_table, and sam_data. In sam_data I have categories with all taxonomic levels of the sample (buttterfly). I have merged the individual samples by a category in my sam_data called species. This means that instead of having a bunch of samples where some samples are belonging to the same species, I now have a phyloseq object with much fewer samples, since the once who share species now are grouped together.

Code for merging:

physeq <- phyloseq(OTU, TAX, META)

mergesamp_physeq <- merge_samples(physeq, "species")

I have also merged the OTU table so that OTUs identified to be the same species are merged into one OTU:

merge_physeq <- tax_glom(mergesam_physeq, "species")

I now want to do a PCoA on this data using genus to colour the samples in my ordination, but the return shows me a PCoA without colour. I get no errors. See immage of PcoA plot, script below:

pcoa_bc = ordinate(merge_physeq, "PCoA", "bray") plot_ordination(merge_physeq, pcoa_bc, color = "genus") + geom_point(size = 3) + ggtitle("PCoA")

Does someone might now what has happened? It works fine before merging of samples and taxa.

EDIT: My sam_data() does indeed get a lot of NAs after merging. Identical column names is adressed as R by a warning, but it automatically renames my sample data headers with a "sam_" prefix, so that should be no issue. I have solved this by phrasing my question differently in another post the whole issue with merging samples is resolved here: Solution

sondre
  • 15
  • 6
  • Without an example of your data it is not possible to reproduce your problem; however, calling `merge_samples` without an appropriate `fun` argument (the default is `mean`) may have resulted in NA values in your `sample_data`. Could you check this using `sample_data(mergesamp_physeq`)? – gmt Nov 02 '22 at 14:18
  • You may also be getting some issues from having identical column names in both your taxonomy table and your sample data. For example, if you were to call `psmelt` on this dataset, the columns from the sample data would get renamed from e.g. 'species' to 'sample_species'. If you then try to colour by species, it won't work. – gmt Nov 02 '22 at 14:23

1 Answers1

0

The problem is resolved here: Solution The issue is with merging and the issue is more clearly stated in this post.

sondre
  • 15
  • 6
  • Could you please add a little more detail to this answer? The link is helpful, but it's preferable that answers are as self-contained as possible. – Captain Hat Nov 07 '22 at 10:07