Snakemake 规则中未指定的语法错误

Unspecified syntax error in Snakemake rule

我有一个非常奇怪的语法错误,我盯着它看了好几个小时都没有解决办法。我无法弄清楚 why/where 语法错误的来源。这是我的规则:

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

这是错误:

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>

第 21 行对应 STAR\ 行。我不确定第 63 行是什么,因为此规则的 .smk 文件只有 29 行?

原来是缩进的问题!有些行有空格,有些行有制表符。我用空格替换了所有制表符,这解决了问题。