error in snakemake
0
0
Entering edit mode
13 days ago
kamanovae • 0

Hi! I have such code in snakemake. But I am getting the following error:

RuleException in line 25 of /storage1/kaman/gatk/Snakefile: NameError: The name 'input2' is unknown in this context. Please make sure that you defined that variable. Also note that braces not used for variable access have to be escaped by repeating them, i.e. {{print $1}}

import glob

SAMPLES = glob_wildcards("input_bam/{sample}.bam")
INTERVALS = glob_wildcards("intervals/{interval}.bed")


rule all:
        input: expand("out/{sample}.AddOrReplaceReadGroups.bam", sample = SAMPLES.sample), expand("out/{sample}.MarkDuplicates.txt", sample = SAMPLES.sample), expand("out/{sample}.MarkDuplicates.bam", sample = SAMPLES.sample), expand("out_BaseRecalibrator/{sample}.BaseRecalibrator.{interval}.txt", interval=INTERVALS.interval, sample = SAMPLES.sample)

rule gatk_AddOrReplaceReadGroups:
        input: "input_bam/{sample}.bam"
        output: "out/{sample}.AddOrReplaceReadGroups.bam"
        shell: "./gatk-4.1.9.0/gatk --java-options ""-Xmx30g""  AddOrReplaceReadGroups -I {input}  -O {output} -ID group1 -SM NORMAL -PL illumina -LB lib1 -PU unit1"

rule gatk_MarkDuplicates:
        input: rules.gatk_AddOrReplaceReadGroups.output
        output: output1="out/{sample}.MarkDuplicates.bam", output2="out/{sample}.MarkDuplicates.txt"
        shell: "./gatk-4.1.9.0/gatk --java-options  ""-Xmx4g""  MarkDuplicates  -I {input}  -O {output.output1} -M {output.output2} --CREATE_INDEX true"

rule bedtools_genomecov:
        input: "input_bam/{sample}.bam"
        output: output1="out/{sample}.bedtools_genomecov.genome.covered.bed"
        shell: "bedtools genomecov -ibam -I {input} -bg > -O {output.output1}"

rule gatk_BaseRecalibrator:
        input: input1="intervals/{interval}.bed", input2="out/{sample}.MarkDuplicates.bam", input3='ref/ref.fa', input4='dbsnp/dbsnp_150.hg38.vcf.gz'
        output: "out_BaseRecalibrator/{sample}.BaseRecalibrator.{interval}.txt"
        shell: "./gatk --java-options ""-Xmx7680m""  BaseRecalibrator -L {input1} -I {input2} -O {output} -R {input3} --known-sites {input4}"

Please tell me what is the reason for the error

gatk snakemake • 71 views
ADD COMMENT
0
Entering edit mode

Is it not input.input2 and input.input1 instead of input2 and input1 in last rule? Same for rest of the inputs.

ADD REPLY

Login before adding your answer.

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