annotate.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:SVclone 作者: mcmero 项目源码 文件源码
def sort_breakend_order(svs):
    '''
    per sv, ensure chrom1, chrom2 and pos1, pos2 are ordered
    '''
    svs = svs.copy()
    for sv in np.nditer(svs, op_flags=['readwrite']):
        if sv['chr1'] == sv['chr2']:
            if sv['pos1'] > sv['pos2']:
                ts = sv.copy()
                sv['pos1'], sv['dir1'] = ts['pos2'], ts['dir2']
                sv['pos2'], sv['dir2'] = ts['pos1'], ts['dir1']
        else:
            chrs = [str(sv['chr1']), str(sv['chr2'])]
            if not np.all(np.array(chrs) == np.array(nice_sort(chrs))):
                ts = sv.copy()
                sv['chr1'], sv['pos1'], sv['dir1'] = ts['chr2'], ts['pos2'], ts['dir2']
                sv['chr2'], sv['pos2'], sv['dir2'] = ts['chr1'], ts['pos1'], ts['dir1']
    return svs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号