Exemplo n.º 1
0
def alignWithName(leftSeg, rightSeg, folderName, mummerLink, nameOfOut):
    overlap = [0, 0]
    lLen = 0
    f = open(folderName + nameOfOut + "leftSeg.fasta", 'w')
    f.write(">SegL\n")

    if len(leftSeg) < 50000:
        f.write(leftSeg)
        lLen = len(leftSeg)
    else:
        f.write(leftSeg[-50000:])
        lLen = 50000
    f.close()

    rLen = 0
    f = open(folderName + nameOfOut + "rightSeg.fasta", 'w')
    f.write(">SegR\n")
    if len(rightSeg) < 50000:
        f.write(rightSeg)
        rLen = len(rightSeg)
    else:
        f.write(rightSeg[0:50000])
        rLen = 50000

    f.close()

    #alignerRobot.useMummerAlign(mummerLink, folderName, "overlap", "leftSeg.fasta", "rightSeg.fasta", False)
    alignerRobot.useMummerAlign(mummerLink,
                                folderName,
                                nameOfOut,
                                nameOfOut + "leftSeg.fasta",
                                nameOfOut + "rightSeg.fasta",
                                specialForRaw=False,
                                specialName="",
                                refinedVersion=True)
    dataList = alignerRobot.extractMumData(folderName, nameOfOut + "Out")

    thres = 10

    if len(dataList) == 0:
        overlap = [0, 0]
    else:
        myMax = [0, 0]

        for eachitem in dataList:
            if eachitem[1] > lLen - thres and eachitem[2] < thres:
                if eachitem[5] > myMax[1]:
                    myMax[0] = eachitem[4]
                    myMax[1] = eachitem[5]

        overlap = myMax

    return overlap
Exemplo n.º 2
0
def alignWithName(leftSeg, rightSeg, folderName, mummerLink, nameOfOut):
    overlap = [0, 0 ] 
    lLen = 0
    f = open(folderName + nameOfOut+"leftSeg.fasta", 'w')
    f.write(">SegL\n")
    
    if len(leftSeg) < 50000:
        f.write(leftSeg)
        lLen = len(leftSeg)
    else:
        f.write(leftSeg[-50000:])
        lLen = 50000
    f.close()
    
    rLen = 0
    f = open(folderName + nameOfOut+"rightSeg.fasta", 'w')
    f.write(">SegR\n")
    if len(rightSeg) < 50000:
        f.write(rightSeg)
        rLen  = len(rightSeg)
    else:
        f.write(rightSeg[0:50000])
        rLen = 50000
        
    f.close()
    
    
    #alignerRobot.useMummerAlign(mummerLink, folderName, "overlap", "leftSeg.fasta", "rightSeg.fasta", False)
    alignerRobot.useMummerAlign(mummerLink, folderName, nameOfOut, nameOfOut+"leftSeg.fasta", nameOfOut+"rightSeg.fasta", specialForRaw = False, specialName = "", refinedVersion= True)
    dataList =  alignerRobot.extractMumData(folderName , nameOfOut+"Out")
    
    thres = 10
    
    
    if len(dataList) == 0:
        overlap = [0, 0 ]
    else:
        myMax = [0, 0]
        
        for eachitem in dataList:
            if eachitem[1] > lLen - thres and eachitem[2] < thres:
                if eachitem[5] > myMax[1]:
                    myMax[0] = eachitem[4]
                    myMax[1] = eachitem[5]
        
        overlap = myMax 
    
    return overlap 
Exemplo n.º 3
0
def align(leftSeg, rightSeg, folderName, mummerLink):
    overlap = [0, 0]
    lLen = 0
    f = open(folderName + "leftSeg.fasta", "w")
    f.write(">SegL\n")

    if len(leftSeg) < 50000:
        f.write(leftSeg)
        lLen = len(leftSeg)
    else:
        f.write(leftSeg[-50000:])
        lLen = 50000
    f.close()

    rLen = 0
    f = open(folderName + "rightSeg.fasta", "w")
    f.write(">SegR\n")
    if len(rightSeg) < 50000:
        f.write(rightSeg)
        rLen = len(rightSeg)
    else:
        f.write(rightSeg[0:50000])
        rLen = 50000

    f.close()

    alignerRobot.useMummerAlign(mummerLink, folderName, "overlap", "leftSeg.fasta", "rightSeg.fasta", False)

    dataList = alignerRobot.extractMumData(folderName, "overlapOut")

    thres = 10

    if len(dataList) == 0:
        overlap = [0, 0]
    else:
        myMax = [0, 0]

        for eachitem in dataList:
            if eachitem[1] > lLen - thres and eachitem[2] < thres:
                if eachitem[5] > myMax[1]:
                    myMax[0] = eachitem[4]
                    myMax[1] = eachitem[5]

        overlap = myMax

    return overlap