Snakemake:通配符限制

问题描述 投票:0回答:1

我有以下

Snakemake
规则(我只显示了相关部分):

SAMPLE_IP = ['control_1_hif1a_hyp', 'control_2_hif1a_hyp']
SAMPLE_INPUT = ['control_1_input_hyp', 'control_2_input_hyp']

rule all:
    input:
        expand("bigwig/compare/{sample_ip}_vs_{sample_input}.bw", sample_ip=SAMPLE_IP, sample_input=SAMPLE_INPUT),]
    

rule bigwig_sample_vs_input:
    input:
        ip="mapped/{sample_ip}_dedup.bam",
        inpt="mapped/{sample_input}_dedup.bam",
    output:
        "bigwig/compare/{sample_ip}_vs_{sample_input}.bw",
    params:
        bs=config["general"]["bigwig"]["binSize"],
    threads: config["resources"]["deeptools"]["cpu"]
    resources: 
        runtime=config["resources"]["deeptools"]["time"]
    conda:
        "envs/chipseq.yaml"
    shell:
        "bamCompare -p {threads} -bs {params.bs} -b1 {input.ip} -b2 {input.inpt} "

该规则有效,但

Snakemake
创建了四个具有以下值的
.bw
文件:

sample_input: control_1_input_hyp
sample_ip: control_1_hif1a_hyp

sample_input: control_2_input_hyp
sample_ip: control_1_hif1a_hyp

sample_input: control_1_input_hyp
sample_ip: control_2_hif1a_hyp

sample_input: control_2_input_hyp
sample_ip: control_2_hif1a_hyp

但我只想用:

sample_input: control_1_input_hyp
sample_ip: control_1_hif1a_hyp

sample_input: control_2_input_hyp
sample_ip: control_2_hif1a_hyp

如何告诉

Snakemake
仅组合
SAMPLE_IP
SAMPLE_INPUT
中在这些列表中具有相同位置的元素?

python python-3.x wildcard snakemake expansion
1个回答
2
投票

使用

zip
中的
expand
选项,规则
input
中的
all
指令将如下所示:

expand("bigwig/compare/{sample_ip}_vs_{sample_input}.bw", zip, sample_ip=SAMPLE_IP, sample_input=SAMPLE_INPUT),]
© www.soinside.com 2019 - 2024. All rights reserved.