# How can I get lefse output for a single taxonomy level (e.g. species) only?

**URL:** <https://forum.biobakery.org/t/how-can-i-get-lefse-output-for-a-single-taxonomy-level-e-g-species-only/800>\
**Category:** LEfSe\
**Created:** [July 30, 2020, 5:44pm UTC](https://forum.biobakery.org/t/how-can-i-get-lefse-output-for-a-single-taxonomy-level-e-g-species-only/800 "2020-07-30T17:44:32Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Kelsey\_Thompson](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/kelsey_thompson/32/65_2.png) [@Kelsey\_Thompson](https://forum.biobakery.org/u/Kelsey_Thompson)\
**Post date:** [July 31, 2020, 4:57pm UTC](https://forum.biobakery.org/t/how-can-i-get-lefse-output-for-a-single-taxonomy-level-e-g-species-only/800/4 "2020-07-31T16:57:26Z")

</div>

Hi dc-  
You can also run something like:  
for MetaPhlAn3 output on the command line

```auto
$ grep -E "s __|clade" merged_abundance_table.txt | sed 's/^.*s__ //g' | cut -f1,3-8 | sed -e 's/clade_name/body_site/g' > merged_abundance_table_species.txt

```

or  
For MetaPhlAn2 output

```auto
$ grep -E "(s__)|(^ID)" merged_abundance_table.txt | grep -v "t__" | sed 's/^.*s__//g' > merged_abundance_table_species.txt

```

To produce feature tables that only have the species level results. Both commands are from the MetaPhlAn tutorials: [https://github.com/biobakery/biobakery/wiki/metaphlan2;](https://github.com/biobakery/biobakery/wiki/metaphlan2;) [https://github.com/biobakery/biobakery/wiki/metaphlan3](https://github.com/biobakery/biobakery/wiki/metaphlan3) - this will give you more information on what exactly those commands are doing.

---

_[View the full topic](https://forum.biobakery.org/t/how-can-i-get-lefse-output-for-a-single-taxonomy-level-e-g-species-only/800)._
