def doSims(numTraj=2): o1 = standardOptions() o1.simulation_mode = Options.firstStep o1.num_simulations = numTraj o1.output_interval = 1 o1.simulation_time = ATIME_OUT myComplex1 = makeComplex(["GTCACTGCTTTT"], "............") myComplex2 = makeComplex(["GTCACTGC", "GCAGTGAC"], ".(((((((+))))))).") o1.start_state = [myComplex1, myComplex2] # myComplex = makeComplex(["GTCACTGCTTTT","GTCACTGC","GCAGTGAC"], "..(.........+).((((((+))))))..") # o1.start_state = [myComplex] # no stop conditions, just timeout. o1.initial_seed = time.time() * 1000000 # o1. initial_seed = 1501710503137097 s = SimSystem(o1) s.start() printTrajectory(o1)
def create_test11(): seq0 = "GTAAAGACCAGTGGTGTGAAGATAGGAAAGGTGTTGATTGGGATTAGGAAACC" seq1 = "CATCACTATCAATCATACATGGTTTCCTAATCCCAATCAACACC" seq2 = "CATCACTATCAATCATACATGGTTTCCTATCTTCACACCACTGG" struc1 = ".......((((((((((((((((((((((((((((((((((((((((((((((+....................))))))))))))))))))))))))+......................))))))))))))))))))))))" complex1 = makeComplex([seq0, seq1, seq2], struc1) complex2 = makeComplex([seq0, seq1, seq2], struc1) return createOptions(complex1, complex2, "First Passage Time")
def doExperiment(trials): # complexes seqOutput = "CTACTTTCACCCTACGTCTCCAACTAACTTACGG" seqSignal = "CCACATACATCATATTCCCTCATTCAATACCCTACG" seqBackbone = "TGGAGACGTAGGGTATTGAATGAGGGCCGTAAGTT" # output + signal + backbone complex_dotparen = "." * 10 + "(" * (len(seqOutput) - 10) complex_dotparen += "+" + "." * 16 + "(" * (len(seqSignal) - 16) complex_dotparen += "+" + "." * 6 + ")" * (len(seqBackbone) - 6) myGate = makeComplex([seqOutput, seqSignal, seqBackbone], complex_dotparen) seqFuel = "CCTACGTCTCCAACTAACTTACGGCCCTCATTCAATACCCTACG" myFuel = makeComplex([seqFuel], "." * len(seqFuel)) myLeakedSignal = makeComplex([seqSignal], "." * len(seqSignal)) for x in [myGate, myFuel]: setBoltzmann(x, trials, supersample=10) # stopping states # the failed state is when the fuel releases again # the success state is when the leaked signal is observed. # we use dissocMacrostate - this only checks the presence of strands in the complex, and # does not depend on dotparens structure. successStopping = StopCondition( Options.STR_SUCCESS, [(myLeakedSignal, Options.dissocMacrostate, 0)]) failedStopping = StopCondition(Options.STR_FAILURE, [(myFuel, Options.dissocMacrostate, 0)]) # options stdOptions = standardOptions(trials=trials) stdOptions.start_state = [myGate, myFuel] stdOptions.stop_conditions = [successStopping, failedStopping] # buffer and temperature stdOptions.sodium = 0.05 stdOptions.magnesium = 0.0125 ## believed to be 11.5 mM effectively -- using 12.5 mM anyway stdOptions.temperature = 25 # can run at higher temperature to increase leak rate. # rate model stdOptions.DNA23Metropolis() #setArrheniusConstantsDNA23(stdOptions) stdOptions.simulation_time = 10.0 return stdOptions
def create_test10(): seq0 = "GTCACTGCTTTT" seq1 = "GCAGTGAC" dotparen1 = "..((((((....+)))))).." seq2 = "GTCACTGC" dotparen2 = "........" complex1 = makeComplex([seq0, seq1], dotparen1) complex2 = makeComplex([seq2], dotparen2) return createOptions(complex1, complex2, "First Passage Time")
def create_test12(): seq0 = "GTAATGTCGGCG" seq1 = "CGCCGACATTAC" seq2 = "GTAATG" struc1 = "(...........+).....((((((+))))))" # struc1 = "(...........+).....((((((+))))))" complex1 = makeComplex([seq0, seq1, seq2], struc1) complex2 = makeComplex([seq0, seq1, seq2], struc1) myOptions = createOptions(complex1, complex2, "First Passage Time") # setArrheniusConstantsDNA23(myOptions) return myOptions
def hybridizationString(seq): cutoff = 0.75 ids = [65, 66] N = len(seq) output = [] """ start with the seperated, zero-bp state """ dotparen1 = "." * N + "+" + "." * N complex0 = makeComplex([seq], "." * N, [ids[0]]) complex1 = makeComplex([seqComplement(seq)], "." * N, [ids[1]]) seperated = [complex0, complex1] output.append(seperated) """ bps is the number of basepairs between the strands offset is the offset of where the pairing starts """ dotparen0 = [seq, seqComplement(seq)] for bps in range(1, N + 1): for offset in range(N): dotparen1 = list("." * N + "+" + "." * N) if (bps + offset < (N + 1)) and bps < np.ceil(cutoff * N): # if (bps + offset < (N + 1)): for i in range(bps): dotparen1[offset + i] = "(" dotparen1[2 * N - offset - i] = ")" dotparen1 = "".join(dotparen1) complex = makeComplex(dotparen0, dotparen1, ids) output.append([complex]) """ We always require the final state to be the success state""" complex0 = makeComplex(dotparen0, "(" * N + "+" + ")" * N, ids) output.append([complex0]) return output
def create_test13(): seq0 = "ACTGACTGACTG" seq1 = "ACTG" seq2 = "CATTCAGTACAGT" struc1 = "((((((.(....+...(+)...).)).))))" complex1 = makeComplex([seq0, seq1, seq2], struc1) myOptions = createOptions(complex1, complex1, "First Passage Time") myOptions.join_concentration = 1.0e-9 # setArrheniusConstantsDNA23(myOptions) return myOptions
def get_startStates(self): self.initial_final_state_config() self.generate_statespace() pathway_list = [] strand_ids = [100, 200] for state in self.statespace: output = self.myFilter(state) if output == False: continue else: sequence_list, dotparen_list = output if len(dotparen_list) == 1: new_complex = makeComplex(sequence_list, dotparen_list[0], strand_ids) pathway_list.append([new_complex]) elif len(dotparen_list) == 2: new_complex0 = makeComplex([sequence_list[0]], dotparen_list[0], [strand_ids[0]]) new_complex1 = makeComplex([sequence_list[1]], dotparen_list[1], [strand_ids[1]]) pathway_list.append([new_complex1, new_complex0]) return pathway_list
def get_startStates(self): self.initial_final_state_config() self.generate_statespace() pathway_list = [] strand_ids = [1] for state in self.statespace: output = self.myFilter(state) if output == False: continue else: sequence_list, dotparen_list = output new_complex = makeComplex(sequence_list, dotparen_list[0], strand_ids) pathway_list.append([new_complex]) return pathway_list
def fattenStateSpace(self): ogVerb = Builder.verbosity Builder.verbosity = False counter = 0 def inspectionSim(inputs): o1 = standardOptions() o1.rate_method = self.options.rate_method o1.start_state = inputs[0] return o1 for key, value in self.protoSpace.items(): if ogVerb and ((counter % 100) == 0): print("Searching for missing transitions. Progress " + str(counter) + " / " + str(len(self.protoSpace))) (seqs, ids, structs) = self.protoSequences[key] myState = [] for seq, id, struct in zip(seqs, ids, structs): seqs = seq.split('+') ids = id.split(',') myC = makeComplex(seqs, struct, ids) myState.append(myC) ''' post: myState is the state we want to explore transitions for. ''' myB = Builder(inspectionSim, [myState]) myB.genAndSavePathsFile(inspecting=True) self.transitionMerge(myB) counter += 1 Builder.verbosity = ogVerb
def doSims(strandSeq, numTraj=2): o1 = standardOptions() o1.simulation_mode = Literals.trajectory o1.num_simulations = numTraj o1.output_interval = 1 o1.join_concentration = 1.0e-9 # o1.join_concentration = 1.0 o1.simulation_time = 0.000005 o1.DNA23Metropolis() seq1 = "ACTGACTGACTG" seq2 = "ACTG" seq3 = "CATTCAGTACAGT" struct = "((((((.((.(.+).((+)).)).)).))))" # # Using domain representation makes it easier to write secondary structures. # domain1 = Domain(name="d1", sequence=seq1) # domain2 = Domain(name="d2", sequence=seq2) # domain3 = Domain(name="d3", sequence=seq3) # # strand1 = Strand(name="s1", domains=[domain1]) # strand2 = Strand(name="s2", domains=[domain2]) # strand3 = Strand(name="s3", domains=[domain3]) myComplex = makeComplex([seq1, seq2, seq3], struct) print myComplex o1.start_state = [myComplex] # Note: no stopping conditions o1.initial_seed = 1777 + 6 s = SimSystem(o1) s.start() printTrajectory(o1)
def threewaybmString(lefttoe, displace, righttoe): ''' toehold switch around in the substrate ''' N = len(displace) rT = len(lefttoe) lT = len(righttoe) output = list() invaderSq = lefttoe + displace + righttoe incumbentSq = displace substrateSq = seqComplement(invaderSq) invaderID = 65 incumbentID = 66 substrateID = 67 """ start with the separated, zero-bp state """ complex0 = makeComplex([invaderSq], "." * (lT + N + rT), [invaderID]) complex1 = makeComplex([incumbentSq, substrateSq], "(" * N + "+" + "." * lT + ")" * N + "." * rT, [incumbentID, substrateID]) seperated = [complex0, complex1] output.append(seperated) ''' left invasion toehold ''' seqsL = [invaderSq, substrateSq, incumbentSq] idsL = [invaderID, substrateID, incumbentID] weaving = weave(lT) for pair in weaving: dotparen = "." * (N + rT) + pair[0] + "+" + pair[ 1] + "(" * N + "." * rT + "+" + ")" * N output.append([makeComplex(seqsL, dotparen, idsL)]) if lT == 0: dotparen = "." * ( N + rT) + "" + "+" + "" + "(" * N + "." * rT + "+" + ")" * N ''' the dotparen of the weave is the fully hybridized toehold. Toggle the basepairs one step at a time. ''' for invasion in range(N - 1): parenList = list(dotparen) parenList[rT + N - 1 - invasion] = "(" parenList[lT + N + rT + 1 + lT + invasion] = ")" parenList[-invasion - 1] = "." dotparen = "".join(parenList) output.append([makeComplex(seqsL, dotparen, idsL)]) ''' right invasion toehold ''' seqsR = [invaderSq, incumbentSq, substrateSq] idsR = [invaderID, incumbentID, substrateID] weaving = weave(rT) for pair in weaving: dotparen = pair[0] + "." * ( N + lT) + "+" + "(" * N + "+" + "." * lT + ")" * N + pair[1] output.append([makeComplex(seqsR, dotparen, idsR)]) if rT == 0: dotparen = "" + "." * ( N + lT) + "+" + "(" * N + "+" + "." * lT + ")" * N + "" ''' Toggle the basepairs one step at a time. ''' for invasion in range(N - 1): parenList = list(dotparen) parenList[rT + invasion] = "(" parenList[lT + N + rT + 1 + invasion] = "." dotparen = "".join(parenList) output.append([makeComplex(seqsR, dotparen, idsR)]) ''' Do not forget to set the final state. This is just the displaced strand floating freely. ''' output.append([makeComplex([incumbentSq], "." * N, [incumbentID])]) return output