I am trying to run LEfSe analysis. Can someone provide qiime2 coding to convert table.qza to something compatible for LEfSe. I found an old posting (from June 2018), but it seems not working (outdated?). Thanks!!
Welcome to @hjeong1!
Aside from the content outlined here:
I’ve often made use of qiime2R and then feed the phyloseq object to phyloseq2lefse.R. You’ll have to perform some minor edits to the resulting table, e.g. move excess rows of metadata. But I’ve used this approach several times quite successfully.
I have never been able to use any tool to do this!!
I do it manually. Export your table of taxonomically attributed ASV (using qiime taxa collapse, ex. at L6). Then export to BIOM and then to text format (using the -‘to-tsv’ from the biom module).
Once you have exported the table to text format (L6_table.txt), you merge it with the metadata (i use Excell ! since there is not too much data at that point). Then flip around, sort, merge SampleID with metadata, keep only the needed lines in the header and change the ‘;’ to ‘|’. And you are all set!
Just have a good look at an example sample sheet. Like on the galaxy server.
I like this way to go as you look at the table when manipulating it.
Good luck with that and have a great one, -JA
Just to clarify, the R wrapper I reference only prepares a data table for you in R and does not require that you have LEfSe installed. Obviously, it does require phyloseq.
If you’d like to be able to run LEfSe locally, you may want to try the approach outlined below. I have not tried this recently, but it did work when I installed last September.
conda update conda conda create -n lefse -c conda-forge python=2.7.15 conda activate lefse conda install -c bioconda -c conda-forge lefse conda update lefse
Then you can:
conda activate lefse lefse-format_input.py \ tax-otu-table.txt \ tax-otu-table-form.txt \ -c 1 -u 2 -o 1000000 run_lefse.py \ tax-otu-table-form.txt \ tax-otu-table-result.txt lefse-plot_res.py \ tax-otu-table-result.txt \ tax-otu-table-diffabund.pdf \ lefse-plot_cladogram.py \ tax-otu-table-result.txt \ tax-otu-table-cladogram.pdf \
-I hope this helps! If anyone has other or better solutions please let us know.