コード例 #1
0
def compareChains( pairs1, pairs2 ):
    '''compare chains in pairs1 versus those in pairs2'''
    
    result = {}
    for key1, chain1 in pairs1.iteritems():
        E.debug( "comparing %s" % str(key1) )

        ntotal = chain1.getNumAligned()

        if key1 not in pairs2:
            result[ key1 ] = DiffResult._make( (ntotal, 0, 0, ntotal) )
            continue

        chain2 = pairs2[key1]
        nsame = alignlib_lite.py_getAlignmentIdentity( chain1, chain2, alignlib_lite.py_RR )
        noverlap = alignlib_lite.py_getAlignmentOverlap( chain1, chain2, alignlib_lite.py_RR )
        ndifferent = noverlap - nsame
        nunique = ntotal - noverlap

        result[ key1 ] = DiffResult._make( (ntotal, nsame, ndifferent, nunique ) )

    return result
コード例 #2
0
ファイル: diff_chains.py プロジェクト: yangjl/cgat
def compareChains(pairs1, pairs2):
    '''compare chains in pairs1 versus those in pairs2'''

    result = {}
    for key1, chain1 in pairs1.iteritems():
        E.debug("comparing %s" % str(key1))

        ntotal = chain1.getNumAligned()

        if key1 not in pairs2:
            result[key1] = DiffResult._make((ntotal, 0, 0, ntotal))
            continue

        chain2 = pairs2[key1]
        nsame = alignlib_lite.py_getAlignmentIdentity(chain1, chain2,
                                                      alignlib_lite.py_RR)
        noverlap = alignlib_lite.py_getAlignmentOverlap(
            chain1, chain2, alignlib_lite.py_RR)
        ndifferent = noverlap - nsame
        nunique = ntotal - noverlap

        result[key1] = DiffResult._make((ntotal, nsame, ndifferent, nunique))

    return result