def get_candidates(discs,reads_by_LR):
candidates = []
r = lmax
p_len,p_rate,barcode_overlap = get_distributions(reads_by_LR)
if p_len == None or p_rate == None:
return None,None,None
num_cands = 0
for key,items in iteritems(discs):
orient = key[4]
si,ei,sj,ej = disc_intersection(items)
if si and sj and len(items) >= MIN_DISCS:
i = coordinates(si,ei,orient[0])
j = coordinates(sj,ej,orient[1])
cand = copy.copy(items[0])
cand.i = i
cand.j = j
barcode_overlaps = barcode_overlap[(cand.chrm,int(cand.i/d)*d,cand.nextchrm,int(cand.j/d)*d)]
if not inblacklist(cand) and ((cand.chrm == cand.nextchrm and cand.j-cand.i < d)\
or barcode_overlaps >= k):
already_appended = sum([1 for x in candidates if x.i == cand.i and x.j == cand.j])
if not already_appended:
num_cands += 1
candidates.append(cand)
return candidates,p_len,p_rate
评论列表
文章目录