def segemehl_parse(fusion, out):
    """
    Parse fusion junctions from segemehl aligner
    """
    print('Start parsing fusion junctions from segemehl...')
    total = 0
    with open(fusion, 'r') as junc_f, open(out, 'w') as outf:
        for i, line in enumerate(junc_f):
            chrom, start, end, info = line.split()[:4]
            if not info.endswith('C:P'):
                continue
            reads = info.split(':')[1]
            start = str(int(start) - 1)
            outf.write('\t'.join([chrom, start, end, 
                'FUSIONJUNC_%d/%s\t+\n' % (i, reads)]))
            total += int(reads)
    print('Converted %d fusion reads!' % total)
