WatsonLab / MAGpy

Snakemake pipeline for downstream analysis of metagenome-assembled genomes (MAGs) (pronounced mag-pie)
62 stars 23 forks source link

SyntaxError in line 66 #14

Closed charlie-durant closed 4 years ago

charlie-durant commented 4 years ago

Hello,

I've been trying to install MAGpy using the 10 minute install instructions. I installed in /data/metagenomics/MAGPy-attempt3/ and then created a new directory where I cloned the repo to test it, /data/metagenomics/MAGpy_test/. I changed the json.config file accordingly, to point to the MAGPy-attempt3 directory where all the installed files are located. When I tested using snakemake --use-conda -s MAGpy test I got the following error:

SyntaxError in line 66 of /data/metagenomics/MAGpy_test/MAGpy/MAGpy: Command must be given as string after the shell keyword. (MAGpy, line 66).

I tried the following:

  1. Editing the shell script to be a 1 liner: echo -e "name\tnprots\tnhits\tnfull\tgenus\tngenus\tspecies\tnspecies\tavgpid" >> {output} && find diamond_report/ -name "bin*.tsv" | xargs -I {{}} cat {{}} >> {output}

However then I got a syntax error:

"SyntaxError in line 65 of /data/metagenomics/MAGPy-attempt3/MAGpy/MAGpy: 
invalid syntax"
  1. Tried opening in Sublime Text and changing tabs to spaces & made sure the formatting lined up. This resulted in the following error:
"KeyError in line 19 of /data/metagenomics/MAGpy_test/MAGpy/MAGpy: 
'checkm_dataroot'
 File "/data/metagenomics/MAGpy_test/MAGpy/MAGpy", line 19, in <module>"

I verified that I had modified the config.json file to point to checkm_data. My config.json looks like:

{
    "phylophlan_dir": "/data/metagenomics/MAGPy-attempt3/nsegata-phylophlan-1d174e34b2ae",
    "uniprot_sprot": "/data/metagenomics/MAGPy-attempt3/uniprot_trembl",
    "sourmash_gbk": "/data/metagenomics/MAGPy-attempt3/genbank-d2-k31.sbt.json",
    "pfam_dir": "/data/metagenomics/MAGPy-attempt3/",
    "checkm_dataroot": "/data/metagenomics/MAGPy-attempt3/checkm_data"
}

I am using a linux HPC cluster, Python 3.6.7.

Do you have any suggestions about what could be going wrong?

Many thanks

mw55309 commented 4 years ago

Sorry can you clone the repo and try again? Line 66 for some reason had " instead of ' which I think is causing the problem. Not sure how that snuck in!

charlie-durant commented 4 years ago

Hey, thanks for looking into this. I cloned the repo again and tried running the tests but got the same error:

SyntaxError in line 66 of /data/metagenomics/MAGPy-attempt3/MAGpy/MAGpy:
Command must be given as string after the shell keyword. (MAGpy, line 66)

Confirmed that " had been replaced with ' in line 66:

Screenshot 2019-07-31 at 10 21 43

Opened in Sublime Text again and changed spaces to tabs and made sure the formatting lined up in that section.

I then re-ran the test and got:

Building DAG of jobs...
Creating conda environment envs/prodigal.yaml...
Downloading remote packages.
Environment for envs/prodigal.yaml created (location: .snakemake/conda/5311c41d)
Creating conda environment envs/diamond.yaml...
Downloading remote packages.

Then I started to get conda environment errors.

But it looks like the update & formatting changes solved this SyntaxError issue.

Thanks!