Skip to content

Commit

Permalink
does this work
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jan 9, 2025
1 parent 44d19ca commit 12a0c7b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions snakePipes/shared/rules/whatshap.snakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rule whatshap_haplotag:
checkpoint whatshap_haplotag:
input:
ref = genome_fasta,
pvcf = pvcf,
Expand All @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit 12a0c7b

Please sign in to comment.