def unionTwoTccLists(tccListOne, tccListTwo): overlapping = compareTwoTccALL(tccListOne, tccListTwo) print len(tccListOne), len(tccListTwo), len(overlapping) #Take out overlapping from both tccLists for tcc in overlapping: if tcc in tccListOne: tccListOne.remove(tcc) if tcc in tccListTwo: tccListTwo.remove(tcc) print len(tccListOne), len(tccListTwo), len(overlapping) clusters = cgClusters.cgClusters() clusters.makeClusters(overlapping) newSeqs = [] for cluster in clusters.getClusters(): newSeqs.append(cgClusters.returnTccListRange(cluster)) print len(tccListOne), len(tccListTwo), len(overlapping), len(newSeqs) newSeqs.extend(tccListOne) newSeqs.extend(tccListTwo) print len(tccListOne), len(tccListTwo), len(overlapping), len(newSeqs) return newSeqs
def collapseOverlaps(tccList): '''If the list has overlapping sequences, combine the sequences that overlap. This makes a cluster and then returns the start and end point of the cluster''' clusters = cgClusters.cgClusters() clusters.makeClusters(tccList) newSeqs = [] for cluster in clusters.getClusters(): newSeqs.append(cgClusters.returnTccListRange(cluster)) return newSeqs