From 12a0c7bc33f76885812157abaae71f6a0fc90045 Mon Sep 17 00:00:00 2001 From: "katarzyna.otylia.sikora@gmail.com" Date: Thu, 9 Jan 2025 10:56:16 +0100 Subject: [PATCH] does this work --- snakePipes/shared/rules/whatshap.snakefile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/snakePipes/shared/rules/whatshap.snakefile b/snakePipes/shared/rules/whatshap.snakefile index 363582db6..1146d876f 100644 --- a/snakePipes/shared/rules/whatshap.snakefile +++ b/snakePipes/shared/rules/whatshap.snakefile @@ -1,4 +1,4 @@ -rule whatshap_haplotag: +checkpoint whatshap_haplotag: input: ref = genome_fasta, pvcf = pvcf, @@ -15,7 +15,7 @@ rule whatshap_haplotag: whatshap haplotag --ignore-read-groups -o {output.hbam} --reference {input.ref} --output-threads={threads} --output-haplotag-list={output.hlist} {input.pvcf} {input.bam} """ -rule whatshap_split: +checkpoint whatshap_split: input: hbam = "allelic_bams/{sample}.allele_flagged.sorted.bam", hlist = "allelic_bams/{sample}_haplotype_list.tsv" @@ -30,13 +30,21 @@ rule whatshap_split: whatshap split --output-h1 {output.h1bam} --output-h2 {output.h2bam} --output-untagged {output.unbam} {input.hbam} {input.hlist} """ -wildcard_constraints: - suffix = ['allele_flagged', 'genome1', 'genome2', 'unassigned'] +#wildcard_constraints: +# suffix = ['allele_flagged', 'genome1', 'genome2', 'unassigned'] +def collect_split_bams(wildcards): + checkpoint_output_a = checkpoints.whatshap_haplotag.get(**wildcards).output["hbam"] + checkpoint_output_b = checkpoints.whatshap_split.get(**wildcards).output + checkpoint_output = checkpoint_output_a + checkpoint_output_b + return ("allelic_bams/{sample}.{suffix}.sorted.bam", + suffix=glob_wildcards("allelic_bams/{sample}.{suffix}.sorted.bam")).suffix) + rule BAMindex_allelic: input: - "allelic_bams/{sample}.{suffix}.sorted.bam" +# "allelic_bams/{sample}.{suffix}.sorted.bam" + collect_split_bams output: "allelic_bams/{sample}.{suffix}.sorted.bam.bai" conda: CONDA_SHARED_ENV