Snakemake error AttributeError: 'Resources' object has no attribute 'tmpdir'
0
0
Entering edit mode
10 months ago

I have built a Snakemake pipeline which has been designed for paired-end reads. I have made a trial with single-end reads, and got this error. I am not sure it is related to the change of reads design, and to be honest I do not understand the error message! Is it looking familiar to anyone?

rule bwa_mem:           
    input: reads/Beg9_1.fastq.gz, genome.amb, genome.ann, genome.bwt, genome.pac, genome.sa
    output: mapped/Beg9_1.bam 
    log: logs/bwa_mem/Beg9_1.log     
    jobid: 267                  
    wildcards: sample=Beg9_1        
    threads: 2                

Activating conda environment: /mnt/shared/scratch/usr/pipeline/experiment_1/.snakemake/conda/f436a072                                                                  
Traceback (most recent call last):           
  File "/mnt/shared/scratch/usr/pipeline/experiment_1/.snakemake/scripts/tmpqwgv8exe.wrapper.py", line 25, in <module>                                                 
    java_opts = get_java_opts(snakemake)
                ^^^^^^^^^^^^^^^^^^^^^^^^                                                   
  File "/mnt/shared/home/usr/miniforge3/envs/snakemake/lib/python3.6/site-packages/snakemake_wrapper_utils/java.py", line 38, in get_java_opts                                     
    java_opts += f" -Djava.io.tmpdir={snakemake.resources.tmpdir}"                         
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^                           
AttributeError: 'Resources' object has no attribute 'tmpdir'                               
[Tue Dec 19 10:59:39 2023]
Error in rule bwa_mem:                       
    jobid: 267                                                                                                                                                                         
    output: mapped/Beg9_1.bam                                                              
    log: logs/bwa_mem/Beg9_1.log (check log file(s) for error message)                     
    conda-env: /mnt/shared/scratch/usr/pipeline/experiment_1/.snakemake/conda/f436a072                                                                                 

RuleException:   
CalledProcessError in line 92 of /mnt/shared/scratch/usr/pipeline/experiment_1/workflow/Snakefile:                                                                     
Command 'source /mnt/shared/training/conda/bin/activate '/mnt/shared/scratch/usr/pipeline/experiment_1/.snakemake/conda/f436a072'; set -euo pipefail;  python /mnt/shared/scratch/usr/pipeline/experiment_1/.snakemake/scripts/tmpqwgv8exe.wrapper.py' returned non-zero exit status 1.                                                       
  File "/mnt/shared/scratch/usr/pipeline/experiment_1/workflow/Snakefile", line 92, in __rule_bwa_mem                                                                  
  File "/mnt/shared/home/usr/miniforge3/envs/snakemake/lib/python3.6/concurrent/futures/thread.py", line 56, in run                                                                
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message 
Python BWA Snakemake • 923 views
ADD COMMENT
0
Entering edit mode

Can you post the code for the rule?

ADD REPLY
0
Entering edit mode

Here it is:

# https://snakemake-wrappers.readthedocs.io/en/stable/wrappers/bwa/mem.html
rule bwa_mem:
        input:
                reads=["reads/{sample}.fastq.gz"],
                idx=multiext("genome", ".amb", ".ann", ".bwt", ".pac", ".sa"),
        output:
                "mapped/{sample}.bam",
        log:
                "logs/bwa_mem/{sample}.log",
        params:
                extra=r"-R '@RG\tID:{sample}\tSM:{sample}'",
                sorting="none",  # Can be 'none', 'samtools' or 'picard'.
                sort_order="queryname",  # Can be 'queryname' or 'coordinate'.
                sort_extra="",  # Extra args for samtools/picard.
        threads: 8
        wrapper:
                "v2.9.1/bio/bwa/mem"
ADD REPLY
0
Entering edit mode

I do not think it is an error related to the single-end read dataset. Having a look at the wrapper, single-end read data are mentioned in the wrapper code and accepted by BWA. https://snakemake-wrappers.readthedocs.io/en/stable/wrappers/bwa/mem.html

Once again, I am clueless about this error.

ADD REPLY
0
Entering edit mode

Since it's complaining about tmpdir and resources my only guess would be to try explicitly defining it in the resources directive.

resources:
    tmpdir='/path/to/tmp/dir'
ADD REPLY

Login before adding your answer.

Traffic: 1697 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6