def normalize_jxns(chrom1, chrom2, pos1, pos2, strand1, strand2, repleft, repright, order):
'''Choose one representation for DNA breakpoints'''
flipstr = maketrans("-+", "+-")
if order == 2:
if strand1 == "-":
new_pos1 = str(chrom1) + ":" + str(pos1 - int(repright)) + ":" + strand1.translate(flipstr)
else:
new_pos1 = str(chrom1) + ":" + str(pos1 + int(repright)) + ":" + strand1.translate(flipstr)
if strand2 == "-":
new_pos2 = str(chrom2) + ":" + str(pos2 - int(repright)) + ":" + strand2.translate(flipstr)
else:
new_pos2 = str(chrom2) + ":" + str(pos2 + int(repright)) + ":" + strand2.translate(flipstr)
newid = new_pos2 + ":" + new_pos1 + ":" + str(repleft) + ":" + str(repright)
elif order == 1:
new_pos1 = str(chrom1) + ":" + str(pos1) + ":" + strand1
new_pos2 = str(chrom2) + ":" + str(pos2) + ":" + strand2
newid = new_pos1 + ":" + new_pos2 + ":" + str(repleft) + ":" + str(repright)
return newid
评论列表
文章目录