In my workflow I would like to have the option to choose which mapper to use. in my config file I have this statement
mapper: "bowtie2"
In the Snakefile I then have a mapping rule as such:
mapper = config['mapper']
...
rule Mapping:
input:
R1='{IDS}.conc.R1.fastq.gz',
R2='{IDS}.conc.R2.fastq.gz',
output:
bam='{project}/{organism}/{mapper}/{IDS}.sorted.bam',
params:
mapper = {mapper}
run:
if params.mapper == "bowtie2":
shell("bowtie2 --threads {config[threads]} --dovetail --very-sensitive-local --no-unal --no-mixed --no-discodant -X 2000 -x {params.index} -1 {input.R1} -2 {input.R2} 2> {log} | samtools view -Sbhu -q 7 -@8 - | samtools sort -@8 - -o {output.bam}")
elif params.mapper == "bwa":
shell("bwa -t {config[threads]} -M {params.index} {input.R1} {input.R2} | samtools view -Sbhu -q 7 -@8 - | samtools sort -@8 - -o {output.bam}")
elif params.mapper == "segemehl":
shell("segemehl.x -i {params.index} -d {params.ref} -S -t {config[threads]} -q {input.R1} -p {input.R2} | samtools view -Sbhu -q 7 -@8 - | samtools sort -@8 - -o {output.bam}")
But I keep getting an error message telling me I am not allow to use keywords within a run statement.
I don't understand this error. I have seen enough examples (here, or here) where this should work.
I would appreciate any corrections or suggestion.
thanks Assa
under the run: indent the if statement.