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}" 

Dmitry Kuzminov solved it in StackOverflow. I share the answer here, in case someone has the same doubt! 
It seems there is an extra parenthesis at the end of the "input" line in the samtools_dup rule. I honestly didn't spot it, and also the error message made me think the problem wasn't there but around the "shell" statement. 

https://stackoverflow.com/questions/60914204/snakemake-syntaxerror-no-rule-keywords-allowed-after-run-shell-script-wrapper-c/60924399#60924399