# Error in Format Data for LEfSe

**URL:** <https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933>\
**Category:** LEfSe\
**Created:** [September 15, 2023, 10:53am UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933 "2023-09-15T10:53:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankita](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@Ankita](https://forum.biobakery.org/u/Ankita)\
**Post date:** [September 15, 2023, 10:53am UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/1 "2023-09-15T10:53:21Z")

</div>

Hello,  
I am not able to formet the data for LefSe and getting the error message as:  
Traceback (most recent call last):  
File “/usr/bin/lefse\_format\_input.py”, line 8, in   
sys.exit(format\_input())  
File “/usr/lib/python3.6/site-packages/lefse/lefse\_format\_input.py”, line 437, in format\_input  
class\_sl,subclass\_sl,class\_h

Please help me out.  
Thanks in advance,  
Ankita MAddheshiya

---

<div class="post-metadata">

**Author:** ![sagunmaharjann](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/sagunmaharjann/32/168_2.png) [@sagunmaharjann](https://forum.biobakery.org/u/sagunmaharjann)\
**Post date:** [September 15, 2023, 3:14pm UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/2 "2023-09-15T15:14:26Z")

</div>

Hi @Ankita,  
Can you upload the the input file please? I can check from my end.

Regards,  
Sagun

---

<div class="post-metadata">

**Author:** ![Adharna](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@Adharna](https://forum.biobakery.org/u/Adharna)\
**Post date:** [September 17, 2023, 4:53pm UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/3 "2023-09-17T16:53:19Z")

</div>

I am also having a similar issue.

---

<div class="post-metadata">

**Author:** ![Ankita](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@Ankita](https://forum.biobakery.org/u/Ankita)\
**Post date:** [September 18, 2023, 5:10am UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/4 "2023-09-18T05:10:41Z")

</div>

Hello @sagunmaharjann,

Attached the file here.

Regards,  
Ankita  
[L2.txt](https://forum.biobakery.org/uploads/short-url/sxrgXiXFMdD25KT4G4ZkVAWbMdb.txt) (13.5 KB)

---

<div class="post-metadata">

**Author:** ![ddurgan](https://avatars.discourse-cdn.com/v4/letter/d/85f322/32.png) [@ddurgan](https://forum.biobakery.org/u/ddurgan)\
**Post date:** [October 3, 2023, 8:57pm UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/5 "2023-10-03T20:57:32Z")

</div>

Did you get a solution? I’m having the same issue even when I use input files that have worked in the past.

---

<div class="post-metadata">

**Author:** ![ddurgan](https://avatars.discourse-cdn.com/v4/letter/d/85f322/32.png) [@ddurgan](https://forum.biobakery.org/u/ddurgan)\
**Post date:** [October 3, 2023, 9:27pm UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/6 "2023-10-03T21:27:48Z")

</div>

Has a solution been found for this problem? I am receiving the same message even when trying to use input files that have worked with Lefse in the past.  
Thanks

---

<div class="post-metadata">

**Author:** ![Ankita](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@Ankita](https://forum.biobakery.org/u/Ankita)\
**Post date:** [October 4, 2023, 10:09am UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/7 "2023-10-04T10:09:14Z")

</div>

Same thing is happening with me. I haven’t found any solution till now.

---

<div class="post-metadata">

**Author:** ![blair.merrick](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@blair.merrick](https://forum.biobakery.org/u/blair.merrick)\
**Post date:** [October 4, 2023, 11:31pm UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/8 "2023-10-04T23:31:26Z")

</div>

Also having the same issue (again with files that have previously run ok).

---

<div class="post-metadata">

**Author:** ![blair.merrick](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@blair.merrick](https://forum.biobakery.org/u/blair.merrick)\
**Post date:** [October 6, 2023, 12:30pm UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/9 "2023-10-06T12:30:00Z")

</div>

Managed to get it to run by downloading an updated “lefse\_format\_input.py” file from: [https://github.com/SegataLab/lefse/tree/master/lefse](https://github.com/SegataLab/lefse/tree/master/lefse)

---

<div class="post-metadata">

**Author:** ![goober\_grape](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/goober_grape/32/2452_2.png) [@goober\_grape](https://forum.biobakery.org/u/goober_grape)\
**Post date:** [October 11, 2023, 4:42pm UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/10 "2023-10-11T16:42:23Z")

</div>

I tried that, tried putting it in the following directory:  
/Users/nate/miniconda3/envs/lefse/bin

I received error that I did not have permission. I chmod +x  
And running into same problem I had with original lefse\_format\_input.py:  
“variables 1 2 3 4 5 6 7 8 appear to be constant within groups”

I found somewhere that is due to an outdated lefse\_format\_input.py

I have tried with and without subjectID, (-u)  
And with the server down, not sure how to proceed.

could it have anything to do with sample size per treatment? I have at least one treatment with only two samples. Wondering if that is to blame

Any suggestions would be greatly appreciated! TIA

---

<div class="post-metadata">

**Author:** ![goober\_grape](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/goober_grape/32/2452_2.png) [@goober\_grape](https://forum.biobakery.org/u/goober_grape)\
**Post date:** [November 1, 2023, 9:13pm UTC](https://forum.biobakery.org/t/error-in-format-data-for-lefse/5933/12 "2023-11-01T21:13:28Z")

</div>

actually, it wasn’t the sample size, well not directly, I needed to further filter the taxa I was using as some of them were only present in 2 samples. When I filtered to use taxa only present in at least 3 samples, I did not get the constant variable error.

I am wondering why exactly the error occurs. Having compared data where the error occurs (retaining all taxa found in at least two samples, or s2) versus where it doesn’t occur (retaining all taxa found in at least three samples, or s3), it is hard to find any obvious rule. Six taxa in the s2 dataset are found in only one treatment and not others - I thought that may be the rule but there are eight taxa triggering the error.

There are a couple other taxa that are found almost exclusively in one treatment, with only one more occurrence; they could account for the other two variables.

This brings me to another question - do I have my variables coded incorrectly or does the script not tell you which taxa by name, just “variables 1 2 3 4 5 6 7 8”? It would be nice to know which ones. Is that the first eight variables? If that is the case, I am barking up the wrong tree wrt rules triggering the error.

Any help in figuring this out would be greatly appreciated.
