1. bioBakery
  2. Untitled Project
  3. biobakery

Wiki

Clone wiki

biobakery / lefse

LEfSe Tutorial

LEfSe (Linear discriminant analysis Effect Size) determines the features (organisms, clades, operational taxonomic units, genes, or functions) most likely to explain differences between classes by coupling standard tests for statistical significance with additional tests encoding biological consistency and effect relevance.

LEfSe is available as a Galaxy module, and as a bitbucket repository. For additional information, please refer to the LEfSe paper.

We provide support for LEfSe users. Please join our Google group designated specifically for LEfSe users. Feel free to post any questions on the google group by posting directly or emailing lefse-users@googlegroups.com.



Overview

The following figure shows LEfSe's workflow.

LEfSe.png

1. LEfSe (Galaxy)

For the purpose of this tutorial we will be using a sample input file depicting the general format of the input file(two rows of metadata, one row of sample names and the corresponding microbial abundance table). Follow the instructions below to perform the LEfSe analysis on the sample data set.

  • Download the file from the URL.
  • Go to the Huttenhower Galaxy server and click on the LEfSe link on the left pane.
  • Click on the Load data link to upload the input file. Click Browse to select the file, or paste the URL of the input file in the URL/Text Text box, and press the Execute button when ready.
https://bitbucket.org/repo/49y6o9/images/3931070337-load_lefse_graphlan.png
  • Click on the Format Data for LEfSe link on the left pane, and select the specific rows for Class, Subclass and Subjects in your file, and press the Execute button as shown below:
format_lefse_graphlan.png
  • Click on the LDA Effect Size (LEfSe) link on the left pane, and select parameter values according to your analysis requirements. Press Execute, when done.
lda_lefse_graphlan.png
  • Once complete, you may now plot the LEfSe results, by click on the Plot LEfSe Results link on the left pane, and press the Execute button as shown below:
plot_lefse_graphlan.png
  • This will produce a figure, that will look like as shown below (To visualize the figure in the browser, click on the Eye symbol against the resulting output in the right pane).
plotii_lefse_graphlan.png
  • To plot a cladogram of your results, you may click on the Plot Cladogram link on the left pane, and press the Execute button when ready.
clad_lefse_graphlan.png
  • This action will produce a cladogram, as shown below:
cladii_lefse_graphlan.png

You may also plot differential features or one feature. Please refer to the LEfSe documentation for more information.


2. LEfSe (bitbucket)

For instructions on pre-requisites/dependencies, installation and input formats, please refer to the LEfSe documentation (Step 4).

For the purpose of this tutorial we will be using a sample input file: hmp_small_aerobiosis.txt depicting the general format of the input file (two rows of metadata, one row of sample names and the corresponding microbial abundance table). Follow the instructions below to perform LEfSe,

  • Run the following command to format the input file: hmp_small_aerobiosis.txt from the ../lefse directory. This will generate a file (hmp_aerobiosis_small.in) under the tmp directory.
$ python format_input.py input/hmp_aerobiosis_small.txt tmp/hmp_aerobiosis_small.in -c 1 -s 2 -u 3 -o 1000000
  • Run the following command, passing the file generated in the previous step as input. This will generate

a file (hmp_aerobiosis_small.res) under the ../lefse/results/ directory consisting of LEfSe analysis results.

$ python run_lefse.py tmp/hmp_aerobiosis_small.in results/hmp_aerobiosis_small.res

3. Visualization

To visualize the results, LEfSe provides a couple of options. For all the options you will need the output from run_lefse.py (in this case: hmp_aerobiosis_small.res under the results directory)

  • To plot the results of the LEfSe analysis generated from the previous step, run the following command.
$ python plot_res.py results/hmp_aerobiosis_small.res output_figures/hmp_aerobiosis_small.png
  • This will produce a figure under the directory ../lefse/output_figures/, as shown below:
hmp_aerobiosis_small.png
  • You may also choose to visualize the results in a Cladogram. Run the following command to generate the Cladogram figure. This will use the LEfSe results file generated previously from the results folder, and store the resulting figure in the ../lefse/output_figures/ folder.
$ python plot_cladogram.py results/hmp_aerobiosis_small.res output_figures/hmp_aerobiosis_small.cladogram.png --format png
  • The resulting figure is shown below.
hmp_aerobiosis_small.cladogram.png

Notes

For information on more options, and further analyses, please refer to Step 4 in the MetaPhlAn Pipeline Tutorials.

Updated