Skip to content

Commit

Permalink
incorporated recent changes from master
Browse files Browse the repository at this point in the history
  • Loading branch information
vineetbansal committed May 7, 2021
1 parent 1a6f256 commit 74313b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hatchet/utils/cluster_bins.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ def readBB(bbfile):
read[chromosome, start, end].append((sample, rd, snps, cov, alpha, beta, baf))
except KeyError:
read[chromosome, start, end] = [(sample, rd, snps, cov, alpha, beta, baf)]
return read, samples
nonzeroab = (lambda rb : all(rec[4] + rec[5] > 0 for rec in rb))
newread = {b : read[b] for b in read if nonzeroab(read[b])}
diff = len(read.keys()) - len(newread.keys())
if diff > 0:
sp.log(msg='{} bins have been discarded because no covered by any SNP\n'.format(diff), level="WARN")
return newread, samples


def getPoints(data, samples):
Expand Down
2 changes: 2 additions & 0 deletions src/hatchet/utils/combine_counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def main(args=None):

names = list(samples).sort()
sys.stdout.write("#CHR\tSTART\tEND\tSAMPLE\tRD\t#SNPS\tCOV\tALPHA\tBETA\tBAF\n")
nonzerobaf = (lambda rk : all(sample[4] + sample[5] > 0 for sample in rk))
result = {key : result[key] for key in result if nonzerobaf(result[key])}
for key in sorted(result, key=(lambda x : (sp.numericOrder(x[0]), int(x[1]), int(x[2])))):
for sample in result[key]:
sys.stdout.write("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format(key[0], key[1], key[2], sample[0], sample[1], sample[2], sample[3], sample[4], sample[5], sample[6]))
Expand Down

0 comments on commit 74313b5

Please sign in to comment.