2017-09-19 111 views
0

我創建這個規則:Snakemake:規則產生奇怪的結果

rule picard_addRG2: 
    input: 
     "mapped_reads/merged_samples/{sample}.dedup.bam" 
    output: 
     "mapped_reads/merged_samples/{sample}_rg.dedup.bam" 
    params: 
     sample_idi = config['samples'], 
     library = "library00" 

    shell: 
     """picard AddOrReplaceReadGroups I={input} O={output} RGID={params.sample_id} RGLB={params.library} RGPL=illumina RGPU=unit1 RGSM=20 RGPU=MP""" 

我添加ØSnakemake文件規則:

expand("mapped_reads/merged_samples/{sample}_rg.dedup.bam",sample=config['samples']) 

我發現了另一個規則這個奇怪的結果:

snakemake --configfile exome.yaml -np 
InputFunctionException in line 17 of /illumina/runs/FASTQ/test_play/rules/samfiles.rules: 
KeyError: '445_rg' 
Wildcards: 
sample=445_rg 

我做錯了什麼?

如果我改變這樣的規則完美的作品:

rule picard_addRG2: 
    input: 
     "mapped_reads/merged_samples/{sample}.dedup.bam" 
    output: 
     "mapped_reads/merged_samples/{sample}.dedup_rg.bam" 
    params: 
     sample_id = config['samples'], 
     library = "library00" 

    shell: 
     """picard AddOrReplaceReadGroups I={input} O={output} RGID={params.sample_id} RGLB={params.library} RGPL=illumina RGPU=unit1 RGSM=20 RGPU=MP""" 
+0

由於「samfiles.rules」正在拋出錯誤,您是否也能夠發佈此規則的代碼? – TBoyarski

回答

1

因爲它寫的輸出第二種方式完美的作品,我會建議使用這一個。這是怎麼回事如下:

因爲在規則皮卡德輸入爲:
"mapped_reads/merged_samples/{sample}.dedup.bam"
您必須創建此文件作爲輸出的規則。 並在規則皮卡德輸出爲: "mapped_reads/merged_samples/{sample}_rg.dedup.bam"

所以,當你在問你的擴展:
"mapped_reads/merged_samples/{sample}_rg.dedup.bam"
snakemake不知道是否有使用您的規則皮卡德與sample作爲通配符或您的其他規則與sample_rg作爲通配符,因爲它們都以相同模式結束並開始。

重新開始:儘量不要使用帶有可擴展通配符的兩個輸出。在這裏你輸出:
"mapped_reads/merged_samples/{sample}.dedup.bam"
"mapped_reads/merged_samples/{sample}_rg.dedup.bam"
開始和結束與完全相同的模式。

當你使用: "mapped_reads/merged_samples/{sample}.dedup_rg.bam"
作爲輸出,通配符不能擴大!