snakemake 包装器:将通配符指向列表 config.yaml 或 txt

snakemake wrapper: pointing wildcard to a list either config.yaml or txt

我正在尝试使用以下 snakemake 包装器:

rule get_fastq_pe:
    output:
        # the wildcard name must be accession, pointing to an SRA number
        "data/{accession}_1.fastq",
        "data/{accession}_2.fastq"
    params:
        # optional extra arguments
        extra=""
    threads: 6  # defaults to 6
    wrapper:
        "0.73.0/bio/sra-tools/fasterq-dump"

您如何在 txt 文件或 config.yaml 文件中直接加入多个 SRR 加入?

首先,在yaml文件中指定你需要的所有SRRSRR.yml:

SRR:
  - SRR1234
  - SRR5678
  - SRR2468
  - SRR1357

然后在你的Snakefile中,加载关键字configfile::

的yaml文件
configfile: "SRR.yml"

定义一个规则 all 来触发所有必要文件的创建:

rule all:
    input: expand("data/{accession}_{RF}.fastq", accession=config["SRR"], RF=["1","2"])

然后添加您的规则:

rule get_fastq_pe:
    output:
        # the wildcard name must be accession, pointing to an SRA number
        "data/{accession}_1.fastq",
        "data/{accession}_2.fastq"
    params:
        # optional extra arguments
        extra=""
    threads: 6  # defaults to 6
    wrapper:
        "0.73.0/bio/sra-tools/fasterq-dump"