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/
567 stars 187 forks source link

Error when using hellinger transformation with ordinate and PCoA #1749

Open timz0605 opened 1 month ago

timz0605 commented 1 month ago

Hello, I am working with COI metabarcoding data of 24 samples, and there are many zeroes in the data frame, as some zotus are not detected in certain samples. I am using the transform_sample_counts to convert my otu_table into Hellinger-transformed data. After that, I want to do a PCoA using bray-curtis dissimilarity. However, I have been encountering this issue with the above approach.

Below is the code I am using:

merged_ps_hellinger <- transform_sample_counts(merged_ps, function(x) sqrt(x / sum(x)))
merged_ps.hellinger <- ordinate(merged_ps_hellinger, "PCoA", "bray")
p <- plot_ordination(merged_ps_hellinger, merged_ps.helligner, color = "locality",
                     shape = "monthCollected")

However, I have been encountering this error message:

Warning messages:
1: In scores(ordination, choices = axes, display = "species", physeq = physeq) :
  restarting interrupted promise evaluation
2: In plot_ordination(merged_ps_hellinger, merged_ps.helligner, color = "locality",  :
  Could not obtain coordinates from the provided `ordination`. 
Please check your ordination method, and whether it is supported by `scores` or listed by phyloseq-package.

Looking at the merged_ps.hellinger after the ordinate step, compared to simply performing PCoA with bray of the original phyloseq object, I notice that the values data frame went from 24 rows and 6 columns to 23 rows and 5 columns, missing the column for Rel_corr_eig. Might this be the reason causing this issue? I wonder if anyone have encountered similar issues before, and know the solution?