Hi,
I'm quite new to snakemake and was trying to write a little workflow to analyze some nanopore data. However, it keeps returning an invalid syntax error caused by this rule
rule alignment:
input:
"{base_out}/2.TRIMMING/{sample}.trimmed_and_clean.fastq.gz"
output:
"{base_out}/3.ALIGNMENT/{sample}.ngmlr.bam",
"{base_out}/3.ALIGNMENT/{sample}.ngmlr.bai"
resources:
partition: "EPYC"
runtime: 5760
mem_mb: 200000
cpus_per_task: 20
conda:
"{env_file}"
params:
ngmlr_args="-t 20 -r /fast/burlo/fcrudele/resources/hgRef/GRCh38.p13/no_alt/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna -x ont"
message: """ ngmlr Alignment """
shell:
"""
ngmlr {params.ngmlr_args} -q {input} | samtools view -b /dev/stdin | samtools sort -@ 20 -o {output[0]} &&
samtools index -@ 20 -b -o {output[1]}
"""
The syntax error is caused by the first line after the "output:" directive, but I'm unable to see it. What would be the problem here ?
Thanks in advance!
EDIT: Maybe the lack of commas in the
resources
part is the problem.What is the exact error being shown?
Can you also pass the above rule text though
cat -A
to show all invisible characters please?Thank you for the suggestions! I've added the commas in the resources section, but it returns the same error as before:
Using cat -A as suggested shows this:
Line 91 is the first line after the output directive in my snakefile
Don't you need commas after each resource in
resources
?Thanks for the advice!
I've tried to add the commas in the resources section but it returns the same error as before:
with line 91 being the first line after the output directive
Maybe
"{env_file}"
should be something likef"{env_file}"
but I doubt that would be a syntax error anyway. In some old versions of snakemake there was a bug in reporting the line number of errors. If possible, post the snakefile at least up to rule alignment.