def first_step_simulation(strand_seq, trials, temperature, material="DNA"): print( "Running first step mode simulations for %s (with Boltzmann sampling)..." % (strand_seq)) def getOptions(trials, material): o = standardOptions(Options.firstPassageTime, temperature, trials, timeOut=100.0) dissociation(o, strand_seq, trials) # o.DNA23Metropolis() setArrheniusConstantsDNA23(o) # unreleased parameterization return o myMultistrand.setNumOfThreads(8) myMultistrand.setOptionsFactory2(getOptions, trials, material) myMultistrand.setTerminationCriteria(200) myMultistrand.setPassageMode() myMultistrand.run() return myMultistrand.results # this is a first passage rate object
def first_step_simulation(strand_seq, trials, T=20.0, material="DNA"): print( "Running first step mode simulations for %s (with Boltzmann sampling)..." % (strand_seq)) def getOptions(trials, material): o = standardOptions(Options.firstStep, tempIn=25.0, trials=200, timeOut=0.1) hybridization(o, strand_seq, trials) o.DNA23Metropolis() return o myMultistrand.setNumOfThreads(4) myMultistrand.setOptionsFactory2(getOptions, trials, material) myMultistrand.setTerminationCriteria(100) myMultistrand.setLeakMode() myMultistrand.run() return myMultistrand.results # this is a first step rate object
def first_step_simulation(strand_seq, trials, temperature=25.0, sodium=1.0, material="DNA"): print( "Running first step mode simulations for %s (with Boltzmann sampling)..." % (strand_seq)) def getOptions(trials, material, temperature=25.0, sodium=1.0): o = standardOptions(Options.firstStep, tempIn=temperature, trials=200, timeOut=1.0) o.sodium = sodium hybridization(o, strand_seq, trials) o.DNA23Metropolis() # setArrParams(o, 92) # the best DNA23 parameter set return o myMultistrand.setNumOfThreads(6) myMultistrand.setOptionsFactory4(getOptions, trials, material, temperature, sodium) myMultistrand.setTerminationCriteria(500) myMultistrand.setLeakMode() myMultistrand.run() return myMultistrand.results # this is a first step rate object
def run_distribution(seq): myMultistrand.setNumOfThreads(8) myMultistrand.setOptionsFactory4(setup_options, numOfPaths, seq, 2 * math.exp(-5.06 / RT), None) myMultistrand.run() eq_dict = {} for end_state in myMultistrand.endStates: for cmplx in end_state: if cmplx[4] in eq_dict: count = eq_dict[cmplx[4]][1] eq_dict[cmplx[4]][1] = count + 1 else: eq_dict[cmplx[4]] = [cmplx[5], 1] return eq_dict
def setupSimulationOptions(numThreads=8, leakMode=True, minimumSuccess=0, maxTrials=0, nBoot=0): myMultistrand.setNumOfThreads(numThreads) if leakMode: # Might be running a lot of trials here - save memory myMultistrand.setLeakMode() else: pass if minimumSuccess != 0: myMultistrand.setTerminationCriteria(minimumSuccess) if maxTrials != 0: myMultistrand.settings.max_trials = maxTrials if nBoot != 0: myMultistrand.setBootstrap(True, nBoot)
import xlrd import matplotlib.pyplot as plt import matplotlib.lines as lines import numpy as np from matplotlib.ticker import ScalarFormatter from multistrand.concurrent import myMultistrand, FirstStepRate, Bootstrap from multistrand.experiment import standardOptions, setBoltzmann from multistrand.objects import StopCondition, Domain, Complex, Strand from multistrand.options import Options from msArrhenius import setArrheniusConstantsDNA23 myMultistrand.setNumOfThreads(8) # Figure 2d has 3x12 = 36 rates plotted. # Input: 0 <= selector < 36 # range 0 -11: 6 nt toehold # range 12-23: 7 nt toehold # range 24-36: 10 nt toehold # order of mismatch position: # perfect - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 - 12 - 14 positionSelector = [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14] def machinek2014(options, selector, trialsIn):
# myMultistrand.clear() if __name__ == '__main__': if len(sys.argv) < 1: print """Usage: python hybridization_F3 <numOfThreads> <numOfPaths> P0/P3/P4 \n Example: python hybridization_F3 2 100 P3 """ sys.exit() print sys.argv numOfThreads = np.int(sys.argv[1]) numOfPaths = np.int(sys.argv[2]) toggle = str(sys.argv[3]) myMultistrand.setNumOfThreads(numOfThreads) if toggle == "test": doInference('TACCGT', "P0-test", 10, numOfPaths) # P0 if toggle == "test2": doInference(goa2006_P0, "P0-test", 10, numOfPaths) # P0 if toggle == "P0": doInference(goa2006_P0, toggle, 14, numOfPaths) # P0 if toggle == "P3": doInference(goa2006_P3, toggle, 14, numOfPaths) # P3 if toggle == "P4": doInference(goa2006_P4, toggle, 14, numOfPaths) # P4