If I have phyloseq file instead of example data how I show start
Hi Guys So I am new to lefse analysis, I start using lefser I am starting with phyloseq file then I produced otutable and with a metadata file I made S4 object of SummarizedExperiment using the following code: counts = otu_table(phytted) %>%as.data.frame() colData = meta(physeq) %>% as.data.frame
phyExp = SummarizedExperiment(assays = list(counts = counts),colData = colData)
usually I got error that
Error in validObject(.Object) :
invalid class “SummarizedExperiment” object: nb of cols in 'assay' (417) must equal nb of rows in 'colData' (409)
NB: the extra columns is the taxonomy and OTU names in the tables
Even if i am able to fix that later on when I am run the lefser I got another error
res.lefse.1 = lefser(phyExp.4, groupCol = "SampleType")
Error in cols * 0.05 : non-numeric argument to binary operator
Is there is smooth way to lefser from phyloseq object or do you see problem in my code can be fixed
Thanks Hesham
Did you ever find a solution to this? I have the same problem.
I think you can use the function makeTreeSummarizedExperimentFromPhyloseq() from the mia package
Hi, I ended using another package (microbial) they also have lefse analysis called "ldamarker"
ldamarker(physeq, group, pvalue = 0.05, normalize = TRUE, method = "relative")
Here is the code if you are interested.
upload the libraries
library(microbial) library(microbiome) library(ggpubr)
remove low abundance otu, threshold is 0.005% (0.00005)
otu <- otu_table(phyloseq) high_otu_idx <- colSums(otu)/sum(otu) >= 0.00005 high_otu <- taxa_names(phyloseq)[high_otu_idx] ps.lefse <- prune_taxa(high_otu, phyloseq)
perform the lefese on phyloseq
res <- ldamarker(ps.lefse ,group="SampleType")
lefse_plot <- plotLDA(res,group=c("X","Y"), lda=5, pvalue=0.05, color = c("red","green"), fontsize.x = 7,fontsize.y = 8)
Then I stopped using lefse and started to use ANCOM BC instead (https://www.nature.com/articles/s41467-020-17041-7) Analysis of compositions of microbiomes with bias correction. based on co-author advice more for compositional data like 16 sRNA bacterial communities.
- Hesham
Dear Hesham, thanks a lot for your comment and suggestions! I will have a look at ANCOM BC, too.
@Hesham999666 I tried this code and my plot is coming up blank. Do you know what this could be?