コード例 #1
0
def simulationFlamm2000(trialsIn):

    seq = "GGCCCCTTTGGGGGCCAGACCCCTAAAGGGGTC"

    structStart = "................................."
    struct0 = "((((((((((((((.....))))))))))))))"
    struct1 = "((((((....)))))).((((((....))))))"

    stdOptions = standardOptions(simMode=Literals.trajectory,
                                 trials=trialsIn,
                                 tempIn=37.0)
    stdOptions.substrate_type = Literals.substrateRNA
    stdOptions.gt_enable = 1
    stdOptions.simulation_time = A_TIME_OUT
    stdOptions.DNA23Metropolis()

    stemdomain1 = Domain(name="stemdomain1", sequence=seq)
    strand = Strand(name="top", domains=[stemdomain1])

    startComplex = Complex(strands=[strand], structure=structStart)
    successComplex0 = Complex(strands=[strand], structure=struct0)
    successComplex1 = Complex(strands=[strand], structure=struct1)

    # Stop when the exact full duplex is achieved.
    stopSuccess0 = StopCondition(
        Literals.success, [(successComplex0, Literals.exact_macrostate, 0)])
    stopSuccess1 = StopCondition(
        Literals.alt_success,
        [(successComplex1, Literals.exact_macrostate, 0)])

    stdOptions.start_state = [startComplex]
    stdOptions.stop_conditions = [stopSuccess0, stopSuccess1]

    return stdOptions
コード例 #2
0
def calculateGateGateLeak(gateA, gateB, trials=INCREMENT_TRIALS, material="DNA"):
    # define stop conditions
    gateA_complex = gateA.gate_output_complex
    gateB_complex = gateB.gate_output_complex
    leak_complex = gateB.output_complex
    alt_leak_complex = gateA.output_complex

    success_stop_condition = StopCondition(
        Options.STR_SUCCESS, [(leak_complex,
                               Options.dissocMacrostate, 0)])

    alt_success_stop_condition = StopCondition(
        Options.STR_ALT_SUCCESS, [(alt_leak_complex, Options.dissocMacrostate, 0)])

    failed_stop_condition = StopCondition(
        Options.STR_FAILURE, [(gateA_complex,
                               Options.dissocMacrostate, 0)])

    myMultistrand.setOptionsFactory6(getOptions, trials, material,
                                     gateA_complex, gateB_complex,
                                     [success_stop_condition,
                                         alt_success_stop_condition],
                                     [failed_stop_condition])

    return getRates()
コード例 #3
0
def leakInvasion(options, mySeq, myTrials=0, doFirstPassage=False):

    onedomain = Domain(name="d1", sequence=mySeq)
    top = Strand(name="top", domains=[onedomain])
    bot = top.C

    initial_complex = Complex(strands=[top, bot], structure="(+)")
    invader_top = Complex(strands=[top], structure=".")

    # Turns Boltzmann sampling on for this complex and also does sampling more efficiently by sampling 'trials' states.
    if (myTrials > 0):
        setBoltzmann(initial_complex, myTrials)
        setBoltzmann(invader_top, myTrials)

    # Stop when the exact full duplex is achieved.
    stopSuccess = StopCondition(
        Literals.success, [(success_complex, Literals.exact_macrostate, 0)])

    # Declare the simulation unproductive if the strands become single-stranded again.
    failed_complex = Complex(strands=[top], structure=".")
    stopFailed = StopCondition(
        Literals.failure, [(failed_complex, Literals.dissoc_macrostate, 0)])

    options.start_state = [startTop, startBot]

    # Point the options to the right objects
    if not doFirstPassage:

        options.stop_conditions = [stopSuccess, stopFailed]

    else:

        options.stop_conditions = [stopSuccess]
コード例 #4
0
def simulationYurke(trialsIn):

    stdOptions = standardOptions(simMode=Literals.first_passage_time,
                                 trials=trialsIn)
    stdOptions.simulation_time = A_TIME_OUT
    stdOptions.DNA23Metropolis()

    stdOptions.temperature = 25.0

    domS = Domain(sequence="ACTAATCCTCAGATCCAGCTAGTGTC", name="d_S")
    domD = Domain(sequence="A", name="d_A")
    domT = Domain(sequence="CGTACT", name="d_T")

    strandQ = Strand(domains=[domS, domD])
    strandT = Strand(domains=[domT, domS])
    strandS = strandT.C

    complexStart = Complex(strands=[strandQ, strandS, strandT],
                           structure="(.+)(+).")
    complexEndS = Complex(strands=[strandQ], structure="..")
    complexEndF = Complex(strands=[strandT],
                          structure="..")  # # ALT_SUCCESS is dissociation

    stopSuccess = StopCondition(Literals.success,
                                [(complexEndS, Literals.dissoc_macrostate, 3)])
    stopFailed = StopCondition(Literals.alt_success,
                               [(complexEndF, Literals.dissoc_macrostate, 3)])

    stdOptions.start_state = [complexStart]
    stdOptions.stop_conditions = [stopSuccess, stopFailed]

    return stdOptions
コード例 #5
0
def two_input(options,
              input_complex_A,
              input_complex_B,
              output_complex,
              trials=0,
              supersample=25,
              doFirstPassage=False):

    if (trials > 0):
        for x in [input_complex_A, input_complex_B]:
            setBoltzmann(x, trials, supersample)

    successful_stop_condition = StopCondition(
        Literals.success, [(output_complex, Literals.dissoc_macrostate, 0)])
    failure_stop_condition = StopCondition(
        Literals.failure, [(input_complex_B, Literals.dissoc_macrostate, 0)])

    options.start_state = [input_complex_A, input_complex_B]

    # Point the options to the right objects
    if not doFirstPassage:
        options.stop_conditions = [
            successful_stop_condition, failure_stop_condition
        ]
    else:
        options.stop_conditions = [successful_stop_condition]
コード例 #6
0
def threewayDisplacement(options,
                         toeholdSeq,
                         domainSeq,
                         myTrials=0,
                         mySuperSample=1):

    toeholdDomain = Domain(name="toehold", sequence=toeholdSeq)
    disDomain = Domain(name="displacement", sequence=domainSeq)

    topS = Strand(name="top", domains=[disDomain])
    invaderS = Strand(name="invader", domains=[disDomain, toeholdDomain])
    botS = invaderS.C

    startComplex = Complex(strands=[topS, botS], structure="(+.)")
    invaderComplex = Complex(strands=[invaderS], structure="..")
    successComplex = Complex(strands=[botS, invaderS], structure="((+))")

    if (myTrials > 0):
        setBoltzmann(startComplex, myTrials, mySuperSample)
        setBoltzmann(invaderComplex, myTrials, mySuperSample)

    # stop when the invasion is complete, or when the invader dissociates
    stopSuccess = StopCondition(
        Options.STR_SUCCESS, [(successComplex, Options.dissocMacrostate, 0)])

    # Declare the simulation unproductive if the invader becomes single-stranded again.
    stopFailed = StopCondition(Options.STR_FAILURE,
                               [(invaderComplex, Options.dissocMacrostate, 0)])

    #set the starting and stopping conditions
    options.start_state = [startComplex, invaderComplex]
    options.stop_conditions = [stopFailed, stopSuccess]
コード例 #7
0
def two_input_two_success(trials,
                          options,
                          input_complex_A,
                          input_complex_B,
                          output_complex_A,
                          output_complex_B,
                          supersample=25,
                          doFirstPassage=False):

    if (trials > 0):
        for x in [input_complex_A, input_complex_B]:
            setBoltzmann(x, trials, supersample)

    successful_stop_condition = StopCondition(
        Options.STR_SUCCESS, [(output_complex_A, Options.dissocMacrostate, 0)])
    alt_successful_stop_condition = StopCondition(
        Options.STR_ALT_SUCCESS,
        [(output_complex_B, Options.dissocMacrostate, 0)])
    failure_stop_condition = StopCondition(
        Options.STR_FAILURE, [(input_complex_B, Options.dissocMacrostate, 0)])

    options.start_state = [input_complex_A, input_complex_B]

    # Point the options to the right objects
    if not doFirstPassage:
        options.stop_conditions = [
            successful_stop_condition, alt_successful_stop_condition,
            failure_stop_condition
        ]
    else:
        options.stop_conditions = [
            successful_stop_condition, alt_successful_stop_condition
        ]
コード例 #8
0
def first_step_simulation(strand_seq, trials, T=25, material="DNA"):

    print(
        "Running first step mode simulations for %s (with Boltzmann sampling)..."
        % (strand_seq))

    # Using domain representation makes it easier to write secondary structures.
    onedomain = Domain(name="onedomain", sequence=strand_seq)
    gdomain = Domain(name="gdomain", sequence="TTTT")

    top = Strand(name="top", domains=[onedomain])
    bot = top.C
    dangle = Strand(name="Dangle", domains=[onedomain, gdomain])

    duplex_complex = Complex(strands=[top, bot], structure="(+)")
    invader_complex = Complex(strands=[dangle], structure="..")
    duplex_invaded = Complex(strands=[dangle, bot], structure="(.+)")

    # Declare the simulation complete if the strands become a perfect duplex.
    success_stop_condition = StopCondition(
        Options.STR_SUCCESS, [(duplex_invaded, Options.exactMacrostate, 0)])
    failed_stop_condition = StopCondition(
        Options.STR_FAILURE, [(duplex_complex, Options.dissocMacrostate, 0)])

    for x in [duplex_complex, invader_complex]:
        x.boltzmann_count = trials
        x.boltzmann_sample = True

    # the first argument has to be trials.
    def getOptions(trials, material, duplex_complex, dangle,
                   success_stop_condition, failed_stop_condition):

        o = Options(simulation_mode="First Step",
                    substrate_type=material,
                    rate_method="Metropolis",
                    num_simulations=trials,
                    simulation_time=ATIME_OUT,
                    temperature=T)

        o.start_state = [duplex_complex, dangle]
        o.stop_conditions = [success_stop_condition, failed_stop_condition]

        # FD: The result of this script depend significantly on JS or DNA23 parameterization.
        #        o.JSMetropolis25()
        # o.DNA23Metropolis()
        setArrheniusConstantsDNA23(o)

        return o

    myMultistrand.setOptionsFactory6(getOptions, trials, material,
                                     duplex_complex, invader_complex,
                                     success_stop_condition,
                                     failed_stop_condition)
    myMultistrand.run()
    myFSR = myMultistrand.results

    # Now determine the reaction model parameters from the simulation results.
    #     myFSR = FirstStepRate(dataset, 5e-9)

    print myFSR
コード例 #9
0
def ravan(options, trialsIn, selector):
    # we only allow first step mode at this point.
    
    if PENG_YIN == True:
        
        RAVAN_H1 = "GCTTGAGATGTTAGGGAGTAGTGCTCCAATCACAACGCACTACTCCCTAACATC"
        RAVAN_H2 = "AGGGAGTAGTGCGTTGTGATTGGAAACATCTCAAGCTCCAATCACAACGCACTA"
        RAVAN_H3 = "GTTGTGATTGGAGCTTGAGATGTTGCACTACTCCCTAACATCTCAAGCTCCAAT"
        RAVAN_I =  "GCACTACTCCCTAACATCTCAAGC"
    
    
    strand_H1 = Strand(name="H1", sequence=RAVAN_H1)
    strand_H2 = Strand(name="H2", sequence=RAVAN_H2)
    strand_H3 = Strand(name="H3", sequence=RAVAN_H3)
    strand_I = Strand(name="I", sequence=RAVAN_I)
    
    dotparen_H1 = "." * len(RAVAN_H1)
    dotparen_H2 = "." * len(RAVAN_H2)
    dotparen_H3 = "." * len(RAVAN_H3)
    dotparen_I = "." * len(RAVAN_I)
    
    """ No special secondary structure, just a hack to make a connected 
    complex composed of the correct set of strands """
    
    dotparen_I_H1 = '(' + ("." * (len(RAVAN_I) - 1)) + "+" + ')' + ("." * (len(RAVAN_H1) - 1)) 
    dotparen_I_H1_H2 = '(' + ("." * (len(RAVAN_I) - 1)) + "+" + ')' + ("." * (len(RAVAN_H1) - 2)) + "(" + "+" + ")" + ("." * (len(RAVAN_H2) - 1))
    dotparen_H1_H2_H3 = '(' + ("." * (len(RAVAN_H1) - 1)) + "+" + ')' + ("." * (len(RAVAN_H2) - 2)) + '(' + "+" + ')' + ("." * (len(RAVAN_H3) - 1))
    
    if selector == 0:
    
        target_complex = Complex(strands=[strand_H1], structure=dotparen_H1)
        complex_trigger = Complex(strands=[strand_I], structure=dotparen_I)
        
        success_complex = Complex(strands=[strand_I, strand_H1], structure=dotparen_I_H1)

    if selector == 1:

        target_complex = Complex(strands=[strand_I, strand_H1], structure=dotparen_I_H1)
        complex_trigger = Complex(strands=[strand_H2], structure=dotparen_H2)
        
        success_complex = Complex(strands=[strand_I, strand_H1, strand_H2], structure=dotparen_I_H1_H2)

    if selector == 2:

        target_complex = Complex(strands=[strand_I, strand_H1, strand_H2], structure=dotparen_I_H1_H2)
        complex_trigger = Complex(strands=[strand_H3], structure=dotparen_H3)
        
        success_complex = Complex(strands=[strand_H1, strand_H2, strand_H3], structure=dotparen_H1_H2_H3)

    setBoltzmann(complex_trigger, trialsIn)
    setBoltzmann(target_complex, trialsIn)
    
    stopSuccess = StopCondition(Literals.success, [(success_complex, Literals.dissoc_macrostate, 0)])
    stopFailed = StopCondition(Literals.failure, [(complex_trigger, Literals.dissoc_macrostate, 0)])

    # actually set the intial and stopping states    
    options.start_state = [complex_trigger, target_complex]
    options.stop_conditions = [stopSuccess, stopFailed]         
コード例 #10
0
def simulationRickettsia(trialsIn):

    stdOptions = standardOptions(simMode=Literals.first_passage_time,
                                 trials=trialsIn)
    stdOptions.simulation_time = A_TIME_OUT
    stdOptions.DNA23Metropolis()
    stdOptions.temperature = 25.0
    stdOptions.magnesium = 0.0125
    stdOptions.sodium = 0.1

    dom_a = Domain(sequence="ATTCAA", name="a")  # length 6
    dom_b = Domain(sequence="GCGACACCGTGGACGTGC", name="b")  # length 18
    dom_c = Domain(sequence="ACCCAC", name="c")  # length 6

    dom_x = Domain(sequence="GGT", name="x")  # length 3
    dom_y = Domain(sequence="AAC", name="y")  # length 3

    strand_H1 = Strand(domains=[dom_a, dom_b, dom_c, dom_b.C, dom_x.C])
    strand_H2 = Strand(domains=[dom_y.C, dom_b.C, dom_a.C, dom_b, dom_c.C])

    strand_A = Strand(domains=[dom_b.C, dom_a.C])
    strand_B = Strand(domains=[dom_x, dom_b, dom_y])
    strand_R = Strand(domains=[dom_x, dom_b, dom_y])

    H1 = Complex(strands=[strand_H1], structure=".(.).", name="H1")
    H2 = Complex(strands=[strand_H2], structure=".(.).", name="H2")

    #     state1 = Complex(strands=[strand_H1, strand_R, strand_A], structure="((.)*+*(.+))")  # domain x does not have to be bound
    state2 = Complex(strands=[strand_H1, strand_R, strand_A],
                     structure="((.((+)).+))",
                     name="state2")
    state3 = Complex(strands=[strand_H1, strand_R, strand_H2, strand_A],
                     structure="(((((+))(+)(.))+))")
    #     state4 = Complex(strands=[strand_H1, strand_R, strand_H2, strand_A], structure="(((((+)((+)).))+))", name = "state4")
    state5 = Complex(strands=[strand_H1, strand_R, strand_H2, strand_A],
                     structure="((((.+.((+)).))+))",
                     name="state5")
    #     state6 = Complex(strands=[strand_H1, strand_H1, strand_R, strand_H2, strand_A], structure="((((.+((.)*+*((+)))))+))")  # domain x does not have to be bound
    #     state6 = Complex(strands=[strand_H1, strand_H1, strand_R, strand_H2, strand_A], structure="((((.+((.).+.((+)))))+))", name = "state6")

    #     state7 = Complex(strands=[strand_H1, strand_H1, strand_R, strand_H2, strand_A], structure="((((.+((.((+))*+*))))+))", name = "state7")

    stopFailure = StopCondition(Literals.failure,
                                [(state2, Literals.dissoc_macrostate, 0)])
    stopSuccess = StopCondition(Literals.success,
                                [(state5, Literals.loose_macrostate, 6)])

    stdOptions.start_state = [state3]
    stdOptions.stop_conditions = [stopSuccess, stopFailure]

    stdOptions.join_concentration = 0.001

    return stdOptions
コード例 #11
0
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
コード例 #12
0
def simulationYurke2(trialsIn):

    stdOptions = standardOptions(simMode=Literals.first_passage_time,
                                 trials=trialsIn)
    stdOptions.simulation_time = A_TIME_OUT
    stdOptions.DNA23Metropolis()

    domS = Domain(sequence="ACTAATCCTCAGATCCAGCTAGTGTC", name="d_S")
    domD = Domain(sequence="A", name="d_A")
    domT = Domain(sequence="CGTACT", name="d_T")

    strandQ = Strand(domains=[domS, domD])
    strandT = Strand(domains=[domT, domS])
    strandS = strandT.C

    #     complexEndS = Complex(strands=[strandQ], structure="..")
    complexEndF = Complex(strands=[strandT], structure="..")
    complexEndFC = Complex(strands=[strandQ, strandS], structure="(.+).")

    complexAttached = Complex(strands=[strandQ, strandS, strandT],
                              structure="**+*(+)*")

    stopSuccess = StopCondition(
        Literals.success, [(complexAttached, Literals.loose_macrostate, 1)])

    stdOptions.start_state = [complexEndF, complexEndFC]
    stdOptions.stop_conditions = [stopSuccess]

    stdOptions.join_concentration = 0.0001  # 100 microMolar

    return stdOptions
コード例 #13
0
def setup_options_hairpin(trials, stem_seq, hairpin_seq):

    # Define the domains
    stem = Domain(name="stem", sequence=stem_seq, length=len(stem_seq))
    hairpin = Domain(name="hairpin",
                     sequence=hairpin_seq,
                     length=len(hairpin_seq))
    s = stem + hairpin + stem.C

    # We give domain-level structures for the open and closed hairpin configurations
    start_complex = Complex(strands=[s], structure="...")
    stop_complex = Complex(strands=[s], structure="(.)")
    full_sc = StopCondition("CLOSED",
                            [(stop_complex, Literals.exact_macrostate, 0)])
    # Note: unlike in Transition Mode, in First Passage Time Mode, no "stop:" prefix is needed in the macrostate name
    # in order for the StopCondition to trigger the end of the simulation.

    o = Options(simulation_mode="First Passage Time",
                parameter_type="Nupack",
                substrate_type="DNA",
                temperature=310.15,
                num_simulations=trials,
                simulation_time=0.1,
                rate_scaling='Calibrated',
                verbosity=0,
                start_state=[start_complex],
                stop_conditions=[full_sc])

    return o
コード例 #14
0
def create_test0C():

    domain_seq = "AGT"
    domain_seq2 = "GTA"

    left = Domain(name="branch_migration", sequence=domain_seq, seq_length=3)
    right = Domain(name="branch_migration2",
                   sequence=domain_seq2,
                   seq_length=3)

    incoming = left + right
    substrate = incoming.C

    start_complex1 = Complex(strands=[incoming], structure="..")
    start_complex2 = Complex(strands=[substrate], structure="..")
    stop_complex = Complex(strands=[incoming, substrate], structure="((+))")

    full_sc = StopCondition("CLOSED",
                            [(stop_complex, Literals.dissoc_macrostate, 2)])

    o1 = Options(simulation_mode=Literals.first_passage_time,
                 temperature=273.15 + 25.0,
                 num_simulations=10,
                 simulation_time=0.00001,
                 rate_scaling='Calibrated',
                 verbosity=0,
                 join_concentration=1e-9,
                 rate_method="Metropolis",
                 start_state=[start_complex1, start_complex2],
                 stop_conditions=[full_sc])

    return o1
コード例 #15
0
def create_test4():

    toehold_t = "CTGC"
    toehold_dd = "CATATC"
    domain_R = "CATTAAC"

    # build complexes with domain-level information
    toehold = Domain(name="toehold", sequence=toehold_t, length=6)
    toehold_2 = Domain(name="toehold", sequence=toehold_dd, length=6)
    branch_migration = Domain(name="branch_migration",
                              sequence=domain_R,
                              seq_length=7)

    incoming = branch_migration.C + toehold.C
    substrate = toehold + branch_migration

    # Note that "+" is used to indicate strand breaks.
    # So the initial structures represent the incoming strand bound by its toehold,
    # and we'll see that either it completes strand displacement, or it dissociates.
    start_complex = Complex(strands=[incoming, substrate], structure=".(+).")
    stop_complex = Complex(strands=[incoming, substrate], structure="..+..")

    full_sc = StopCondition("CLOSED",
                            [(stop_complex, Literals.dissoc_macrostate, 2)])

    return createOptions(start_complex, stop_complex, "First Passage Time")
コード例 #16
0
def first_step_simulation(strand_seq, trials, T=25, material="DNA"):

    print ("Running %i first step mode simulations for %s (with Boltzmann sampling)..." % (trials, strand_seq))
    
    # Using domain representation makes it easier to write secondary structures.
    onedomain = Domain(name="onedomain", sequence=strand_seq)
    gdomain = Domain(name="gdomain", sequence="TTTT")
    
    top = Strand(name="top", domains=[onedomain])
    bot = top.C
    dangle = Strand(name="Dangle", domains=[onedomain, gdomain])
    
    duplex_complex = Complex(strands=[top, bot], structure="(+)")
    invader_complex = Complex(strands=[dangle], structure="..")
    duplex_invaded = Complex(strands=[dangle, bot], structure="(.+)")
    
    # Declare the simulation complete if the strands become a perfect duplex.
    success_stop_condition = StopCondition(Options.STR_SUCCESS, [(duplex_invaded, Options.exactMacrostate, 0)])
    failed_stop_condition = StopCondition(Options.STR_FAILURE, [(duplex_complex, Options.dissocMacrostate, 0)])
    
    for x in [duplex_complex, invader_complex]:
        
        x.boltzmann_count = trials
        x.boltzmann_sample = True
         
    # the first argument has to be trials.
    def getOptions(trials, material, duplex_complex, dangle, success_stop_condition, failed_stop_condition):
    
        o = Options(simulation_mode="First Step", substrate_type=material, rate_method="Metropolis", 
                    num_simulations=trials, simulation_time=ATIME_OUT, temperature=T)
        
        o.start_state = [duplex_complex, dangle]
        o.stop_conditions = [success_stop_condition, failed_stop_condition]
        
        
        # FD: The result of this script depend significantly on JS or DNA23 parameterization.
        o.unimolecular_scaling = 5.0e6;
        o.bimolecular_scaling = 1.4e6;
        
        return o
    
    myOptions = getOptions(trials,material, duplex_complex, invader_complex, success_stop_condition, failed_stop_condition)
    
    s = SimSystem(myOptions)
    s.start()

    print "debug_mac2 finished running."
コード例 #17
0
def create_options():
  print "creating options..."
  d1 = Domain(name="d1", sequence="GTTGGTTTGTGTTTGGTGGG")
  s1 = Strand(name="s1", domains=[d1])
  c1 = Complex(name="c1", strands=[s1], structure=".")
  c2 = Complex(name="c2", strands=[s1.C], structure=".")
  c3 = Complex(name="c3", strands=[s1, s1.C], structure="(+)")
  
  sc_rev = StopCondition("REVERSE", [(c1, 2, 0), (c2, 2, 0)])
  sc_for = StopCondition("END", [(c3, 4, 6)])
  o = Options(simulation_mode = 'First Step', num_simulations = 100,
              simulation_time = 0.5, start_state = [RestingState("1", [c1]), RestingState("2", [c2])],
              stop_conditions = [sc_rev, sc_for])
  #o.initial_seed = random.SystemRandom().randrange(-2147483648, 2147483647)
  print "finished options. creating simsystem..."
  #print o.interface
  return o
コード例 #18
0
def create_test3():

    strand_seq = "CTGA"
    num_traj = 10

    # Essentially, creates the options object and prepares to simulate the hybridization of the strand and its complement.
    onedomain = Domain(name="itall", sequence=strand_seq)
    top = Strand(name="top", domains=[onedomain])
    bot = top.C

    # Note that the structure is specified to be single stranded, but this will be over-ridden when Boltzmann sampling is turned on.
    start_complex_top = Complex(strands=[top], structure=".")
    start_complex_bot = Complex(strands=[bot], structure=".")
    start_complex_top.boltzmann_count = num_traj
    start_complex_bot.boltzmann_count = num_traj
    start_complex_top.boltzmann_sample = True
    start_complex_bot.boltzmann_sample = True
    # Turns Boltzmann sampling on for this complex and also does sampling more efficiently by sampling 'num_traj' states.

    # Stop when the exact full duplex is achieved. (No breathing!)
    success_complex = Complex(strands=[top, bot], structure="(+)")
    success_stop_condition = StopCondition(
        "SUCCESS", [(success_complex, Literals.exact_macrostate, 0)])

    # Declare the simulation unproductive if the strands become single-stranded again.
    failed_complex = Complex(strands=[top], structure=".")
    failed_stop_condition = StopCondition(
        "FAILURE", [(failed_complex, Literals.dissoc_macrostate, 0)])

    o = Options(simulation_mode="First Step",
                parameter_type="Nupack",
                substrate_type="DNA",
                rate_method="Metropolis",
                num_simulations=num_traj,
                simulation_time=1.0,
                dangles="Some",
                temperature=273.15 + 25.0,
                rate_scaling="Calibrated",
                useArrRates=True,
                verbosity=0)

    o.start_state = [start_complex_top, start_complex_bot]
    o.stop_conditions = [success_stop_condition, failed_stop_condition]
    return o
コード例 #19
0
def calculateGateInputRate(gate_complex, input_complex, output_complex, trials=INCREMENT_TRIALS,  alt_output_complex=None):
    success_stop_condition = StopCondition(
        Options.STR_SUCCESS, [(output_complex, Options.dissocMacrostate, 0)])
    failed_stop_condition = StopCondition(
        Options.STR_FAILURE, [(input_complex, Options.dissocMacrostate, 0)])

    
    try:
        if alt_output_complex is None:
            raise TypeError
        alt_success_stop_condition = StopCondition(
            Options.STR_ALT_SUCCESS, [(output_complex, Options.dissocMacrostate, 0)])
        myMultistrand.setOptionsFactory6(getOptions, trials, DNA,
                                         gate_complex, input_complex,
                                         [success_stop_condition,
                                             alt_success_stop_condition],
                                         [failed_stop_condition])
    except TypeError:
        myMultistrand.setOptionsFactory6(getOptions, trials, DNA, gate_complex, input_complex, [
                                         success_stop_condition], [failed_stop_condition])

    return getRates()
コード例 #20
0
def hybridization(options, mySeq, myTrials=0, doFirstPassage=False):

    # Using domain representation makes it easier to write secondary structures.
    onedomain = Domain(name="itall", sequence=mySeq)
    top = Strand(name="top", domains=[onedomain])
    bot = top.C

    # Note that the structure is specified to be single stranded, but this will be over-ridden when Boltzmann sampling is turned on.
    startTop = Complex(strands=[top], structure=".")
    startBot = Complex(strands=[bot], structure=".")

    # Turns Boltzmann sampling on for this complex and also does sampling more efficiently by sampling 'trials' states.
    if (myTrials > 0):
        setBoltzmann(startTop, myTrials)
        setBoltzmann(startBot, myTrials)

    # Stop when the exact full duplex is achieved.
    success_complex = Complex(strands=[top, bot], structure="(+)")
    stopSuccess = StopCondition(
        Options.STR_SUCCESS, [(success_complex, Options.exactMacrostate, 0)])

    # Declare the simulation unproductive if the strands become single-stranded again.
    failed_complex = Complex(strands=[top], structure=".")
    stopFailed = StopCondition(Options.STR_FAILURE,
                               [(failed_complex, Options.dissocMacrostate, 0)])

    options.start_state = [startTop, startBot]

    # Point the options to the right objects
    if not doFirstPassage:

        options.stop_conditions = [stopSuccess, stopFailed]

    else:

        options.stop_conditions = [stopSuccess]
コード例 #21
0
def getOptions(arguments):

    o = standardOptions()
    o.simulation_mode = Literals.trajectory
    o.num_simulations = 80

    o.temperature = 30.0
    o.simulation_time = 0.0000001

    endComplex = arguments[0]

    stopSuccess = StopCondition(Literals.success,
                                [(endComplex, Literals.exact_macrostate, 0)])
    o.stop_conditions = [stopSuccess]

    return o
コード例 #22
0
def createOptions(start_complex, stop_complex, simMode):

    full_sc = StopCondition("CLOSED", [(stop_complex, Options.dissocMacrostate, 2)])    
    
    o1 = Options(simulation_mode=simMode,  # "First Passage Time", 
                 parameter_type="Nupack", substrate_type="DNA", temperature=273.15 + 25.0,
                num_simulations=10,
                simulation_time=0.00001,
                rate_scaling='Calibrated',
                verbosity=0,
                join_concentration=1e-9,
                rate_method="Metropolis",
                start_state=[start_complex],
                stop_conditions=[full_sc])
   

    
    return o1
コード例 #23
0
def hairpinopening(options, stemSeq, loopSeq, myTrials=0):

    # Using domain representation makes it easier to write secondary structures.
    stemdomain1 = Domain(name="stemdomain1", sequence=stemSeq)
    loopdomain = Domain(name="loopdomain", sequence=loopSeq)
    stemdomain2 = stemdomain1.C

    strand = Strand(name="top", domains=[stemdomain1, loopdomain, stemdomain2])
    start_complex = Complex(strands=[strand], structure="(.)")
    success_complex = Complex(strands=[strand], structure="...")

    # N.B.: myTrials input signature is considered "default",
    # but in no circumstance will we enable Boltzmann sampling

    # Stop when the exact full duplex is achieved.
    stopSuccess = StopCondition(
        Literals.success, [(success_complex, Literals.exact_macrostate, 0)])

    options.start_state = [start_complex]
    options.stop_conditions = [stopSuccess]
コード例 #24
0
    def getOptions(arguments):
         
        o = standardOptions()
        o.simulation_mode = Literals.trajectory
        o.num_simulations = B_MULT * form_f["trajectories"]

        o.sodium = form_f['sodium']
        o.magnesium = form_f['magnesium']
        o.temperature = float(form_f['temperature'])
        o.simulation_time = BUILDER_TIMEOUT 
        
        if "RNA" == form_f['substrate']:
            o.substrate_type = Literals.substrateRNA
        
        endComplex = arguments[0]
        
        stopSuccess = StopCondition(Literals.success, [(endComplex, Literals.exact_macrostate, 0)])
        o.stop_conditions = [stopSuccess]
        
        return o
コード例 #25
0
def create_setup(trials, toehold_seq, toehold_seq2, domain_seq):

    # build complexes with domain-level information

    toehold = Domain(name="toehold",
                     sequence=toehold_seq,
                     length=len(toehold_seq2))
    toehold_2 = Domain(name="toehold",
                       sequence=toehold_seq2,
                       length=len(toehold_seq2))
    branch_migration = Domain(name="branch_migration",
                              sequence=domain_seq,
                              seq_length=len(domain_seq))

    incoming = branch_migration.C + toehold.C
    substrate = toehold + branch_migration + toehold_2
    incumbent = Strand(name="incumbent",
                       domains=[toehold_2.C, branch_migration.C])

    # Note that "+" is used to indicate strand breaks.
    # So the initial structures represent the incoming strand bound by its toehold,
    # and we'll see that either it completes strand displacement, or it dissociates.
    start_complex = Complex(strands=[incoming, substrate, incumbent],
                            structure=".(+)((+))")
    stop_complex = Complex(strands=[incoming, substrate, incumbent],
                           structure="((+))(+).")
    full_sc = StopCondition("CLOSED",
                            [(stop_complex, Literals.exact_macrostate, 0)])

    o1 = Options(simulation_mode="First Passage Time",
                 parameter_type="Nupack",
                 substrate_type="DNA",
                 temperature=273.15 + 25.0,
                 num_simulations=trials,
                 simulation_time=0.0001,
                 rate_scaling='Calibrated',
                 verbosity=0,
                 start_state=[start_complex],
                 stop_conditions=[full_sc])

    return o1
コード例 #26
0
def dissociation(options, mySeq, myTrials=0):

    # Using domain representation makes it easier to write secondary structures.
    onedomain = Domain(name="itall", sequence=mySeq)
    top = Strand(name="top", domains=[onedomain])
    bot = top.C

    # Note that the structure is specified to be single stranded, but this will be over-ridden when Boltzmann sampling is turned on.
    duplex = Complex(strands=[top, bot], structure="(+)")

    # Turns Boltzmann sampling on for this complex and also does sampling more efficiently by sampling 'trials' states.
    if (myTrials > 0):
        setBoltzmann(duplex, myTrials)

    # Stop when the strands fall apart.
    successComplex = Complex(strands=[top], structure=".")
    stopSuccess = StopCondition(
        Options.STR_SUCCESS, [(successComplex, Options.dissocMacrostate, 0)])

    options.start_state = [duplex]
    options.stop_conditions = [stopSuccess]
コード例 #27
0
def associationNoInit(arguments):

    stdOptions = standardOptions()
    stdOptions.simulation_mode = Literals.trajectory
    stdOptions.verbosity = True

    stdOptions.num_simulations = arguments[0]
    stdOptions.temperature = arguments[1]
    stdOptions.join_concentration = arguments[2]

    endComplex = arguments[3]

    stdOptions.simulation_time = A_TIME_OUT

    stopSuccess = StopCondition(Literals.success,
                                [(endComplex, Literals.exact_macrostate, 0)])
    stdOptions.stop_conditions = [stopSuccess]

    #     stdOptions.DNA23Arrhenius()

    return stdOptions
コード例 #28
0
def doReaction(arguments):
    # the first argument is always the number of paths
    options = Options(trials=arguments[0])
    #options.output_interval = 1 # do not uncomment ---> might get memory issues
    options.num_simulations = arguments[0]
    options.simulation_time = arguments[1]
    options.sodium = arguments[5]
    options.magnesium = arguments[6]
    options.temperature = arguments[9] + arguments[10]
    options.join_concentration = arguments[12] * arguments[11]
    if arguments[13] == Literals.metropolis:
        set_Metropolis_params(options, arguments[7])
    elif arguments[13] == Literals.arrhenius:
        set_Arrhenius_params(options, arguments[7])
    options.simulation_mode = Literals.trajectory
    if arguments[14] == True:
        endComplex1 = arguments[15][-1][0]
        stopSuccess = StopCondition(
            Literals.success, [(endComplex1, Literals.exact_macrostate, 0)])
        options.stop_conditions = [stopSuccess]
        if use_Gillespie_MFPT == True:
            options.start_state = arguments[15][0]
    return options
コード例 #29
0
def changeComplex(options, expirement_type=NORMAL, trials=500):
    # Easiest to use full dot paren here
    # See SI Document for these sequences and lengths!
    toehold_length = 7
    h_length = 15

    helper = Strand(name="Helper_AAq",
                    sequence="TTTCCTAATCCCAATCAACACCTTTCCTA")
    produce_bot = Strand(
        name="Produce_BOT_CApAq",
        sequence="GTAAAGACCAGTGGTGTGAAGATAGGAAAGGTGTTGATTGGGATTAGGAAACC")
    ap = Strand(name="ap",
                sequence="CATCACTATCAATCATACATGGTTTCCTATCTTCACACCACTGG")
    aq = Strand(name="aq",
                sequence="CATCACTATCAATCATACATGGTTTCCTAATCCCAATCAACACC")

    # Offset of two to account for clamp domains
    produce_struct = "." * toehold_length + "(" * (
        len(produce_bot.sequence) -
        toehold_length) + "+" + '.' * (toehold_length + h_length - 2) + ')' * (
            len(ap.sequence) - toehold_length - h_length + 2) + "+" + '.' * (
                toehold_length + h_length) + ')' * (len(ap.sequence) -
                                                    toehold_length - h_length)

    if expirement_type == WITHOUT_GG:
        ap = Strand(name="ap",
                    sequence="CATCACTATCAATCATACATTTTCCTATCTTCACACCACTGG")

        # bot, aq, ap
        # Offsets due to a) clamp domains b) two b.p. removal
        produce_struct = "." * toehold_length + "(" * (
            len(produce_bot.sequence) - toehold_length) + "+" + '.' * (
                toehold_length + h_length - 2) + ')' * (
                    len(ap.sequence) - toehold_length - h_length +
                    4) + "+" + '.' * (toehold_length + h_length - 2) + ')' * (
                        len(ap.sequence) - toehold_length - h_length + 2)

    elif expirement_type == WITHOUT_G:
        ap = Strand(name="ap",
                    sequence="CATCACTATCAATCATACATGTTTCCTATCTTCACACCACTGG")

        # bot, aq, ap
        # Offsets due to a) clamp domains b) one b.p. removal
        produce_struct = "." * toehold_length + "(" * (
            len(produce_bot.sequence) - toehold_length) + "+" + '.' * (
                toehold_length + h_length - 2) + ')' * (
                    len(ap.sequence) - toehold_length - h_length +
                    3) + "+" + '.' * (toehold_length + h_length - 1) + ')' * (
                        len(ap.sequence) - toehold_length - h_length + 1)

    elif expirement_type == HELPER_WITHOUT_CC:
        # only modify helper sequence here - remove the two 3' most 'C'.
        helper = Strand(name="Helper_AAq",
                        sequence="TTTCCTAATCCCAATCAACACCTTTTA")

        # No change required elsewhere -  we check for the release of strands rather than the complicated
        # leak complex formed for simplicity. We should really check for ANY free strands here i.e. Ap OR Aq
        # but it is hard to imagine a mechanism which results in the release of Ap in this simulation

    produce_complex = Complex(name="produce",
                              strands=[produce_bot, aq, ap],
                              structure=produce_struct)
    helper_complex = Complex(name="helper",
                             strands=[helper],
                             structure='.' * len(helper.sequence))
    leak_complex = Complex(name="leak",
                           strands=[aq],
                           structure='.' * len(aq.sequence))

    if trials > 0:
        setBoltzmann(produce_complex, trials, 75)
        setBoltzmann(helper_complex, trials, 75)

    success_stop_cond = StopCondition(
        Literals.success, [(leak_complex, Options.dissoc_macrostate, 0)])
    # the leak has failed if we end up with our initial complexes again.
    # check if we end up with a free helper complex
    failure_stop_cond = StopCondition(
        Literals.failure, [(helper_complex, Options.dissoc_macrostate, 0)])

    options.start_state = [produce_complex, helper_complex]
    options.stop_conditions = [success_stop_cond, failure_stop_cond]
コード例 #30
0
def machinek2014(options, selector, trialsIn):
    # we only allow first step mode at this point.

    # these are the sequences we need to build the dot-parens
    incumbent = ""
    target = ""
    invader = ""

    toeholdSelect = selector / 12
    mismatchSelect = selector % 12

    positionSelector = [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14]
    mismatchSelect = positionSelector[mismatchSelect]

    # decide on toehold sequence
    toeholdSeq = "ATGTGG"  # 6 nt toehold option

    if toeholdSelect == 1:
        toeholdSeq = "ATGTGGA"  # 7 nt toehold option
    if toeholdSelect == 2:
        toeholdSeq = "ATGTGGAGGG"  # 10 nt toehold option

    # determine the incumbent, target and invader sequences
    # FD: copy-pasting supplementary Table 6 directly

    if mismatchSelect == 0 or mismatchSelect == 2 or mismatchSelect == 12 or mismatchSelect == 14:
        incumbent = "TGGTGTTTGTGGGTGTGGTGAGTTTGAGGTTGA"
        target = "CCCTCCACATTCAACCTCAAACTCACC"

        if mismatchSelect == 0:  # perfect
            invader = "GGTGAGTTTGAGGTTGA"

        if mismatchSelect == 2:
            invader = "GGTGAGTTTGAGGTTCA"

        if mismatchSelect == 12:
            invader = "GGTGACTTTGAGGTTGA"

        if mismatchSelect == 14:
            invader = "GGTCAGTTTGAGGTTGA"

    if mismatchSelect == 3:
        incumbent = "TGGTGTTTGTGGGTGTGGTGAGTTTGAGGTGAT"
        target = "CCCTCCACATATCACCTCAAACTCACC"
        invader = "GGTGAGTTTGAGGTCAT"

    if mismatchSelect == 4:
        incumbent = "TGGTGTTTGTGGGTGTGGTGAGTTTGAGTGAGT"
        target = "CCCTCCACATACTCACTCAAACTCACC"
        invader = "GGTGAGTTTGAGTCAGT"

    if mismatchSelect == 5:
        incumbent = "TGGTGTTTGTGGGTGTGGTGAGTTTGATGAGGT"
        target = "CCCTCCACATACCTCATCAAACTCACC"
        invader = "GGTGAGTTTGATCAGGT"

    if mismatchSelect == 6:
        incumbent = "TGGTGTTTGTGGGTGTGGTGAGTTTGTGAAGGT"
        target = "CCCTCCACATACCTTCACAAACTCACC"
        invader = "GGTGAGTTTGTCAAGGT"

    if mismatchSelect == 7:
        incumbent = "TGGTGTTTGTGGGTGTGGTGAGTTTTGAGAGGT"
        target = "CCCTCCACATACCTCTCAAAACTCACC"
        invader = "GGTGAGTTTTCAGAGGT"

    if mismatchSelect == 8:
        incumbent = "TGGTGTTTGTGGGTGTGGTGAGTTTGATGAGGT"
        target = "CCCTCCACATACCTCATCAAACTCACC"
        invader = "GGTGAGTTTCATGAGGT"

    if mismatchSelect == 9:
        incumbent = "TGGTGTTTGTGGGTGTGGTGAGTTGATTGAGGT"
        target = "CCCTCCACATACCTCAATCAACTCACC"
        invader = "GGTGAGTTCATTGAGGT"

    if mismatchSelect == 10:
        incumbent = "TGGTGTTTGTGGGTGTGGTGAGTGATTTGAGGT"
        target = "CCCTCCACATACCTCAAATCACTCACC"
        invader = "GGTGAGTCATTTGAGGT"

    invader = invader + toeholdSeq

    # set up the actual complexes
    strandIncumbent = Strand(name="incumbent", sequence=incumbent)
    strandTarget = Strand(name="target", sequence=target)
    strandInvader = Strand(name="invader", sequence=invader)

    intialDotParen = '.' * 16 + '(' * 17 + "+" + '.' * 10 + ')' * 17
    intialInvaderDotParen = '.' * len(invader)
    successDotParen = '.' * 33

    initialComplex = Complex(strands=[strandIncumbent, strandTarget],
                             structure=intialDotParen)
    initialInvader = Complex(strands=[strandInvader],
                             structure=intialInvaderDotParen)
    successComplex = Complex(strands=[strandIncumbent],
                             structure=successDotParen)

    # Turns Boltzmann sampling on for this complex and also does sampling more efficiently by sampling 'trials' states.
    if (trialsIn > 0):
        setBoltzmann(initialComplex, trialsIn)
        setBoltzmann(initialInvader, trialsIn)
        initialComplex.boltzmann_supersample = 25
        initialInvader.boltzmann_supersample = 25

    stopSuccess = StopCondition(
        Options.STR_SUCCESS, [(successComplex, Options.dissocMacrostate, 0)])
    stopFailed = StopCondition(Options.STR_FAILURE,
                               [(initialComplex, Options.dissocMacrostate, 0)])

    # actually set the intial and stopping states
    options.start_state = [initialComplex, initialInvader]
    options.stop_conditions = [stopSuccess, stopFailed]