First of all, it seems like you were able to run lefse-plot_res.py without any issues at least and the error is coming from lefse-plot_cladogram.py. Can you confirm this? For example, can you show me the output/Useful-Information/output.pdf file?
Secondly, you may have one or more outdated libraries installed in your LEfSe environment. Can you show me the result of conda list after activating your LEfSe environment?
I'm sorry I didn't explain myself so well... I was not able to run lefse-plot_res.py . Instead, I got the following error, so I can't show you the output.pdf file, due to this not being generated.
Traceback (most recent call last):
File "/home/unidad/anaconda3/envs/lefse/bin/lefse-plot_res.py", line 177, in
else: plot_histo_hor(params['output_file'],params,data,len(data['cls']) == 2,params['report_features'])
File "/home/unidad/anaconda3/envs/lefse/bin/lefse-plot_res.py", line 70, in plot_histo_hor
ax = fig.add_subplot(111,frame_on=False,axis_bgcolor=params['back_color'])
File "/home/unidad/anaconda3/envs/lefse/lib/python2.7/site-packages/matplotlib/figure.py", line 1257, in add_subplot
a = subplot_class_factory(projection_class)(self, *args, **kwargs)
File "/home/unidad/anaconda3/envs/lefse/lib/python2.7/site-packages/matplotlib/axes/_subplots.py", line 77, in init
self._axes_class.init(self, fig, self.figbox, **kwargs)
File "/home/unidad/anaconda3/envs/lefse/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 541, in init
self.update(kwargs)
File "/home/unidad/anaconda3/envs/lefse/lib/python2.7/site-packages/matplotlib/artist.py", line 888, in update
for k, v in props.items()]
File "/home/unidad/anaconda3/envs/lefse/lib/python2.7/site-packages/matplotlib/artist.py", line 881, in _update_property
raise AttributeError('Unknown property %s' % k)
AttributeError: Unknown property axis_bgcolor
Here is the output of conda list command. I hope the error is on account of outdated libraries. However, I don't understand how is that possible. I mean, If it is the first time I use LefSe and I have just installed it, how are the libraries not updated? **I'm quite new on command line programming
Good question! When you installed LEfSe in your conda environment, you actually installed additional packages with specific versions that you see with $ conda list. And these specific versions may be not most up to date. In fact, I think I found the issue. If you compare your list to mine, you will see that I'm using matplotlib 2.1.2 while you are using matplotlib 2.2.5. I'm not exactly sure how you got that particular version in the first place, but it seems like the error you reported (AttributeError: Unknown property axis_bgcolor) is caused because axis_bgcolor was removed since matplotlib 2.2.0 (see the changelog here). To fix the issue, you have to remove matplotlib from your LEfSe environment and then reinstall a version below 2.2.0:
Thank you so much for everything you have done! The problem is fixed and I finally got the two PDF files
Now I have an additional (and I hope final) question: How are we supposed to interpret the results when we get a __ instead of a bacterial name? I have had a look to your PDF-s and you also get that kind of results (comparing with my PDF-s yours is much more completed and longer; I have a really small number of samples). I supposed those are sequences that did not get to be mapped or classified with any bacteria, aren’t them? Thus, how to interpret that? Just ignoring them?
I attached my PDF-s below, so you can have a look at them
The distinction is that the first row (ending in ; ) cannot be confidently classified beyond family level (probably because a close match does not exist in the reference database). So sequences receiving that classification can be any taxon in f__Geodermatophilaceae. The second row (ending in g__;s__) DOES have a close match in the reference database and hence is confidently classified at species level — unfortunately, that close match does not have genus or species-level annotations. This does not in any way imply that these two different taxonomic affiliations are related beyond the family level, so it would probably be inappropriate (or at least presumptuous) to collapse these at species level.
Now that we are (hopefully) on the same page with what those double underscores mean, what I ended up doing was updating my dokdo package to handle the double underscores better. For example, instead of outputting k__Bacteria|p__Actinobacteria|c__Actinobacteria|o__Actinomycetales|f__Intrasporangiaceae|f__Intrasporangiaceae|__, the 1.6.0-dev version now outputs k__Bacteria|p__Actinobacteria|c__Actinobacteria|o__Actinomycetales|f__Intrasporangiaceae|f__Intrasporangiaceae_x__L6. This way, if this particular taxon is returned as significant by LEfSe, it will show up as f__Intrasporangiaceae_x__L6 instead of __. For more examples, scroll up and click the files linked to my original tutorial; I updated those files. I will link one PDF file here as an example. output.pdf - Google Drive
Finally, if you wish to re-run your analysis with the 1.6.0-dev version of Dokdo, make sure to re-install Dokdo:
Hi @sbslee
I am trying to use LEfSe following the commands you provided here
during preparing the files I got this error (at the end in bold)
dokdo prepare-lefse
-t table.qza
-x taxonomy.qza
-m metadata.tsv
-o output/Useful-Information/input_table.tsv
-c health-state
-u age
-w "[health-state] IN ('healthy', 'patient')"
Traceback (most recent call last):
File "/usr/local/bin/dokdo", line 5, in
from dokdo.main import main
File "/usr/local/lib/python3.8/dist-packages/dokdo/init.py", line 1, in
from .api import *
File "/usr/local/lib/python3.8/dist-packages/dokdo/api/init.py", line 1, in
from .get_mf import get_mf
File "/usr/local/lib/python3.8/dist-packages/dokdo/api/get_mf.py", line 1, in
from qiime2 import Metadata ModuleNotFoundError: No module named 'qiime2'
I am using qiime2. 2021.4 and python 3.8
any advices?
It looks like you ran the command ($ dokdo prepare-lefse ...) in an environment where QIIME 2 is not installed. Did you make sure to activate your qiime2-2021.4 environment with $ conda activate before running the command?
Thanks for confirming that. The error is still puzzling to me because it indicates that Dokdo isn't able to find QIIME 2 in the current environment. If you don't mind, could you show me the results of
for the second command "dokdo -v" gave me the same as previous although the dokdo was installed
after running the command dokdo -v
Traceback (most recent call last):
File "/usr/local/bin/dokdo", line 5, in
from dokdo.main import main
File "/usr/local/lib/python3.8/dist-packages/dokdo/init.py", line 1, in
from .api import *
File "/usr/local/lib/python3.8/dist-packages/dokdo/api/init.py", line 1, in
from .get_mf import get_mf
File "/usr/local/lib/python3.8/dist-packages/dokdo/api/get_mf.py", line 1, in
from qiime2 import Metadata
ModuleNotFoundError: No module named 'qiime2'
I found the problem! You are currently using the 1.0.0 version of Dokdo, which is terribly outdated and doesn't even have the prepare-lefse command. Please re-install the latest version: 1.10.0:
I found a problem with installing LEfSe within python 3.8
I tried with the commands you provided here but with the last one, there was a problem that the environment is unsuitable
solving the environment was running for hours and eventually not solved,
another trying for installing from other sources detected that the python version is an unappropriated for this tool
any suggestions, please?
like you said, I also could not download properly because it took forever to solve the environment. It turns out, there was a new release of LEfSe in bionconda (v1.1.1) a couple months ago. We want the other version (v1.0.8.post1):
$ conda install -c bioconda lefse=1.0.8.post1
This allowed me to download properly. So in summary, follow the these commands:
Miniconda3\envs\lefse\bin\lefse-format_input.py", line 109
return int(a[u] > b[u])*2-1
TabError: inconsistent use of tabs and spaces in indentation
My understanding is there is an error in the python script itself (as opposed to my input file). But when opening and looking at the script it looks ok...