Esempio n. 1
0
def test():
    cmgr = WorkCounterManager(); cmgr.start()
    c = WorkCounter(10)
    c.add_subwork(10, weights=(1.1,2.2,3,4,5,6,7,8,9,10))
    
    for i in xrange(10):
        print c
        c[i].count()
        c.count()
        sleep(1)
    print c
Esempio n. 2
0
    def _main(self):
        import time
        import DegenPrimer.TD_Functions as tdf
        from DegenPrimer.Primer import Primer
        from DegenPrimer.SeqUtils import load_sequence
        from DegenPrimer.WorkCounter import WorkCounterManager
        from BioUtils.Tools import WaitingThread
        from DegenPrimer.iPCR import iPCR
        from threading import Lock
        import cProfile
        
        tdf.PCR_P.PCR_T = 53
        tdf.PCR_P.Mg    = 3e-3
        tdf.PCR_P.dNTP  = 300e-6
        tdf.PCR_P.DNA   = 1e-10
        fwd_primer = Primer(load_sequence('ATATTCTACRACGGCTATCC', 'fwd_test', 'fwd_test'), 0.43e-6, True)
        rev_primer = Primer(load_sequence('GAASGCRAAKATYGGGAAC', 'rev_test', 'rev_test'), 0.43e-6, True)
        ipcr = iPCR(self.abort_event,
                    max_mismatches=6,
                    job_id='test-job', 
                    primers=[fwd_primer,
                             rev_primer], 
                    min_amplicon=50, 
                    max_amplicon=2000, 
                    polymerase=40000, 
                    with_exonuclease=False, 
                    num_cycles=30,
                    side_reactions=None, 
                    side_concentrations=None,
                    include_side_annealings=True)
        cmgr = WorkCounterManager()
        cmgr.start()
        counter = cmgr.WorkCounter()
        
        plock = Lock()
            
        job = WaitingThread(plock, 1, target=ipcr.simulate_PCR, 
                            name='simulate_PCR',
                            args=(counter, 
                                  (
                                '../data/ThGa.fa', #single sequence
#                                   '../data/Ch5_gnm.fa', '../data/ThDS1.fa', '../data/ThES1.fa', #long sequences 
                                   '../data/ThDS1-FC.fa', '../data/ThDS1-850b-product.fa', #short sequences
                                  ),))
        job.start(); print ''
        while job.is_alive():
            if counter.changed_percent():
                with plock: print counter
            time.sleep(1)
        job.join()
        with plock: print counter
        ipcr.write_report()
        
        cProfile.runctx('for i in xrange(100): ipcr.write_reports()', globals(), locals(), 'iPCR.write_reports.profile')
Esempio n. 3
0
def test():
    cmgr = WorkCounterManager()
    cmgr.start()
    c = WorkCounter(10)
    c.add_subwork(10, weights=(1.1, 2.2, 3, 4, 5, 6, 7, 8, 9, 10))

    for i in xrange(10):
        print c
        c[i].count()
        c.count()
        sleep(1)
    print c
Esempio n. 4
0
    def _main(self):
        import time
        import DegenPrimer.TD_Functions as tdf
        from DegenPrimer.Primer import Primer
        from DegenPrimer.SeqUtils import load_sequence
        from DegenPrimer.WorkCounter import WorkCounterManager
        from BioUtils.Tools import WaitingThread
        from DegenPrimer.iPCR import iPCR
        from threading import Lock
        import cProfile

        tdf.PCR_P.PCR_T = 53
        tdf.PCR_P.Mg = 3e-3
        tdf.PCR_P.dNTP = 300e-6
        tdf.PCR_P.DNA = 1e-10
        fwd_primer = Primer(
            load_sequence('ATATTCTACRACGGCTATCC', 'fwd_test', 'fwd_test'),
            0.43e-6, True)
        rev_primer = Primer(
            load_sequence('GAASGCRAAKATYGGGAAC', 'rev_test', 'rev_test'),
            0.43e-6, True)
        ipcr = iPCR(self.abort_event,
                    max_mismatches=6,
                    job_id='test-job',
                    primers=[fwd_primer, rev_primer],
                    min_amplicon=50,
                    max_amplicon=2000,
                    polymerase=40000,
                    with_exonuclease=False,
                    num_cycles=30,
                    side_reactions=None,
                    side_concentrations=None,
                    include_side_annealings=True)
        cmgr = WorkCounterManager()
        cmgr.start()
        counter = cmgr.WorkCounter()

        plock = Lock()

        job = WaitingThread(
            plock,
            1,
            target=ipcr.simulate_PCR,
            name='simulate_PCR',
            args=(
                counter,
                (
                    '../data/ThGa.fa',  #single sequence
                    #                                   '../data/Ch5_gnm.fa', '../data/ThDS1.fa', '../data/ThES1.fa', #long sequences
                    '../data/ThDS1-FC.fa',
                    '../data/ThDS1-850b-product.fa',  #short sequences
                ),
            ))
        job.start()
        print ''
        while job.is_alive():
            if counter.changed_percent():
                with plock:
                    print counter
            time.sleep(1)
        job.join()
        with plock:
            print counter
        ipcr.write_report()

        cProfile.runctx('for i in xrange(100): ipcr.write_reports()',
                        globals(), locals(), 'iPCR.write_reports.profile')
                      'R-TGAM_0055-624-d4'), 0.43e-6, True)

    blastp = BlastPrimers(abort_event,
                          job_id='F-TGAM_0057-268_d1-R-TGAM_0055-624-d4',
                          primers=[fwd_primer, rev_primer],
                          min_amplicon=50,
                          max_amplicon=2000,
                          polymerase=40000,
                          with_exonuclease=False,
                          num_cycles=30,
                          side_reactions=None,
                          side_concentrations=None,
                          include_side_annealings=False)
    if not blastp.have_saved_results(): sys.exit()

    cmgr = WorkCounterManager()
    cmgr.start()

    plock = Lock()

    counter = cmgr.WorkCounter()
    job = WaitingThread(plock,
                        1,
                        target=blastp.load_and_analyze,
                        name='load_and_analyze',
                        kwargs=dict(counter=counter))
    job.start()
    print ''
    while job.is_alive():
        if counter.changed_percent():
            with plock:
Esempio n. 6
0
    
    blastp = BlastPrimers(abort_event,
                          job_id='F-TGAM_0057-268_d1-R-TGAM_0055-624-d4', 
                          primers=[fwd_primer,
                                   rev_primer], 
                          min_amplicon=50, 
                          max_amplicon=2000, 
                          polymerase=40000, 
                          with_exonuclease=False, 
                          num_cycles=30,
                          side_reactions=None, 
                          side_concentrations=None,
                          include_side_annealings=False)
    if not blastp.have_saved_results(): sys.exit()

    cmgr = WorkCounterManager()
    cmgr.start()
    
    plock = Lock()    
    
    counter = cmgr.WorkCounter()
    job = WaitingThread(plock, 1, target=blastp.load_and_analyze, 
                        name='load_and_analyze', kwargs=dict(counter=counter))
    job.start(); print ''
    while job.is_alive():
        if counter.changed_percent():
            with plock: print counter #.rstr()
        sleep(0.1)
    job.join()
    with plock: print counter #.rstr()