2017-09-19 7 views
0

ペアサンプル(腫瘍と正常)を使用してgatk再較正を使いたいです。私はパンダを使ってデータを解析する必要があります。それが私が怒ったものです。スネークメイクペアアナライザのエンコード方法

expand("mapped_reads/merged_samples/{sample[1][tumor]}/{sample[1][tumor]}_{sample[1][normal]}.bam", sample=read_table(config["conditions"], ",").iterrows()) 

これは条件ファイルです:私はこのルールを書いた

432,433 
434,435 

rule gatk_RealignerTargetCreator: 
    input: 
      "mapped_reads/merged_samples/{tumor}.sorted.dup.reca.bam", 
      "mapped_reads/merged_samples/{normal}.sorted.dup.reca.bam", 

    output: 
     "mapped_reads/merged_samples/{tumor}/{tumor}_{normal}.realign.intervals" 
    params: 
     genome=config['reference']['genome_fasta'], 
     mills= config['mills'], 
     ph1_indels= config['know_phy'], 
    log: 
     "mapped_reads/merged_samples/logs/{tumor}_{normal}.realign_info.log" 
    threads: 8 
    shell: 
     "gatk -T RealignerTargetCreator -R {params.genome} {params.custom} " 
     "-nt {threads} " 
     "-I {wildcard.tumor} -I {wildcard.normal} -known {params.ph1_indels} " 
     "-o {output} >& {log}" 

私はこのエラーを持っている:

InputFunctionException in line 17 of /home/maurizio/Desktop/TEST_exome/rules/samfiles.rules: 
KeyError: '432/432_433' 
Wildcards: 
sample=432/432_433 

これはsamfiles.rulesです:

rule samtools_merge_bam: 
    """ 
    Merge bam files for multiple units into one for the given sample. 
    If the sample has only one unit, files will be copied. 
    """ 
    input: 
     lambda wildcards: expand("mapped_reads/bam/{unit}_sorted.bam",unit=config["samples"][wildcards.sample]) 
    output: 
     "mapped_reads/merged_samples/{sample}.bam" 
    benchmark: 
     "benchmarks/samtools/merge/{sample}.txt" 
    run: 
     if len(input) > 1: 
      shell("/illumina/software/PROG2/samtools-1.3.1/samtools merge {output} {input}") 
     else: 
      shell("cp {input} {output} && touch -h {output}") 
+0

明らかに、 "432/432_433"は設定ファイルのサンプルに含まれていません。これは、エラーメッセージが私たちに伝えているものです(設定変数はPython dictであり、KeyErrorをスローします)。最初のルールには2つのワイルドカードがあり、samtools_merge_bamルールには1つのみが含まれています。したがって、この1つのワイルドカードは、ファイルパスの '{腫瘍}/{腫瘍} _ {正常な} '部分全体と一致しようとします。 –

+0

@JohannesKösterあなたの助けてくれてありがとう!どのようにこの問題を管理できますか?これを解決する方法は何ですか。あなたは私と事例を作ってくれますか? –

答えて

1

...あなたは、関連するすべてのルールを示していないので、私は推測することができますが、私は、ルール samtools_merge_bamはまた、あなたがパターン {tumor}/{tumor}_{normal}を持っているいくつかの後にBAMファイルに適用されるため、エラーが発生したと言うでしょう

解決策として、このあいまい性を解決する必要があります(snakemakeチュートリアルを参照)。たとえば、スラッシュを含まないようにワイルドカードsamtools_merge_bamを制限することができます。

wildcard_constraints: 
    sample="[^/]+" 

グローバルに、またはsamtools_merge_bamルール内に制約を挿入できます。

関連する問題