Exemplo n.º 1
0
def remove_repeats_from_pacbp_list(pacbplist, overlap_ratio=0.85):
    """
    """
    if not pacbplist: return pacbplist
    # order pacbplist by `bits` attribute, highest first
    ordered = pacb.ordering.order_list_by_attribute(pacbplist,
                                                    order_by='bits',
                                                    reversed=True)
    # make upper cross of element indexes in ordered list of pacbps
    pairs = recombination.pairwise(range(0, len(ordered)))
    # loop over all pacbp combis, calculate overlap and store the
    # index to `toberemoved` when higher than `overlap_ratio`
    toberemoved = []
    for (posA, posB) in pairs:
        if posA in toberemoved: continue
        if posB in toberemoved: continue
        pacbpA = ordered[posA]
        pacbpB = ordered[posB]
        if ordering.overlap(pacbpA, pacbpB) >= overlap_ratio:
            toberemoved.append(posB)
    # order `toberemoved` and pop the (pacbp) elements from the ordered input list
    toberemoved.sort()
    toberemoved.reverse()
    for pos in toberemoved:
        ordered.pop(pos)
    # return the remainder of the odered input list
    return ordered
Exemplo n.º 2
0
def remove_repeats_from_pacbp_list(pacbplist, overlap_ratio=0.85):
    """
    """
    if not pacbplist:
        return pacbplist
    # order pacbplist by `bits` attribute, highest first
    ordered = pacb.ordering.order_list_by_attribute(pacbplist, order_by="bits", reversed=True)
    # make upper cross of element indexes in ordered list of pacbps
    pairs = recombination.pairwise(range(0, len(ordered)))
    # loop over all pacbp combis, calculate overlap and store the
    # index to `toberemoved` when higher than `overlap_ratio`
    toberemoved = []
    for (posA, posB) in pairs:
        if posA in toberemoved:
            continue
        if posB in toberemoved:
            continue
        pacbpA = ordered[posA]
        pacbpB = ordered[posB]
        if ordering.overlap(pacbpA, pacbpB) >= overlap_ratio:
            toberemoved.append(posB)
    # order `toberemoved` and pop the (pacbp) elements from the ordered input list
    toberemoved.sort()
    toberemoved.reverse()
    for pos in toberemoved:
        ordered.pop(pos)
    # return the remainder of the odered input list
    return ordered
Exemplo n.º 3
0
    def overlap(self,pacbp):
        """
        Give the overlap between this and another pacbp

        @attention: see pacb.ordering.overlap for documentation

        @rtype:  positive float 
        @return: highest overlap ratio of query and sbjct of these 2 pacbps
        """
        return ordering.overlap(self,pacbp)
Exemplo n.º 4
0
    def overlap(self, pacbp):
        """
        Give the overlap between this and another pacbp

        @attention: see pacb.ordering.overlap for documentation

        @rtype:  positive float 
        @return: highest overlap ratio of query and sbjct of these 2 pacbps
        """
        return ordering.overlap(self, pacbp)