【问题标题】:Snakemake not interpreting wildcard correctly?Snakemake 没有正确解释通配符?
【发布时间】:2022-12-03 00:34:12
【问题描述】:

我正在尝试运行一个 snakemake 文件,但它产生了一个奇怪的结果

refseq = 'refseq.fasta'
reads = '_R1_001'
reads2 = '_R2_001'
configfile: "config.yaml"
## Add config

def getsamples():
    import glob
    test = (glob.glob("*.fastq.gz"))
    samples = []
    for i in test:
        samples.append(i.rsplit('_', 2)[0])
    print(samples)
    return(samples)

def getbarcodes():
    with open('unique.barcodes.txt') as file:
        lines = [line.rstrip() for line in file]
    return(lines)

rule all:
    input:
        expand("called/{barcodes}{sample}_called.vcf", barcodes=getbarcodes(), sample=getsamples()),
        expand("mosdepth/{barcodes}{sample}.mosdepth.summary.txt", barcodes=getbarcodes(), sample=getsamples())


rule fastq_grep:
    input:
        R1 = "{sample}_R1_001.fastq.gz",
        R2 = "{sample}_R2_001.fastq.gz"
    output:
        "grepped/{barcodes}{sample}_R1_001.plate.fastq",
        "grepped/{barcodes}{sample}_R2_001.plate.fastq"
    shell:
        "fastq-grep -i '{wildcards.barcodes}' {input.R1} > {output} && fastq-grep -i '{wildcards.barcodes}' {input.R2} > {output}"



我的目录中有文件末尾带有 *.fastq.gz 的文件,但我得到了这个:

缺少规则 fastq_grep 的输入文件: 0_R1_001.fastq.gz 0_R2_001.fastq.gz

这两个文件不存在,它从哪里得到它们?

我希望在我的目录中看到很多 fastq 文件,但它只列出了一个不存在的文件。

【问题讨论】:

    标签: python bash bioinformatics snakemake


    【解决方案1】:

    由于 {barcodes}{sample} 模式,这是一个常见问题。

    如果没有wildcard_constraint,Snakemake 将不知道{barcodes} 在哪里结束以及{sample} 在哪里开始。现在,snakemake 认为您的sample 通配符只是一个0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-22
      • 1970-01-01
      相关资源
      最近更新 更多