I knocked up some crude wrappers so I could simulate expected RD behaviour under a variety of conditions (see attached file). Use as follows:


'''prototype script for relaxation dispersion sims'''
from os import sys
sys.path.append('DIRECTORY_WHERE_YOU_SAVED_RDfunctions.py')

from RDfunctions import *

# binding parameters. P for macromolecule, A for ligand.
kon = 1e3
concP = 1e-3
concA = 1e-3
Kd = 160e-6

# shift change parameters 60 Hz = 1 ppm at 15N freq on 600 MHz
dw = 60

# intrinsic R2 value
R20=10.0

#one curve
simulateRDCurve(kon, concP, concA, Kd, dw, R20)

#specifying cpmg_fields
simulateRDCurve(kon, concP, concA, Kd, dw, R20, cpmg_fields=range(50,1001,50))


# loop to plot curves at different Kds
for Kd in range(3,12):
  simulateRDCurve(kon, concP, concA, 10**(-Kd), dw, R20)

#focus on a subplot and fix the axes
plt.subplot(2,1,1) # focus on R2eff plot
plt.axis([None,None,0,12]) # leave x axis alone and set y to 0 to 12
plt.subplot(2,1,2) # focus on I/I0 plot
plt.axis([None,None,0,0.5]) # leave x axis alone and set y to 0 to 12



Dr. Brian O. Smith --------------------------- Brian Smith at glasgow ac uk
Institute of Molecular, Cell and Systems Biology & School of Life Sciences,
          College of Medical, Veterinary & Life Sciences,
  Joseph Black Building, University of Glasgow, Glasgow G12 8QQ, UK.
Tel: 0141 330 5167/6459/3089                        Fax: 0141 330 4600
----------------------------------------------------------------------
The University of Glasgow, charity number SC004401


from os import sys
from math import sqrt
from pylab import *

sys.path.append('/usr/share/nessy')
from math_fns.models import model_1, model_2, model_3, model_4, model_5

def generateR2effs(model, cpmg_fields, parameters):
      
      y_values=[]
      
      for y in range(0, len(cpmg_fields)):
        if (cpmg_fields[y] == 0):
          y_values.append(parameters[0])
        elif (model == 'model_2'):
          R2eff = model_2(float(cpmg_fields[y]), parameters)
          y_values.append(R2eff)
        elif (model == 'model_3'):
          R2eff = model_3(float(cpmg_fields[y]), parameters)
          y_values.append(R2eff)
      
      return [cpmg_fields, y_values]

def generateIs(model, cpmg_fields, cpmg_delay, parameters):
      
      y_values=[]
      
      for y in range(0, len(cpmg_fields)):
        if (cpmg_fields[y] == 0):
          y_values.append(1.0)
        elif(model == 'model_2'):
          R2eff = model_2(float(cpmg_fields[y]), parameters)
          y_value = 1.0 / exp(R2eff*cpmg_delay)
          y_values.append(y_value)
        elif (model == 'model_3'):
          R2eff = model_3(float(cpmg_fields[y]), parameters)
          y_value = 1.0 / exp(R2eff*cpmg_delay)
          y_values.append(y_value)
      
      return [cpmg_fields, y_values]


def complexConc(Ptot, Atot, Kd):
      '''Class to calculate concentration of a complex given total 
concentrations of
      the components and the dissociation constant
      
      [PA] = (1/2)(([Ptot] + [Atot] + Kd) +- (([Ptot] + [Atot] + Kd)^2 - 
4[Ptot][Atot])^(1/2))
      '''
      
      # Parameters
      
      b = (Ptot + Atot + Kd)
      PA = 0.5 * (b - sqrt(b**2 - 4*Ptot*Atot))
      
      return PA

def boundFraction(Ptot, Atot, Kd):
      '''Class to calculate fractional saturation of a macromolecule given 
total concentrations of
      the components and the dissociation constant
      
      [PA]/([PA]+[P])
      '''
      
      PA = complexConc(Ptot, Atot, Kd)
      bF = PA / Ptot
      
      return bF

def plotRDCurve(kex, dw, pa, R20, cpmg_delay=0.08, 
cpmg_fields=range(0,2001,10)):
      #relaxation parameters
      R20 = 10

      # paramters in relaxation dispersion terminology
      # pa for bound state
      pb = (1 - pa)

      # fast 2 site exchange
      phi = pa * pb * dw**2

      # slow 2 site exchange - nessy model 3 calculates these for itslf
      #psi = kex**2 - dw**2
      #eta = -2*dw*(pa*kex - pb*kex)

      pfast = [R20,phi,kex]
      pslow = [R20,kex,dw,pb]

      if (kex >= 10*dw):
        print 'fast'
        model = 'model_2'
        R2plot = generateR2effs(model, cpmg_fields, pfast)
        ax1 = plt.subplot(2,1,1)
        plt.xlabel('vCPMG')
        plt.ylabel('R2eff')
        plot(R2plot[0][1:],R2plot[1][1:])
        ax2 = plt.subplot(2,1,2, sharex=ax1)
        plt.xlabel('vCPMG')
        plt.ylabel('I/I0')
        I2plot = generateIs(model, cpmg_fields, cpmg_delay, pfast)
        plot(I2plot[0][1:],I2plot[1][1:])
        show()
      elif (kex <= 0.1*dw):
        print 'slow'
        model = 'model_3'
        R2plot = generateR2effs(model, cpmg_fields, pslow)
        ax1 = plt.subplot(2,1,1)
        plt.xlabel('vCPMG')
        plt.ylabel('R2eff')
        plot(R2plot[0][1:],R2plot[1][1:])
        ax2 = plt.subplot(2,1,2, sharex=ax1)
        plt.xlabel('vCPMG')
        plt.ylabel('$I/I_{0}$')
        I2plot = generateIs(model, cpmg_fields, cpmg_delay, pslow)
        plot(I2plot[0][1:],I2plot[1][1:])
        show()
      else:
        print 'intermediate'

def simulateRDCurve(kon, concP, concA, Kd, dw, R20, cpmg_delay=0.08, 
cpmg_fields=range(0,2001,10)):
      koff = Kd * kon
      pa = boundFraction(concP, concA, Kd)

      # rates in relaxation dispersion terminology
      kab = kon
      kba = koff
      kex = kab + kba
      
      plotRDCurve(kex, dw, pa, R20, cpmg_delay, cpmg_fields)


_______________________________________________
Nessy-users mailing list
[email protected]
https://mail.gna.org/listinfo/nessy-users

Reply via email to