.genome file not found for SnpEff
1
0
Entering edit mode
4.0 years ago
moldach686 ▴ 90

I'm running into the following error trying to run SnpEff from a container.

java.lang.RuntimeException: Property: 'variant_calling/varscan2/bwa-mem2/sambamba/picard/MTG324.vcf.genome' not found

The container comes with it's own config file so I'm trying to override the location using the -dataDir parameter like so:

rule snpeff_download:
    output:
        directory('resources/snpeff/WBcel235.86')
    log:
        'logs/snpeff/download/WBcel235.86.log'
    params:
        reference='WBcel235.86'
    resources:
        mem=1000,
        time=30
    container:
        'docker://resolwebio/snpeff:2.0.0'
    shell: """
    java -jar /opt/snpeff/snpeff/snpEff.jar download {params.reference} -dataDir /scratch/moldach/COOVAR/resources/snpeff
    """

The first rule runs successfully; however, I get the error from the second rule:

if (config['ANNOT_TOOL']=='snpeff'):
        rule snpeff:
            input:
                    calls=lambda wildcards: getVCFs(wildcards.sample),
                    ref = os.path.join(dirs_dict['REF_DIR'],config['REF_GENOME']),
                    db='resources/snpeff/WBcel235.86'
            output:
                    calls=os.path.join(dirs_dict['ANNOT_DIR'],config['ANNOT_TOOL'],config['CALLING_TOOL'],config['ALIGN_TOOL'],config['SORT_TOOL'],config['MARKDUP_TOOL'],'{sample}.annotated.vcf'),
                    stats=os.path.join(dirs_dict['ANNOT_DIR'],config['ANNOT_TOOL'],config['CALLING_TOOL'],config['ALIGN_TOOL'],config['SORT_TOOL'],config['MARKDUP_TOOL'],'{sample}.html'),
                    csvstats=os.path.join(dirs_dict['ANNOT_DIR'],config['ANNOT_TOOL'],config['CALLING_TOOL'],config['ALIGN_TOOL'],config['SORT_TOOL'],config['MARKDUP_TOOL'],'{sample}.csv')
            log:
                    os.path.join(dirs_dict['LOG_DIR'],config['ANNOT_TOOL'],config['CALLING_TOOL'],config['ALIGN_TOOL'],config['SORT_TOOL'],config['MARKDUP_TOOL'],'{sample}.log')
            params:
                    sample='{sample}',
            resources:
                    mem=3000,
                    time=60
            container:
                    'docker://resolwebio/snpeff:2.0.0'
            shell: """
            java -Xmx4g -jar /opt/snpeff/snpeff/snpEff.jar -dataDir /scratch/moldach/COOVAR/resources/snpeff {input.calls} > {output.calls}
            """
wgs SNP • 1.5k views
ADD COMMENT
1
Entering edit mode
4.0 years ago
moldach686 ▴ 90

There were multiple issues going on:

  1. -dataDir needs to be included in both of the rules in-order to over-ride the settings in the configuration file provided with the Docker container.
  2. By default it's looking _inside_ the containers PATH so I needed to add os.getcwd() to the params: section and append that before the output: directory.

Working Solution

rule snpeff_download:
    output:
        directory('resources/snpeff/WBcel235.86')
    log:
        'logs/snpeff/download/WBcel235.86.log'
    params:
        reference='WBcel235.86',
        dir='resources/snpeff',
        pwd=os.getcwd()
    resources:
        mem=1000,
        time=30
    container:
        'docker://resolwebio/snpeff:2.0.0'
    shell: """
    java -jar /opt/snpeff/snpeff/snpEff.jar download -dataDir {params.pwd}/{params.dir} {params.reference}
    """


if (config['ANNOT_TOOL']=='snpeff'):
        rule snpeff:
            input:
                    calls=lambda wildcards: getVCFs(wildcards.sample),
                    db='resources/snpeff/WBcel235.86'
            output:
                    calls=os.path.join(dirs_dict['ANNOT_DIR'],config['ANNOT_TOOL'],config['CALLING_TOOL'],config['ALIGN_TOOL'],config['SORT_TOOL'],config['MARKDUP_TOOL'],'{sample}.annotated.vcf'),
                    stats=os.path.join(dirs_dict['ANNOT_DIR'],config['ANNOT_TOOL'],config['CALLING_TOOL'],config['ALIGN_TOOL'],config['SORT_TOOL'],config['MARKDUP_TOOL'],'{sample}.html'),
                    csvstats=os.path.join(dirs_dict['ANNOT_DIR'],config['ANNOT_TOOL'],config['CALLING_TOOL'],config['ALIGN_TOOL'],config['SORT_TOOL'],config['MARKDUP_TOOL'],'{sample}.csv')
            log:
                    os.path.join(dirs_dict['LOG_DIR'],config['ANNOT_TOOL'],config['CALLING_TOOL'],config['ALIGN_TOOL'],config['SORT_TOOL'],config['MARKDUP_TOOL'],'{sample}.log')
            params:
                    extra='-Xmx4g',
                    dir='resources/snpeff',
                    pwd=os.getcwd()
            resources:
                    mem=3000,
                    time=60
            container:
                    'docker://resolwebio/snpeff:2.0.0'
            shell: """
            java -jar /opt/snpeff/snpeff/snpEff.jar \
                -dataDir {params.pwd}/{params.dir} \
                -stats {output.stats} \
                -csvStats {output.csvstats} \
                WBcel235.86 \
                {input.calls} > {output.calls}
            """
ADD COMMENT

Login before adding your answer.

Traffic: 2406 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