I have a very strange syntax error that I have been staring at for hours with no solution. I cannot figure out why/where the syntax error is coming from. This is my rule:
rule star_alignment:
conda:
"envs/star.yaml"
input:
R1 = "samples/{sampid}/original_R1.fastq",
R2 = "samples/{sampid}/original_R2.fastq",
genome = config['indexes']['star']
output:
aligned_bam = "results/{sampid}_GDC38.Aligned.out.bam",
sorted_bam = "results/{sampid}_GDC38.Aligned.sortedByCoord.out.bam"
params:
out_prefix="results/{sampid}_GDC38."
threads: workflow.cores
shell:
'''
STAR\
--runThreadN {threads}\
--genomeDir {input.genome}\
--readFilesIn {input.R1} {input.R2}
--outSAMattributes NH HI NM MD AS XS\
--outSAMtype BAM Unsorted SortedByCoordinate\
--outFileNamePrefix {params.out_prefix}
'''
This is the error:
SyntaxError in line 21 of /pbtech_mounts/homes064/bhs4002/DLBCL_HERV_atlas_GDC/workflow/rules/star_alignment.smk:
invalid syntax (star_alignment.smk, line 21)
File "/pbtech_mounts/homes064/bhs4002/DLBCL_HERV_atlas_GDC/workflow/Snakefile", line 63, in <module>
Line 21 corresponds to the line that says STAR\
. I'm not sure what line 63 is, because the .smk file for this rule is only 29 lines?
Turns out that the problem was with indentation! Some lines had spaces and others had tabs. I replaced all the tabs with spaces and this fixed the problem.