Пример #1
0
def extractBaitSeq(baitSeq, baitRev, genome, coord):
    fs = open(baitSeq, "w")
    fr = open(baitRev, "w")
    for name, seq in readFasta(genome):
        c = editBaitCoord(coord.get(name, []), 200)
        if not c:
            continue
        for n, s in extractSeq(name, c, seq, True):
            beg, end = n.split(":")[1:]
            n = ">" + name + ":" + ",".join(beg.split(",")[1:-1]) + ":" + ",".join(end.split(",")[1:-1])
            writeFasta(n, s, fs)
            writeFasta(n, s[::-1], fr)
    fs.close()
    fr.close()
Пример #2
0
def extractBaitSeq(baitSeq, baitRev, genome, coord):
    fs = open(baitSeq, "w")
    fr = open(baitRev, "w")
    for name, seq in readFasta(genome):
        c = editBaitCoord(coord.get(name, []), 200)
        if not c: continue
        for n, s in extractSeq(name, c, seq, True):
            beg, end = n.split(":")[1:]
            n = ">" + name + ":" + \
                ",".join(beg.split(",")[1:-1]) + ":" + \
                ",".join(end.split(",")[1:-1])
            writeFasta(n, s, fs)
            writeFasta(n, s[::-1], fr)
    fs.close()
    fr.close()
Пример #3
0
def extractFlankSeq(flankSeq, flankRev, flanklen, hitDict, nucleus):
    fs = open(flankSeq, "w")
    fr = open(flankRev, "w")
    wrote = 0
    mark = string.maketrans(":", "^")
    for name, seq in readFasta(nucleus):
        coord = makeFlankCoord(hitDict.get(name, []), flanklen)
        if not coord: continue
        for n, s in extractSeq(name, coord, seq, True):
            beg, end = n.split(":")[1:]
            n = ">" + name.translate(mark) + ":" + \
                beg.split(",")[-1] + ":" + end.split(",")[0]
            if len(s):
                writeFasta(n, s, fs)
                writeFasta(n, s[::-1], fr)
                wrote += 1
    fs.close()
    fr.close()
    return wrote
Пример #4
0
def extractFlankSeq(flankSeq, flankRev, flanklen, hitDict, nucleus):
    fs = open(flankSeq, "w")
    fr = open(flankRev, "w")
    wrote = 0
    mark = string.maketrans(":", "^")
    for name, seq in readFasta(nucleus):
        coord = makeFlankCoord(hitDict.get(name, []), flanklen)
        if not coord: continue
        for n, s in extractSeq(name, coord, seq, True):
            beg, end = n.split(":")[1:]
            n = ">" + name.translate(mark) + ":" + \
                beg.split(",")[-1] + ":" + end.split(",")[0]
            if len(s):
                writeFasta(n, s, fs)
                writeFasta(n, s[::-1], fr)
                wrote += 1
    fs.close()
    fr.close()
    return wrote