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')
def _main(self): from threading import Lock from BioUtils.Tools import WaitingThread from DegenPrimer.Primer import Primer from DegenPrimer.SeqUtils import load_sequence from DegenPrimer.PCR_Optimizer import PCR_Optimizer from DegenPrimer import TD_Functions as tdf 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) optimizer = PCR_Optimizer(self.abort_event, 100, 5, max_mismatches=5, 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=False) plock = Lock() job = WaitingThread(plock, 1, target=optimizer.optimize_PCR_parameters, name='optimize PCR', args=('../data/ThGa.fa', ({'start':47920, 'end':49321},), ( {'name':'PCR_T', 'min':50, 'ini':60, 'max':72}, # {'name':'dNTP', # 'min':100e-6, 'ini':200e-6, 'max':900e-6}, ), )) job.start(); print '' job.join() optimizer.write_report()
def _main(self): from threading import Lock from BioUtils.Tools import WaitingThread from DegenPrimer.Primer import Primer from DegenPrimer.SeqUtils import load_sequence from DegenPrimer.PCR_Optimizer import PCR_Optimizer from DegenPrimer import TD_Functions as tdf 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) optimizer = PCR_Optimizer(self.abort_event, 100, 5, max_mismatches=5, 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=False) plock = Lock() job = WaitingThread( plock, 1, target=optimizer.optimize_PCR_parameters, name='optimize PCR', args=( '../data/ThGa.fa', ({ 'start': 47920, 'end': 49321 }, ), ({ 'name': 'PCR_T', 'min': 50, 'ini': 60, 'max': 72 }, # {'name':'dNTP', # 'min':100e-6, 'ini':200e-6, 'max':900e-6}, ), )) job.start() print '' job.join() optimizer.write_report()
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')
from DegenPrimer.TD_Functions import PCR_P from DegenPrimer.BlastPrimers import BlastPrimers from threading import Lock os.chdir('../') mgr = Manager() abort_event = mgr.Event() PCR_P.PCR_T = 53 PCR_P.Mg = 3e-3 PCR_P.dNTP = 300e-6 PCR_P.DNA = 1e-10 fwd_primer = Primer( load_sequence('ATATTCTACRACGGCTATCC', 'F-TGAM_0057-268_d1', 'F-TGAM_0057-268_d1'), 0.43e-6, True) rev_primer = Primer( load_sequence('GAASGCRAAKATYGGGAAC', 'R-TGAM_0055-624-d4', '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)
from DegenPrimer.WaitingThread import WaitingThread from DegenPrimer.TD_Functions import PCR_P from DegenPrimer.BlastPrimers import BlastPrimers from threading import Lock os.chdir('../') mgr = Manager() abort_event = mgr.Event() PCR_P.PCR_T = 53 PCR_P.Mg = 3e-3 PCR_P.dNTP = 300e-6 PCR_P.DNA = 1e-10 fwd_primer = Primer(load_sequence('ATATTCTACRACGGCTATCC', 'F-TGAM_0057-268_d1', 'F-TGAM_0057-268_d1'), 0.43e-6, True) rev_primer = Primer(load_sequence('GAASGCRAAKATYGGGAAC', 'R-TGAM_0055-624-d4', '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()