snakemake - 使用扩展功能时如何阻止snakemake将非文件结尾添加到通配符?(.g.vcf 失败,.vcf 有效)
问题描述
在扩展规则中的变量之后添加 .g.vcf 而不是 .vcf 以某种方式将 .g 添加到另一个模块中的通配符
我在所有规则中尝试了以下内容:
{stuff}.g.vcf
{stuff}"+"g.vcf"
{stuff}_var"+".g.vcf"
{stuff}.t.vcf
全部失败,但 {stuff}.gvcf 或 {stuff}.vcf 工作
错误:
snake_modules/mark_duplicates.snakefile 第 21 行中的 InputFunctionException:KeyError:'Mother.g' 通配符:lane=Mother.g
代码:
LANES = config["list2"].split()
rule all:
input:
expand(projectDir+"results/alignments/variants/{stuff}.g.vcf", stuff=LANES)
rule mark_duplicates:
""" this will mark duplicates for bam files from the same sample and library """
input:
get_lanes
output:
projectDir+"results/alignments/markdups/{lane}.markdup.bam"
log:
projectDir+"logs/"+stamp+"_{lane}_markdup.log"
shell:
" input=$(echo '{input}' |sed -e s'/ / I=/g') && java -jar /home/apps/pipelines/picard-tools/CURRENT MarkDuplicates I=$input O={projectDir}results/alignments/markdups/{wildcards.lane}.markdup.bam M={projectDir}results/alignments/markdups/{wildcards.lane}.markdup_metrics.txt &> {log}"
我希望我的最终输出具有 {stuff}.g.vcf 符号。请注意,此输出是在另一个蛇模块中创建的,但错误出现在另一个模块之前的标记重复中。
我尝试了多项更改,但导致问题的是 all 规则中的 .g.vcf 。
解决方案
我的猜测是,它{lane}
被解释为正则表达式,并且它捕获的内容超出了应有的范围。尝试添加之前rule all
:
wildcard_constraints:
stuff= '|'.join([re.escape(x) for x in LANES]),
lane= '|'.join([re.escape(x) for x in LANES])
(另请参阅此线程https://groups.google.com/forum/#!topic/snakemake/wVlJW9X-9EU)
推荐阅读
- php - 使用 VS 代码和 PHP IntelliSense 工作的远程容器中的 Laradock
- python - 使用 PyTorch 手动分配权重
- python - 如何一直按下一个按钮,直到在 Tkinter 中按下另一个按钮?
- javascript - 我怎样才能使我所有的图片都具有相同的大小
- c - 从标准输入读取 txt 文件并将整个文本存储到 char 数组中
- react-native - 首先或在应用程序中创建 SQLite DB?
- compilation - 关于 Naka 模块加密有效负载和 Naka 生成秘密 Blob 的任何帮助
- scala - 在 Spark Scala 中按键排序
- python - 无法在 setup.py 中添加 ext_module 作为包的子模块
- python - 为什么对随机值的非线性响应总是积极的?