Hi @Kelsey_Thompson,
Okay since I first posted I have found a solution, so I thought I would post my code in case others want to know how to remove the LEfSe tests that are happening for higher taxonomic classifications. I work with ASVs and I wanted to run LEfSe tests on individual ASVs labelled for their lowest possibly taxonomic assignment. I hope this will help, as I appreciate the tool package and also making it available to the community
I then wanted to follow-up to see if you think anything about my approach would be incorrect in analyzing my microbiome data this way or explain further the rationale on why the package includes analysis for higher-order taxonomic levels?
Thanks,
-Amber
############################LDA and Lefse analysis
#to remove the higher taxonomic rankings in the LDA, reduce the tax_table to only a single column that includes the lowest taxonomic assignment at genus-level concatenated to the ASV identfier
#note you may need to modify your tax_table for lowest taxonomy (see:Rename "NA" to "unspecified + [last identified taxa]" · Issue #850 · joey711/phyloseq · GitHub)
#extract the taxonomy table from the ps object
tax.out = data.frame(tax_table(ps))
tax.out3 = tax.out
names = rownames(tax.out3)
tax.out3[,“ASV”] = names
tax.out3$Species_new = paste(tax.out3$Genus, tax.out3$ASV, sep="_")
new_tax.out3 = dplyr::select(tax.out3, -Species, -ASV)
new_tax.out4 = dplyr::select(new_tax.out3, -Genus)
colnames(new_tax.out4)[6] ← “Genus”
new_tax.out5 = dplyr::select(new_tax.out4, -Kingdom, -Phylum, -Class, -Order, -Family)
#create a new ps object to replace with the reduced taxonomy table
ps2 = ps
tax_table(ps2) ← as.matrix(new_tax.out5)
Linear discriminant analysis (LDA) effect size (LEFSe) -
library(microbiomeMarker)
#lefse analysis returns a microbiome biomarker stored in marker_table-class
mm3 ← lefse(ps2, norm=“none”, class=“Location1”, lda_cutoff=2,multicls_strat=TRUE)
#plot
plot_ef_bar(mm3, label_level=1, max_label_len = 100)+
scale_fill_manual(values=myCol)
#####end