snakemake中{sample}与{wildcard.sample}的区别

2024-05-16 15:38:55 发布

您现在位置:Python中文网/ 问答频道 /正文

有谁能告诉我在蛇形游戏官方教程中{sample}{wildcard.sample}的区别,如下所示? 它们都等于“A”还是“B”? 我想知道什么时候使用{sample}{wildcard.sample}。 谢谢

SAMPLES = ["A", "B"]


rule all:
    input:
        "plots/quals.svg"


rule bwa_map:
    input:
        "data/genome.fa",
        "data/samples/{sample}.fastq"
    output:
        "mapped_reads/{sample}.bam"
    shell:
        "bwa mem {input} | samtools view -Sb - > {output}"


rule samtools_sort:
    input:
        "mapped_reads/{sample}.bam"
    output:
        "sorted_reads/{sample}.bam"
    shell:
        "samtools sort -T sorted_reads/{wildcards.sample} "
        "-O bam {input} > {output}"


rule samtools_index:
    input:
        "sorted_reads/{sample}.bam"
    output:
        "sorted_reads/{sample}.bam.bai"
    shell:
        "samtools index {input}"


rule bcftools_call:
    input:
        fa="data/genome.fa",
        bam=expand("sorted_reads/{sample}.bam", sample=SAMPLES),
        bai=expand("sorted_reads/{sample}.bam.bai", sample=SAMPLES)
    output:
        "calls/all.vcf"
    shell:
        "samtools mpileup -g -f {input.fa} {input.bam} | "
        "bcftools call -mv - > {output}"


rule plot_quals:
    input:
        "calls/all.vcf"
    output:
        "plots/quals.svg"
    script:
        "scripts/plot-quals.py"

Tags: sampleinputoutputdataallshellrulefa
1条回答
网友
1楼 · 发布于 2024-05-16 15:38:55

{sample}用于“输入”或“输出”,而{wildcard.sample}用于“shell”,因为只有{wildcard.sample}检索实际的样例名称并传输到shell,shell中的命令才会运行。我想

相关问题 更多 >