Esempio n. 1
0
                    print '\n'
                print '\n'
    #end def

    ppid = os.getpid()
    import DegenPrimer.TD_Functions as tdf
    from DegenPrimer.SearchEngine import SearchEngine
    from DegenPrimer.WorkCounter import WorkCounter
    tdf.PCR_P.PCR_T = 60
    
    searcher = SearchEngine(abort_event)
    
    cProfile.runctx('for x in xrange(10): searcher._find(WorkCounter(), template, primer, len(template), len(primer), 6)', 
                    globals(), locals(), 'SearchEngine._find.profile')
    
    matches = searcher._find_mp(WorkCounter(), template[:2000], primer, len(template), len(primer), 6)
    cProfile.runctx('for x in xrange(10): searcher.compile_duplexes(WorkCounter(), *matches)', 
                    globals(), locals(), 'SearchEngine.compile_duplexes.profile')
    
    f = 'test_search_results.txt'
    dups = searcher.compile_duplexes(WorkCounter(), *matches)
    if not os.path.isfile(f):
        with open(f, 'w') as out:
            out.write(str(dups))
        sys.exit()
    else:
        with open(f, 'r') as inp:
            if str(dups) != inp.read():
                with open(f+'.wrong', 'w') as out:
                    out.write(str(dups))
                raise RuntimeError('compiled duplexes differ from the standard')
    #end def

    ppid = os.getpid()
    import DegenPrimer.TD_Functions as tdf
    from DegenPrimer.SearchEngine import SearchEngine
    from DegenPrimer.WorkCounter import WorkCounter
    tdf.PCR_P.PCR_T = 60

    searcher = SearchEngine(abort_event)

    cProfile.runctx(
        'for x in xrange(10): searcher._find(WorkCounter(), template, primer, len(template), len(primer), 6)',
        globals(), locals(), 'SearchEngine._find.profile')

    matches = searcher._find_mp(WorkCounter(), template[:2000], primer,
                                len(template), len(primer), 6)
    cProfile.runctx(
        'for x in xrange(10): searcher.compile_duplexes(WorkCounter(), *matches)',
        globals(), locals(), 'SearchEngine.compile_duplexes.profile')

    f = 'test_search_results.txt'
    dups = searcher.compile_duplexes(WorkCounter(), *matches)
    if not os.path.isfile(f):
        with open(f, 'w') as out:
            out.write(str(dups))
        sys.exit()
    else:
        with open(f, 'r') as inp:
            if str(dups) != inp.read():
                with open(f + '.wrong', 'w') as out:
                    out.write(str(dups))