a-h-b / dadasnake

Amplicon sequencing workflow heavily using DADA2 and implemented in snakemake
GNU General Public License v3.0
45 stars 17 forks source link

Failed "optional test run" - Step 7 of Install #34

Closed jonwhit closed 1 year ago

jonwhit commented 1 year ago

Thanks for creating this pipeline. Following installation, I can not get dadasnake's test run to complete. I believe I have successfully installed everything and worked through the install checklist up to step 7 (optional test run). When running the test run workflow, I receive an attribute error (full output pasted below):

./dadasnake -l -n "TESTRUN" -r config/config.test.yaml

AttributeError: 'str' object has no attribute 'name' and the completed workflow does not generate.

I have tried this outside of the conda environment and also inside the snakemake_env, with the same result. I also get the same error when running the dadasnake wrapper or when running snakemake manually. The test run outputs the folder 'test_output' which contains the tmp directory (empty) and the full.config.yaml file.

Here is the command and output: $ ./dadasnake -l -n "TESTRUN" -r config/config.test.yaml

Running workflow in current session - don't use this setting except with small datasets. laptop Final resource settings: maxCores: 1 Building DAG of jobs... Using shell: /usr/bin/bash Provided cores: 1 (use --cores to define parallelism) Rules claiming more threads will be scaled down. Traceback (most recent call last): File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/snakemake/init.py", line 699, in snakemake success = workflow.execute( File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/snakemake/workflow.py", line 1052, in execute logger.run_info("\n".join(dag.stats())) File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/snakemake/dag.py", line 2187, in stats yield tabulate(rows, headers="keys") File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/tabulate/init.py", line 2048, in tabulate list_of_lists, headers = _normalize_tabular_data( File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/tabulate/init.py", line 1471, in _normalize_tabular_data rows = list(map(lambda r: r if _is_separating_line(r) else list(r), rows)) File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/tabulate/init.py", line 1471, in rows = list(map(lambda r: r if _is_separating_line(r) else list(r), rows)) File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/tabulate/init.py", line 107, in _is_separating_line (len(row) >= 1 and row[0] == SEPARATING_LINE) File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/snakemake/rules.py", line 1127, in eq return self.name == other.name and self.output == other.output AttributeError: 'str' object has no attribute 'name'

Final resource settings: maxCores: 1 Building DAG of jobs... Creating report... Missing metadata for file workflow.done. Maybe metadata was deleted or it was created using an older version of Snakemake. This is a non critical warning. Missing metadata for file primers.done. Maybe metadata was deleted or it was created using an older version of Snakemake. This is a non critical warning. Missing metadata for file preprocessing/2/sample_2.fwd.fastq.gz. Maybe metadata was deleted or it was created using an older version of Snakemake. This is a non critical warning. WorkflowError: File reporting/primerNumbers_perLibrary.tsv marked for report but does not exist.

$ tree ../test_output/ ../test_output/ ├── full.config.yaml └── tmp 1 directory, 1 file


Tried running Test Run using Snakemake manually: conda activate conda/snakemake_env/ snakemake -s Snakefile --configfile config/config.test.yaml --use-conda --cores 30

Final resource settings: maxCores: 30 Building DAG of jobs... Creating conda environment ../workflow/envs/fastqc.yml... Downloading and installing remote packages. Environment for ../workflow/envs/fastqc.yml created (location: .snakemake/conda/40d0a99ce3531274640417bbe23d90e9) Creating conda environment ../workflow/envs/picrust2_env.yml... Downloading and installing remote packages. Environment for ../workflow/envs/picrust2_env.yml created (location: .snakemake/conda/4117cf158b05e8fb263fbf1aafa50706) Creating conda environment ../workflow/envs/dadasnake_env.yml... Downloading and installing remote packages. Environment for ../workflow/envs/dadasnake_env.yml created (location: .snakemake/conda/bb7758cbd57f9c6ad9bd1f4b617f928c) Creating conda environment ../workflow/envs/dada2_env.yml... Downloading and installing remote packages. Environment for ../workflow/envs/dada2_env.yml created (location: .snakemake/conda/15d5591b4d9c375abf290c8e8bc6eaaf) Creating conda environment ../workflow/envs/vsearch_env.yml... Downloading and installing remote packages. Environment for ../workflow/envs/vsearch_env.yml created (location: .snakemake/conda/23d658bcbdffe93a87791ca15057d8cf) Creating conda environment ../workflow/envs/add_R_env.yml... Downloading and installing remote packages. Environment for ../workflow/envs/add_R_env.yml created (location: .snakemake/conda/d0efdf5fa5224374229d84a1a76862f2) Using shell: /usr/bin/bash Provided cores: 30 Rules claiming more threads will be scaled down. Traceback (most recent call last): File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/snakemake/init.py", line 699, in snakemake success = workflow.execute( File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/snakemake/workflow.py", line 1052, in execute logger.run_info("\n".join(dag.stats())) File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/snakemake/dag.py", line 2187, in stats yield tabulate(rows, headers="keys") File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/tabulate/init.py", line 2048, in tabulate list_of_lists, headers = _normalize_tabular_data( File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/tabulate/init.py", line 1471, in _normalize_tabular_data rows = list(map(lambda r: r if _is_separating_line(r) else list(r), rows)) File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/tabulate/init.py", line 1471, in rows = list(map(lambda r: r if _is_separating_line(r) else list(r), rows)) File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/tabulate/init.py", line 107, in _is_separating_line (len(row) >= 1 and row[0] == SEPARATING_LINE) File "/home/jwhitney/programs/dadasnake/conda/snakemake_env/lib/python3.10/site-packages/snakemake/rules.py", line 1127, in eq return self.name == other.name and self.output == other.output AttributeError: 'str' object has no attribute 'name'

$ tree ./test_output/ ./test_output/ ├── full.config.yaml └── tmp

1 directory, 1 file


Thanks in advance for any suggestions.

a-h-b commented 1 year ago

Hi - thanks for reaching out. I can't reproduce your error. How did you install snakemake? and, did you change anything in the config/config.test.yaml file? -ahb

jonwhit commented 1 year ago

Hi a-h-b, thanks for your response. I installed snakemake (via mamba) as per the dadasnake instructions (below). And I did not change anything in the config/config.test.yaml file.

conda install -c conda-forge mamba
mkdir -p conda
mamba create --prefix $PWD/conda/snakemake_env
conda activate $PWD/conda/snakemake_env
mamba install -c conda-forge -c bioconda snakemake=6.9.1 mamba
conda deactivate

If I activate snakemake_env the correct version of snakemake is installed: conda activate conda/snakemake_env (~/dadasnake/conda/snakemake_env) % snakemake -v 6.9.1

Then running the testrun will not complete whether I'm in snakemake_env or not. (~/dadasnake/conda/snakemake_env) % ./dadasnake -l -n "TESTRUN" -r config/config.test.yaml

I have started clean (removing dadasnake) and reinstalling fresh from github with the same result. Thanks again for your help, open to any suggestions.

jonwhit commented 1 year ago

After getting the same error (listed in first post) with fresh installs on three different systems (Mac and Linux) I learned that it was agnostic to the system, but due to a dependency mismatch with the new version of tabulate. The issue is described here https://github.com/snakemake/snakemake/issues/1899 Even testing with the test data and default settings it will always generate the same error AttributeError: 'str' object has no attribute 'name' due to incompatibility of tabulate, python, and snakemake.

The Solution is to downgrade to earlier version of tabulate that works with the current version of python. Following STEP 4 in the dadasnake installation instructions you must downgrade to tabulate 0.8.10 in the snakemake_env. Adding this step between STEP 4 and STEP 5 fixed this issue.

conda activate /conda/snakemake_env
mamba install 'tabulate=0.8.10'
conda deactivate

Then proceed with running the TESTRUN (STEP 7) which should now work ./dadasnake -l -n "TESTRUN" -r config/config.test.yaml

Hope this helps others.

a-h-b commented 1 year ago

Thanks :-)