There is some problem with my samtools_dup rule.
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)".
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 you to take a look.
dup_fun = "rmdup"
# 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}"
Edited: when I delete this rule from the pipeline, the error goes away with it. What comes next in the code is my bigwig rule:
# 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:
xtnd = bwXtnd ,
bs = binSize ,
nrm = normBW ,
effgs = effGS ,
bl = f'-bl {blBed}'
conda:
"envs/deeptools.yaml"
threads: maxThreads
shell:
"bamCoverage -b {input.bam} -bs {params.bs} --normalizeUsing {params.nrm} --effectiveGenomeSize {params.effgs} -o {output} {params.xtnd} {params.bl}"
What comes after the
shell:
line? Most likely you have an indentation problem later, since what you posted looks fine.There is an empty line (two enters, from the end of the shell line) and then what you see in the second code panel (the bigwig rule - I added it now to this question). When I delete the samtools_dup rule, the code works. I'll try to put it again and double-check indentations, but the next rule's first two lines don't have any (the comment and the if clause). (ps: this is for chip-seq data)
My only guess is that there's a single space missing somewhere, since otherwise everything looks fine to me.