Skip to content

Commit

Permalink
#227:fix AD to INFO/AD and sp deadlock bug
Browse files Browse the repository at this point in the history
  • Loading branch information
RunpengLuo committed Nov 22, 2024
1 parent 7115c38 commit 8f7fc1f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hatchet/utils/count_alleles.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def countAlleles(self, bamfile, samplename, chromosome):
self.dp,
self.snplist[chromosome],
)
cmd_query = "{} query -f '%CHROM\\t%POS\\t%REF,%ALT\\t%AD\\n' -i 'SUM(AD)<={} & SUM(AD)>={}'".format(
cmd_query = "{} query -f '%CHROM\\t%POS\\t%REF,%ALT\\t%AD\\n' -i 'SUM(INFO/AD)<={} & SUM(INFO/AD)>={}'".format(
self.bcftools, self.dp, self.mincov
)
if self.E:
Expand All @@ -287,6 +287,8 @@ def countAlleles(self, bamfile, samplename, chromosome):
stderr=err,
universal_newlines=True,
)
# Allow sp mpileup to receive a SIGPIPE if p2 exits. avoid deadlock
mpileup.stdout.close()
stdout, _ = query.communicate()
codes = map(lambda p: p.wait(), [mpileup, query])
if any(c != 0 for c in codes):
Expand Down

0 comments on commit 8f7fc1f

Please sign in to comment.