如何在snakemake规则中使用bash for循环
我很抱歉,如果这似乎类似于其他帖子,但我是一个新手,而且 我正在尝试将我的bash如何在snakemake规则中使用bash for循环,bash,snakemake,Bash,Snakemake,我很抱歉,如果这似乎类似于其他帖子,但我是一个新手,而且 我正在尝试将我的bashfor循环,它将一个串联文件(*.fastq.gz)拆分为单独的片段(*.fastq)并转换为蛇形规则。我的蛇怪不断地抛出错误 Building DAG of jobs...MissingRuleException:No rule to produce 2 (if you use input functions make sure that they don't raise unexpected exception
for循环
,它将一个串联文件(*.fastq.gz
)拆分为单独的片段(*.fastq
)并转换为蛇形规则
。我的蛇怪不断地抛出错误
Building DAG of jobs...MissingRuleException:No rule to produce 2 (if you use input functions make sure that they don't raise unexpected exceptions).
请参阅我的snakemake(解复用\u fastq.smk
)脚本
我希望得到多个文件作为输出(但我事先不知道每个输入文件中有多少个碎片)
谢谢你的帮助
$ cat demultiplex_fastq.smk
configfile: "config/input_paths_fastq.yaml"
rule all:
input:
expand("results/{samples}/{samples}.fastq", samples=config["samples"])
rule demultiplex_fastq:
input:
fastq1=lambda wildcards: config["samples"][wildcards.samples]
output:
fastq_gz="results/{samples}/{samples}.fastq"
log:
"logs/demultiplex_fastq/{samples}_demultiplexed_fastq.txt"
shell:
"""
zcat {input.fastq1} |
awk -v sname="{wildcards.samples}" '
BEGIN {{FS = ":"}}
{{
lane=${{4}};
fileName = sname".lane."lane".fastq"
print > fileName
for (i = 1; i <= 3; i++) {{
getline
print > fileName
}}
}}' 2> {log}
"""
$ cat input_paths_fastq.yaml
samples:
SC173863_ACCTCCAA_L008_R2_001_HQ_paired: /Tumor/test_pipelines/SC173863_ACCTCCAA_L008_R2_001_HQ_paired.fastq.gz
SC173866_CTGGCATA_L004_R1_001_HQ_paired: /Tumor/test_pipelines/SC173866_CTGGCATA_L004_R1_001_HQ_paired.fastq.gz
SC173863_ACCTCCAA_L008_R2_001_HQ_paired.lane1.fastq
SC173863_ACCTCCAA_L008_R2_001_HQ_paired.lane2.fastq
SC173863_ACCTCCAA_L008_R2_001_HQ_paired.lane3.fastq
SC173866_CTGGCATA_L004_R1_001_HQ_paired.lane1.fastq
SC173866_CTGGCATA_L004_R1_001_HQ_paired.lane2.fastq
SC173866_CTGGCATA_L004_R1_001_HQ_paired.lane3.fastq