微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

蛇形

如何解决蛇形

谁能告诉我下面snakemake官方教程中{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"

解决方法

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。