phyloseq icon indicating copy to clipboard operation
phyloseq copied to clipboard

Error when using hellinger transformation with ordinate and PCoA

Open timz0605 opened this issue 9 months ago • 0 comments

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?

timz0605 avatar May 07 '24 09:05 timz0605