def invert_sequence(chrSeq, start, stop): invert = chrSeq[int(start) - 1:int(stop)] MutableSeq.reverse_complement(invert) begin = MutableSeq.__add__(chrSeq[:int(start) - 1], invert) chrSeq = MutableSeq.__add__(begin, chrSeq[int(stop):]) return chrSeq
def duplicate_sequence(chrSeq, dupStart, dupStop, insertLoc, numDup=1, invert=False): duplication = str(chrSeq[int(dupStart) - 1:int(dupStop)]) * int(numDup) if invert == True: MutableSeq.reverse(duplication) begin = MutableSeq.__add__(chrSeq[:int(insertLoc)], duplication) chrSeq = MutableSeq.__add__(begin, chrSeq[int(insertLoc):]) return chrSeq
def insert_sequence(chrSeq, insertLoc, insertSeq): begin = MutableSeq.__add__(chrSeq[:int(insertLoc)], insertSeq) chrSeq = MutableSeq.__add__(begin, chrSeq[int(insertLoc):]) return chrSeq