Invalid syntax message when running export2graphlan

Hello,
I am running GraPhlAn taking as a reference the turorial:

I tried to run the step 1 (to create the GraPhlAn input files), but I got an error message:

File "/home/eyre/anaconda3/bin/export2graphlan.py", line 23
    def scale_color((h, s, v), factor=1.0):
                    ^
SyntaxError: invalid syntax

I installed export2graphlan again (conda install export2graphlan) but it has the same error message.

Is it possible that I should need to install it differently?

Thank you.

Hi,

Thanks for your interest in GraPhlAn and sorry for the late reply. Can you send me a copy of the command that you used? I will see if I can recreate the error. Thanks!

Regards,
Aaron.

Hi @aaron_walsh,

I got the same error. These are my commands:

export2graphlan.py --skip_rows 1 -i results_rarefied/merged_cases_rarefied_full.txt --tree merged_cases_rarefied_full.tree.txt --annotation merged_cases_rarefied_full.annot.txt --most_abundant 100 --abundance_threshold 1 --least_biomarkers 10 --annotations 5,6 --external_annotations 7 --min_clade_size 1

File “/home/***/anaconda3/envs/export2graphlan_env/bin/export2graphlan.py”, line 23
def scale_color((h, s, v), factor=1.0):
^
SyntaxError: invalid syntax

Best,
Philipp

Hi Philipp,

I have a feeling that dependancies might be missing from your export2graphlan conda environment. I would recommend creating a GraPhlAn conda environment in which you could install export2graphlan. Here are the commands to do this:

$ conda create -n graphlan
$ source activate graphlan
$ conda install -c biobakery graphlan
$ conda install -c bioconda export2graphlan

To test if export2graphlan is working, try this:

$ wget https://raw.githubusercontent.com/biobakery/biobakery/master/demos/biobakery_demos/data/metaphlan3/output/merged_abundance_table.txt
$ tail -n +2 merged_abundance_table.txt | cut -f1,3- > merged_abundance_table_reformatted.txt
$ export2graphlan.py --skip_rows 1 -i merged_abundance_table_reformatted.txt --tree merged_abundance.tree.txt --annotation merged_abundance.annot.txt --most_abundant 100 --abundance_threshold 1 --least_biomarkers 10 --annotations 5,6 --external_annotations 7 --min_clade_size 1

export2graphlan should produce two outputs: merged_abundance.tree.txt and merged_abundance.annot.txt.

Hope this helps!

Regards,
Aaron.

Hi all.
Sorry if I open this thread again, but I have the same problem.

I’m initially use a conda environment and then move to another computer and use the version 0.22 of export2graphlan available at GitHub - SegataLab/export2graphlan: Conversion software tool for producing both annotation and tree files for GraPhlAn

Pandas, BIOM and SciPy was succesfully installed prior to test export2graphlan.py with the example folders.

Anyone have some solution to this problem?
Thanks