gpt4 book ai didi

python - Q : Target rules may not contain wildcards Error in Snakemake - No wildcards in Target?

转载 作者:太空宇宙 更新时间:2023-11-04 04:49:37 29 4
gpt4 key购买 nike

我正在尝试创建一个 snakemake 管道,其输出由特定文件夹中存在的一组排序文件决定。我的文件路径结构如下:

project_dir
> Snakefile
> code
> python_scripts
> ab1_to_fastq.py
> data
> 1.ab1_files
> A.ab1
> B.ab1
> C.ab1
> 2.fastq_files

这是我实际的 Snakefile 的代码

import glob
import os

def collect_reads():
ab1_files = glob.glob("data/1.ab1_files/*.ab1")
ab1_files.sort()
ab1_reads = [ab1_file.split('/')[-1].replace('.ab1', '') for ab1_file in ab1_files]
return ab1_reads

READS = collect_reads()
print(expand("data/2.fastq_files/{read}.fastq", read=READS))

rule convert_ab1_to_fastq:
input:
ab1="data/1.ab1_files/{read}.ab1"
output:
fastq="data/2.fastq_files/{read}.fastq"
shell:
"python code/python_scripts/ab1_to_fastq.py --ab1 {input.ab1} --fastq {output.fastq}"

rule all:
input:
fastq=expand("data/2.fastq_files/{read}.fastq", read=READS)

我的理解是 all 应该是我的目标规则,并且该规则中 fastq 的输入变量计算为

['data/2.fastq_files/A.fastq', 'data/2.fastq_files/B.fastq', 'data/2.fastq_files/C.fastq']

当我运行我的脚本时,管道中的打印输出似乎证实了这一点。但是,我收到错误 WorkflowError: Target rules may not contain wildcards。请指定具体文件或不带通配符的规则。 每当我运行此脚本时。

奇怪的是,我可以从 expand 生成的列表中复制其中一个路径来直接调用 snakemake,例如snakemake data/2.fastq_files/A.fastq 管道成功完成。

我错过了什么?

最佳答案

可能是 snakemake 认为你的目标规则是 convert_ab1_to_fastq 而不是 all。默认情况下,snakemake 将第一个规则作为目标规则。首先声明all,看看这是否能解决您的问题。

关于python - Q : Target rules may not contain wildcards Error in Snakemake - No wildcards in Target?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48671421/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com