Hello there,
I am trying to do PLS-DA for 16s amplicon data from mice gut. However, I have the phyloseq object to do the analysis and according to the tutorial, I was able to do the PCA plot.
So, for the PLS-DA analysis, how to prepare my x and y values.
If you can explain the steps in a little bit detail, I will really be grateful.
Hi Madhuri,
there are some very nice tutorials that may answer all your questions. To see how to import, arrange and preprocess your data (including phyloseq), i suggest you look at http://mixomics.org/mixmc/mixmc-pre-processing/.
Here is what the basic code looks like (Credits to Ms Laetitia Cardona from INRAE and the MixOmics team):
library(phyloseq)
# load the data from the phyloseq package
data(GlobalPatterns)
?GlobalPatterns
# extraction of the taxonomy
Tax <- tax_table(GlobalPatterns)
# extraction of the metadata
Metadata <- GlobalPatterns@sam_data
# extract OTU table from phyloseq object
data.raw <- t(otu_table(GlobalPatterns)) # samples should be in row and variables in column
# offset
data.offset <- data.raw+1
sum(which(data.offset == 0)) # ok
dim(data.offset) # check dimensions
data.offset[1:5,1:5] # inspect the data
For a detailed tutorial on how to perform the PLS-DA, you can have a look at http://mixomics.org/mixmc/case-study-koren-diverse-bodysites/, or if you are working with repeated measure: http://mixomics.org/mixmc/case-study-hmp-bodysites-repeated-measures/
I hope this was helpful
Kind regards
Christopher
1 Like