コード例 #1
0
ファイル: build_imm_params.py プロジェクト: Guannan/glimmer
def runMC(length):
    print 'Markov Chain length %d:' % length
    counts, immScores = init()

    startTime = time.time()
    coding, noncoding = findLongORFs(genome)
    counts = buildMarkovChain(counts, coding, noncoding, length)
    buildTime = time.time()
    approved, suspect = glimmer(genome, counts, immScores, length)
    endTime = time.time()
    print '  %0.2fs total (%0.2fs to build, %0.2fs to run)' % (endTime-startTime, buildTime-startTime, endTime-buildTime)
    writeORFs(approved, suspect)

    compareResults.compare('trueORFs.txt', 'predicted.txt')
    print ''
コード例 #2
0
ファイル: build_imm_params.py プロジェクト: Guannan/glimmer
def runIMM():
    print 'IMM max length %d:' % maxLength
    #maxLength = maxImmLength
    counts, immScores = init()

    startTime = time.time()
    coding, noncoding = findLongORFs(genome)
    counts = buildIMM(counts, coding, noncoding)
    buildTime = time.time()
    approved, suspect = glimmer(genome, counts, immScores)
    endTime = time.time()
    print '  %0.2fs total (%0.2fs to build, %0.2fs to run)' % (endTime-startTime, buildTime-startTime, endTime-buildTime)
    writeORFs(approved, suspect)

    compareResults.compare('trueORFs.txt', 'predicted.txt')
    print ''
コード例 #3
0
ファイル: build-imm.py プロジェクト: Guannan/glimmer
def runMC(length):
    ''' Run the fixed-length Markov model classifier and print the accuracy of the results.
    '''
    print 'Markov Chain length %d:' % length
    counts, immScores = init()

    startTime = time.time()
    coding, noncoding = findLongORFs(genome)
    counts = buildMarkovChain(counts, coding, noncoding, length)
    buildTime = time.time()
    approved, suspect = glimmer(genome, counts, immScores, length)
    endTime = time.time()
    print '  %0.2fs total (%0.2fs to build, %0.2fs to run)' % (endTime-startTime, buildTime-startTime, endTime-buildTime)
    writeORFs(approved, suspect)

    compareResults.compare(trueFile, 'predicted.txt')
    print ''
コード例 #4
0
ファイル: build-imm.py プロジェクト: Guannan/glimmer
def runIMM():
    ''' Run the IMM classifier and print the accuracy of the results.
    '''
    print 'IMM max length %d:' % maxLength
    counts, immScores = init()

    startTime = time.time()
    coding, noncoding = findLongORFs(genome)
    counts = buildIMM(counts, coding, noncoding)
    buildTime = time.time()
    approved, suspect = glimmer(genome, counts, immScores)
    endTime = time.time()
    print '  %0.2fs total (%0.2fs to build, %0.2fs to run)' % (endTime-startTime, buildTime-startTime, endTime-buildTime)
    writeORFs(approved, suspect)

    compareResults.compare(trueFile, 'predicted.txt')
    print ''
コード例 #5
0
def runMC(length):
    ''' Run the fixed-length Markov model classifier and print the accuracy of the results.
    '''
    print 'Markov Chain length %d:' % length
    counts, immScores = init()

    startTime = time.time()
    coding, noncoding = findLongORFs(genome)
    counts = buildMarkovChain(counts, coding, noncoding, length)
    buildTime = time.time()
    approved, suspect = glimmer(genome, counts, immScores, length)
    endTime = time.time()
    print '  %0.2fs total (%0.2fs to build, %0.2fs to run)' % (
        endTime - startTime, buildTime - startTime, endTime - buildTime)
    writeORFs(approved, suspect)

    compareResults.compare(trueFile, 'predicted.txt')
    print ''
コード例 #6
0
def runIMM():
    ''' Run the IMM classifier and print the accuracy of the results.
    '''
    print 'IMM max length %d:' % maxLength
    counts, immScores = init()

    startTime = time.time()
    coding, noncoding = findLongORFs(genome)
    counts = buildIMM(counts, coding, noncoding)
    buildTime = time.time()
    approved, suspect = glimmer(genome, counts, immScores)
    endTime = time.time()
    print '  %0.2fs total (%0.2fs to build, %0.2fs to run)' % (
        endTime - startTime, buildTime - startTime, endTime - buildTime)
    writeORFs(approved, suspect)

    compareResults.compare(trueFile, 'predicted.txt')
    print ''
コード例 #7
0
def runIterativeMC(length):
    ''' Repeatedly train on the set of predicted ORFs, and use a fixed-length MM to predict a new set of ORFs.
        Continue until the set of predicted ORFs does not change.
    '''

    print 'Iterative MC length %d:' % length

    coding, noncoding = findLongORFs(genome)
    oldORFs = []
    i = 0
    for x in xrange(10):
        i += 1
        print '  Iteration %d' % i

        counts, immScores = init()
        startTime = time.time()
        print '    Training on %d coding, %d noncoding...' % (len(coding),
                                                              len(noncoding))
        counts = buildMarkovChain(counts, coding, noncoding, length)
        buildTime = time.time()
        print '      Done, %0.2fs' % (buildTime - startTime)
        print '    Calculating ORFs...'
        approved, suspect = glimmer(genome, counts, immScores, length)
        endTime = time.time()
        print '      Done, %0.2fs' % (endTime - buildTime)
        print '    Found %d approved, %d suspected' % (len(approved),
                                                       len(suspect))

        writeORFs(approved, suspect)
        compareResults.compare(trueFile, 'predicted.txt')
        print ''

        newORFs = approved + suspect
        if noChange(oldORFs, newORFs):
            print '  Converged'
            break
        else:
            coding, noncoding = updateORFs(approved)
            oldORFs = newORFs
    print 'Completed after %d iterations' % i
コード例 #8
0
ファイル: build_imm_params.py プロジェクト: Guannan/glimmer
def runIterativeMC(length):
    ''' Repeatedly train on the set of predicted ORFs, and use a fixed-length MM predict a new set of ORFs.
        Continue until the set of predicted ORFs does not change.
    '''

    print 'Iterative MC length %d:' % length

    coding, noncoding = findLongORFs(genome)
    oldORFs = []
    i = 0
    for x in xrange(10):
        i += 1
        print '  Iteration %d' % i

        counts, immScores = init()
        startTime = time.time()
        print '    Training on %d coding, %d noncoding...' % (len(coding), len(noncoding))
        counts = buildMarkovChain(counts, coding, noncoding, length)
        buildTime = time.time()
        print '      Done, %0.2fs' % (buildTime-startTime)
        print '    Calculating ORFs...'
        approved, suspect = glimmer(genome, counts, immScores, length)
        endTime = time.time()
        print '      Done, %0.2fs' % (endTime-buildTime)
        print '    Found %d approved, %d suspected' % (len(approved), len(suspect))

        writeORFs(approved, suspect)
        compareResults.compare('trueORFs.txt', 'predicted.txt')
        print ''

        newORFs = approved+suspect
        if noChange(oldORFs, newORFs):
            print '  Converged'
            break
        else:
            coding, noncoding = updateORFs(approved)
            oldORFs = newORFs
    print 'Completed after %d iterations' % i