gravatar for msimmer92

2 hours ago by

Uruguay

There is some problem in the transition between my samtools_dup rule and the next rule, bigwig.

It says "SyntaxError in line 201 of /data/mypipeline.smk: No rule keywords allowed after run/shell/script/wrapper/cwl in rule samtools_dup. (mypipeline.smk, line 201)".

Even though it says "samtools_dup" rule, line 201 is the first line of the next rule (the if clause before the bigwig rule). (To clarify: the code has other rules that start with an if clause such as this, before that one. So I don't know why this one in particular has this problem).

If I google the error, I found that a person says that, in their code, might be that he placed the "log:" after the "shell:" (and that the shell should be the last thing in each rule), but in my code that is not the case. In many other forums I saw people posting it but no answer was recorded. I am not sure where else this mistake can be... any thoughts? Thank you !

Here I post the code for both rules (the one of samtools_dup and bigwig) for you to take a look.

# Mark or remove duplicates with Samtools
if ( mrDup == "mark" or mrDup == "rm" ):
    rule samtools_dup:
        input: f'{bamDir}' + '/{sample}_sort.bam')
        params: fun = "rmdup"
        output: protected(f'{dupDir}' + "/" + f'{mrDup}dup.bam')
        shell: "samtools {params.fun} -s {input} {output}"

# Bigwig with Deeptools bamCoverage
if ( bigWig == "yes" ):
    rule bigwig:
        input:
            bam = f'{bamDir}' + '/{sample}.bam',
            bai = f'{bamDir}' + '/{sample}.bai'
        output: f'{bwDir}' + '/{sample}.bw'
        params:
            bs = binSize
            nrm = normBW
            effgs = effGS
            bl = f'-bl {blBed}'
        threads: maxThreads
        shell: "bamCoverage -b {input.bam} -bs {params.bs} --normalizeUsing {params.nrm} --effectiveGenomeSize {params.effgs} -o {output} {params.bl}"

This is an example of one of the rules that comes before, in my pipeline, and did not give any error. In case someone wants to compare:

# Get samtools flagstat
rule samtools_flagstat:
    input: f'{bamDir}' + '/{sample}.bam'
    output: f'{bamDir}' + '/{sample}.bam.flagstat'
    log: f'{logDir}' + '/{sample}_flagstat.log'
    threads: maxThreads
    message: "flagstat_bam {input}: {threads} threads"
    shell: "samtools flagstat {input} > {output} 2> {log}"

link

modified 2 hours ago

written
2 hours ago
by

msimmer92230



Source link