Why PCoA and not PCA with DEICODE output?


(Sarah) #1

Can anyone explain to me why emperor biplots with DEICODE output are PCoA and not PCA? I’m second-guessing myself on this, and would like to get someone else’s explanation to help clarify.


How to make pcoa biplot in R using q2-deicode ordination
(Evan Bolyen) #2

Hi @smreyes,

I think this is just a result of the types not being 100% caught up to what is actually happening. This is something that should improve in the next few releases when we have a little bit more machinery to deal with this.


(Evan Bolyen) #3

pinging @cmartino, @mortonjt, and @yoshiki

P.S. I am working on TypeMap right now, so it will become really easy to map different input types to different output types, while preserving or discarding any properties as needed.


(Jamie Morton) #4

@smreyes - PCoA with Euclidean distance is equivalent to PCA.

DEICODE is not exactly performing PCA - it is performing PCoA using the Aitchison distance (while handling zeros). In terms of semantic types, I think PCoA should be appropriate.


(Sarah) #5

@mortonjt thanks so much for the explanation!


(Sarah) #6

@ebolyen does this include qiime2R format? I typically make PCoAs in R via qiime2R but the ordination.qza file from DEICODE isn’t a seamless transition as (un)weighted UniFrac files. Exporting ordination.qza also doesn’t seem to provide all the information needed to make a PCoA in R. Any help on this would be greatly appreciated!


(Evan Bolyen) #7

Any particular errors you can see, or is the graph just not rendering right?

I suspect the issue might be the biplot section of the file format. @jbisanz, does qiime2R have a way to handle the extra data? Otherwise I don’t see why DEICODE would in particular cause an issue.


(Sarah) #8

Haven’t looked into it too much but I get the following warning message when I upload the file.

Then the following header and error when trying to use write.table


(Jordan Bisanz) #9

Hmm yes, I am almost certain that the issue lies in how I have imported the ordinations as the format was a little tricky to deal with. I will do a little investigation with a biplot artifact and try to come up with a solution.


(Jordan Bisanz) #10

After looking at the format specification, I am thinking it would be easiest to split the file into multiple sub-tsvs based on the headers in the temporary directory, then independently read these in using read.table or equivalent. Then the objects would be available as:

data$Eigvals
data$ProportionExplained
data$Site
data$Biplot
data$SiteConstraints

Does this seem logical @ebolyen ?


(Evan Bolyen) #11

That makes sense to me, I assume there is no way to manipulate the underlying filehandle to stop reading at those breakpoints (or otherwise configure read.table).


(Jordan Bisanz) #12

I did not have access to an actual DEICODE output as it doesn’t seem to be available in the tutorial so if you could please update to the latest version of qiime2R and let me know how it goes?
I used the labels as identified within the format specification with one exception: I renamed Site to Vectors to keep consistent with the current qiime2R tutorial and the nomenclature used in ape.


(cameron martino) #13

@jbisanz The ordination output of DEICODE from the tutorial can be found here. I will add links to the outputs in the tutorial. Thank you for making qiime2R and adding biplot functionality!


(Jordan Bisanz) #14

Great thanks. It looks like the data is being faithfully imported.


(Sarah) #16

So I’m not sure if I’m doing something wrong, but I reanalyzed my data and still got the same error message when trying to import into R via read_qza. I also downloaded the ordination.qza file from the tutorial and experienced the same problem. Is there something obvious on my end I should be doing?


(Jordan Bisanz) #17

Hmm, I think you need to update to the latest version as that line of code has been removed. It would be devtools::install_github("jbisanz/qiime2R"). Running this line will check to see if there is a newer version available and update if there is.


(Sarah) #18

You were right! I had to restart my R session and open/close R studio before it worked…but I got it! Thanks a million!