2017-11-09 5 views
0

同じsnakefileで2つのルール(gatk_Mutect2gatk_IndelRealigner)を実行する必要があります。snakemake:ルールを別のルールで間違ったモードで接続する

これらのルールを別のスニークファイルに入れると、エラーなしで実行できます。

2つの入力関数(get_files_somaticget_files)を使用します。両方とも辞書のキーとしてケース名を使用します。 (それぞれのケースは正常です)。 これらのルールを同じsnakefileに入れると、snakemakeは入力の法線のidをgatk_IndelRealignerで見つけようとします。

私の質問はどのように2つのルールのあいまいさを管理できますか?私はsnakemakeがこれらの2つのルールを接続しようとしないことを意味します。

def get_files_somatic(wildcards): 
    case = wildcards.case 
    control = aCondition[case][0] 
    return ["{}.sorted.dup.reca.cleaned.bam".format(case),"{}.sorted.dup.reca.cleaned.bam".format(control)] 

rule all: 
    input: expand("{sample}.sorted.dup.reca.cleaned.bam",sample=create_tumor()), 
      expand("Results/vcf/{case}.vcf",case=create_tumor()), 

include_prefix="rules" 

include: 
    include_prefix + "/gatk2.rules" 
include: 
    include_prefix + "/mutec2.rules" 


rule gatk_Mutect2: 
    input: get_files_somatic, 
    output: "Results/vcf/{case}.vcf", 
    params: 
    log: "logs/{case}.mutect2.log" 
    threads: 8 
    shell: 

rule gatk_IndelRealigner: 
    input: 
     get_files, 
    output: 
     "{case}.sorted.dup.reca.cleaned.bam", 
     "{case}.sorted.dup.reca.cleaned.bai", 
    params: 
    log: 
     "mapped_reads/merged_samples/logs/{case}_indel_realign_2.log" 
    threads: 8 
    shell: 

def get_files(wildcards): 
    case = wildcards.case 
    control = aCondition[case][0] 
    wildcards.control = control 
    return ["mapped_reads/merged_samples/{}.sorted.dup.reca.bam".format(case), "mapped_reads/merged_samples/{}.sorted.dup.reca.bam".format(control),"mapped_reads/merged_samples/operation/{}_{}.realign.intervals".format(case,control)] 
+0

詳細をより明確に説明してください。 – bli

+0

@bli私はsnakemakeパイプラインに問題があります。この場合、2つの異なるsnakemakeファイルでパイプラインをダイビングする必要があります.1つはgat_Indellrealignを実行し、もう1つはMutect2を実行するためです。どのようにsnakemakeを止めることができますこの2つの特定のルールを接続するには? –

答えて

1

私は本当にあなたの問題を理解していません。例えば、私はあなたが「それぞれの事例は正常です」という意味を持っていません。

しかし、私はgatk_IndelRealigner"{case}.sorted.dup.reca.cleaned.bam")の出力は(casewildcards.caseある"{}.sorted.dup.reca.cleaned.bam".format(case)、)get_files_somaticの結果の一つとして同じファイル名であることを起こることがわかります。

これはgatk_Mutect2gatk_IndelRealignerに「接続」する理由です。

入力と出力の間で一致するファイル名に基づいてルールを接続するのは、snakemakeの本質です。

これら2つのルールをリンクさせたくない場合は、別のファイル名を設定する必要があります。

+0

ご協力いただきありがとうございます。この2つのファイルをどのように接続しないのか分かりません。私は別の名前を付けようとしますが(名前を変更するためのステップを追加します)、しかし接続しようとします。 –

+0

@ snake3354898ファイル名が一致するとルールを接続しないことは不可能だと思います。それがスネークメイクの仕組みです。 – bli

+0

ありがとうございます。唯一の方法は、異なるステップでファイルを分割することです。 .. –

関連する問題