如何解决带有配置文件的 STAR 蛇形包装器
我正在尝试将 STAR 包装器用于 snakemake(描述为 here),但想要包含一个使用 --sjdbGTFfile
标志的注释文件选项。我的目标是通过引用一个配置文件来指定一个 gtf 注释文件,但我似乎无法让它工作。
我的配置文件的相关片段:
annotations: ref_files/cal09_human/GRCh38.103_Cal09.gtf
相关规则如下所示:
rule map_reads:
message:
"""
Mapping trimmed reads from {wildcards.sample} to host genome
"""
input:
fq1 = "tmp/{sample}_R1_trimmed.fastq.gz",fq2 = "tmp/{sample}_R2_trimmed.fastq.gz"
params:
index= config["genome_index"],extra="--sjdbGTFfile {config[annotations]} \
--sjdbOverhang 149 \
--outFilterType BySJout \
--outFilterMultimapNmax 10 \
--alignSJoverhangMin 5 \
--alignSJDBoverhangMin 1 \
--outFilterMismatchNmax 999 \
--outFilterMismatchNoverReadLmax 0.04 \
--alignIntronMin 20 \
--alignIntronMax 1000000 \
--alignMatesGapMax 1000000 \
--outFilterIntronMotifs RemoveNoncanonicalUnannotated \
--outSAMtype BAM SortedByCoordinate \
--runMode alignReads"
output:
"star_mapping/{sample}_Aligned.sortedByCoord.out.bam"
log:
"logs/star/{sample}.log"
threads: 20
wrapper:
"0.74.0/bio/star/align"
我将配置文件指定为在 shell 命令中(如描述的 here),但它不起作用:
Jun 03 16:49:52 ..... started STAR run
Jun 03 16:49:52 ..... loading genome
Jun 03 16:50:32 ..... processing annotations GTF
FATAL error,could not open file pGe.sjdbGTFfile={config[annotations]}
Jun 03 16:50:32 ...... FATAL ERROR,exiting
我直接在终端中运行以下命令,它运行得很好:
STAR --runThreadN 24 \
--genomeDir ref_files/cal09_human_star_index \
--sjdbGTFfile ref_files/cal09_human/GRCh38.103_Cal09.gtf \
--sjdbOverhang 149 \
--outFilterType BySJout \
--outFilterMultimapNmax 10 \
--alignSJoverhangMin 5 \
--alignSJDBoverhangMin 1 \
--outFilterMismatchNmax 999 \
--outFilterMismatchNoverReadLmax 0.04 \
--alignIntronMin 20 \
--alignIntronMax 1000000 \
--alignMatesGapMax 1000000 \
--outFilterIntronMotifs RemoveNoncanonicalUnannotated \
--outSAMtype BAM SortedByCoordinate \
--runMode alignReads
我仔细检查了我没有犯一个明显的错误,比如在配置文件中错误指定了文件路径。有没有人知道实现我想要做的事情的方法?
解决方法
extra="--sjdbGTFfile {config[annotations]} \
--sjdbOverhang 149 ..."
似乎 {config[annotations]}
没有被字典值替换,而是按原样传递。
如果您使用的是 python 3.6+,请尝试使用(注意 f
)
extra=f"--sjdbGTFfile {config[annotations]} \
--sjdbOverhang 149 ..."
或者,旧样式:
extra= "--sjdbGTFfile %s \
--sjdbOverhang 149 ..." % config[annotations]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。