コード例 #1
0
def doFirstPassageTimeAssocation(seq, concentrations, T=20, numOfRuns=500):

    # for each concentration z, do one "first passage time" run for association, and get k_eff(z)
    Result = []
    times = list()

    for concentration in concentrations:

        myRates = first_passage_association(seq,
                                            numOfRuns,
                                            concentration=concentration,
                                            T=T)
        keff = myRates.log10KEff(concentration)

        myBootstrap = Bootstrap(myRates, concentration)
        low, high = myBootstrap.ninetyFivePercentiles()
        logStd = myBootstrap.logStd()

        Result.append((keff, np.log10(low), np.log10(high), logStd))
        times.append((np.log10(myMultistrand.runTime), 0.0, 0.0))

        print "keff = %g /M/s at %s" % (keff,
                                        concentration_string(concentration))

    print

    return Result, times
コード例 #2
0
def doFirstStepMode(seq, concentrations, T=20.0, numOfRuns=500):

    # track time for each kind of simulation, using time.time(), which has units of second
    # do one "first step mode" run, get k1, k2, etc, from which z_crit and k_eff(z) can be computed

    myMultistrand = first_step_simulation(seq, numOfRuns, T=T)
    myRates = myMultistrand.results

    #     print myRates.dataset

    time2 = time.time()
    print str(myRates)

    FSResult = list()

    for z in concentrations:

        kEff = myRates.kEff(z)

        myBootstrap = Bootstrap(myRates,
                                N=BOOTSTRAP_RESAMPLE,
                                concentration=z,
                                computek1=False)

        low, high = myBootstrap.ninetyFivePercentiles()
        logStd = myBootstrap.logStd()

        print "keff = %g /M/s at %s" % (kEff, concentration_string(z))

        myResult = (np.log10(kEff), np.log10(low), np.log10(high), logStd)
        FSResult.append(myResult)

    print

    # call NUPACK for pfunc dG of the reaction, calculate krev based on keff
    print "Calculating dissociate rate constant based on NUPACK partition function energies and first step mode k_eff..."

    dG_top = nupack.pfunc([seq], T=T)
    dG_bot = nupack.pfunc([Strand(sequence=seq).C.sequence], T=T)
    dG_duplex = nupack.pfunc([seq, Strand(sequence=seq).C.sequence], T=T)
    RT = 1.987e-3 * (273.15 + T)
    time3 = time.time()
    time_nupack = time3 - time2
    krev_nupack = kEff * np.exp((dG_duplex - dG_top - dG_bot) / RT)
    print "krev = %g /s (%g seconds)" % (krev_nupack, time_nupack)

    times = list()
    for i in concentrations:
        myTime = (np.log10(myMultistrand.runTime), 0.0, 0.0)
        times.append(myTime)

    return FSResult, times
コード例 #3
0
def fluffyPlot(ax, seqs, concentrations):

    myXTicks = list()
    for conc in concentrations:
        myXTicks.append(concentration_string(conc))

    plt.xticks(rotation=-40)
    plt.xticks(np.log10(concentrations), myXTicks)

    plt.gca().invert_xaxis()
    ax.set_xlabel('Concentration')

    # Shrink current axis by 20%
    box = ax.get_position()
    ax.set_position(
        [box.x0, box.y0 + box.height * 0.2, box.width * 0.8, 0.8 * box.height])

    ax.legend(seqs, loc='center left', bbox_to_anchor=(1, 0.5))
コード例 #4
0
def first_passage_association(strand_seq, trials, concentration, T=20.0):

    print "Running first passage time simulations for association of %s at %s..." % (
        strand_seq, concentration_string(concentration))

    def getOptions(trials):

        o = standardOptions(Options.firstPassageTime, TEMPERATURE, trials,
                            ATIME_OUT)

        hybridization(o, strand_seq, trials, True)
        setSaltGao2006(o)
        o.join_concentration = concentration

        return o

    myMultistrand.setOptionsFactory1(getOptions, trials)
    myMultistrand.setPassageMode()
    myMultistrand.run()

    return myMultistrand.results
コード例 #5
0
def doFirstPassageTimeAssocation(seq, concentrations, T=20, numOfRuns=500):

    # for each concentration z, do one "first passage time" run for association, and get k_eff(z)
    Result = []
    times = list()

    for concentration in concentrations:

        if len(seq) > 10 and concentration < 1e-5:

            keff = 5.5
            low = 1e+5
            high = 1e+6
            logStd = -1.0

        else:

            myMultistrand = first_passage_association(
                seq, numOfRuns, concentration=concentration, T=T)
            myRates = myMultistrand.results

            #             print myRates.dataset

            keff = myRates.log10KEff(concentration)

            myBootstrap = Bootstrap(myRates,
                                    N=BOOTSTRAP_RESAMPLE,
                                    concentration=concentration)
            low, high = myBootstrap.ninetyFivePercentiles()
            logStd = myBootstrap.logStd()

        Result.append((keff, np.log10(low), np.log10(high), logStd))
        times.append((np.log10(myMultistrand.runTime), 0.0, 0.0))

    print "keff = %g /M/s at %s" % (keff, concentration_string(concentration))

    return Result, times
コード例 #6
0
def first_passage_association(strand_seq, trials, concentration, T=20.0):

    thisMS = MergeSim()
    thisMS.setNumOfThreads(8)
    print "Running first passage time simulations for association of %s at %s..." % (
        strand_seq, concentration_string(concentration))

    def getOptions(trials):

        o = standardOptions(Literals.first_passage_time, TEMPERATURE, trials,
                            ATIME_OUT)

        hybridization(o, strand_seq, trials, True)
        setSaltGao2006(o)
        o.join_concentration = concentration
        o.DNA23Metropolis()

        return o

    thisMS.setOptionsFactory1(getOptions, trials)
    thisMS.setPassageMode()
    thisMS.run()

    return thisMS