def flip_jxn(jxn, gs1):
'''Flip jxn orientation for RNA Fusion that is inverse according to strand info'''
chrom1, pos1, str1, chrom2, pos2, str2, repleft, repright = re.split(':', jxn)
chrom1 = str(chrom1)
chrom2 = str(chrom2)
pos1 = int(pos1)
pos2 = int(pos2)
if str1 != gs1[0]:
flip = 1
flipstr = maketrans("-+", "+-")
if str1 == "-":
new_pos1 = chrom1 + ":" + str(pos1) + ":" + str1.translate(flipstr)
else:
new_pos1 = chrom1 + ":" + str(pos1) + ":" + str1.translate(flipstr)
if str2 == "-":
new_pos2 = chrom2 + ":" + str(pos2) + ":" + str2.translate(flipstr)
else:
new_pos2 = chrom2 + ":" + str(pos2) + ":" + str2.translate(flipstr)
newid = new_pos2 + ":" + new_pos1 + ":" + str(repright) + ":" + str(repleft)
else:
newid = jxn
flip = 0
return (newid, flip)
评论列表
文章目录