bioinformatics - 用蛇形运行 nanofilt
问题描述
我是使用蛇形的新手。我想使用 nanofilt 运行位于一个文件夹中的我的 fastq 文件。我想用snakemake 运行它,因为我需要它来创建管道。这是我的蛇制作脚本:
rule NanoFilt:
input:
"data/samples/{sample}.fastq"
output:
"nanofilt_out.gz"
shell:
"gunzip -c {input} | NanoFilt -q 8 | gzip > {output}"
当我运行它时,我收到以下错误消息:
WildcardError in line 2:
Wildcards in input files cannot be determined from output files:
'sample'
编辑
我尝试搜索错误消息,但仍然无法弄清楚如何使其工作。谁能帮我?
所以我尝试了这里的人告诉我的,所以新脚本是这样的:
samples = ['fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8293','fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8292','fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8291','fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290']
rule all:
input:
[f"nanofilt_out_{sample}.gz" for sample in samples]
rule NanoFilt:
input:
"zipped/zipped{sample}.gz"
output:
"nanofilt_out_{sample}.gz"
shell:
"gunzip -c {input} | NanoFilt -q 8 | gzip > {output}"
但是当我运行它时,我收到以下错误消息:
Error in rule NanoFilt:
Removing output files of failed job NanoFilt since they might be corrupted:
nanofilt_out_fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8292.gz
jobid: 4
output: nanofilt_out_fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290.gz
shell:
gunzip -c zipped/zippedfastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290.gz | NanoFilt -q 8 | gzip > nanofilt_out_fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290.gz
(one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
有谁知道如何解决这一问题?
解决方案
SnakeMake 的“想法”是您指定您想要的输出(例如通过 rule all),并且 SnakeMake 会查看所有定义的规则并知道如何获得所需的输出。
当你告诉 SnakeMake 你想要作为输出nanofilt_out.gz
时,它怎么知道要采集什么样本?它不会......如果它只采用任何可能的示例文件,那么我们将丢失有关它属于哪个文件的信息。为了解决这个问题,我们在输出中还需要与输入中相同的通配符:
rule NanoFilt:
input:
"data/samples/{sample}.fastq"
output:
"nanofilt_out_{sample}.gz"
shell:
"gunzip -c {input} | NanoFilt -q 8 | gzip > {output}"
这样 SnakeMake 可以为每个样本生成输出。您确实需要以某种方式调整您指定所需输出的管道,可能是这样的:
samples = [1,2,3]
rule all:
input:
[f"nanofilt_out_{sample}.gz" for sample in samples]
推荐阅读
- python - 调用 Select() 是否只阻塞线程或整个程序?
- php - 创建一个搜索表单,我哪里出错了?
- node.js - Node.js- SyntaxError:添加反应视图后意外的令牌导入
- python - 模块 'csv' 没有属性 'writer'
- c# - Autofac - 在运行时解析类型或实现相同接口的类型
- qt - QML mouseArea 失去对释放鼠标按钮的关注
- java - 在模型上实施 id 关系
- ruby - 当密钥未知/随机时从 JSON 密钥读取值
- python - Python Pillow:对一张图像应用多个过滤器和增强功能
- python - 一次在不同数据集上使用 tf.feature_column.input_layer 的自定义模型(不是 tf.estimator)?