示例#1
0
 def titDBUtils(self, DB=None, col=None, prot=None, a=None, E=None,
                 refit=False, addmeta=False, getexperrs=False,
                 yuncert=None):
     """Add some meta and refit all for an ekin prj or a rec/field in db"""
     if E==None and DB != None:
         E = DB[prot][col]
         E.checkDatasets()
     t = TitrationAnalyser()
     if refit == True:
         models = ['Linear', '1 pKa 2 Chemical shifts',
                     '2 pKas, 3 Chemical shifts',
                     '3 pKas, 4 Chemical shifts']
         E = t.findBest(E, models, geterrs=False)
     if addmeta == True:
         E = t.setMetaInfo(E, atom=a)
     if getexperrs == True:
         if yuncert == None:
             print 'No value for Y uncertainty!, please supply it'
             return
         print 'Using %s for y uncertainty.' %yuncert
         print
         E = t.getExpErrs(E, xuncert=0.1, yuncert=yuncert)
     self.save(DB, col, prot, E)
     #DB.commit('refit/added meta info')
     return E
示例#2
0
 def analysepKas(self, p=None):
     """Get the main pKas of all/titr group and do analysis"""
     E = self.currprj
     if E==None: return
     t = TitrationAnalyser()
     if p == None:
         p = t.findpKas(E, titratable=True, reliable=False, minspan=0.06)
     t.analysepKas(p)
     return
示例#3
0
文件: titdb.py 项目: yongwangCPH/peat
 def showSummary(self):
     from PEATDB.Ekin.Titration import TitrationAnalyser
     self.showHeader(menu=1)
     DB = self.DB = self.connect()
     sys.stdout.flush()
     t = TitrationAnalyser()
     ekindata = t.getEkinDicts(DB)
     print '<div class="main">'
     t.dotitDBStats(ekindata)
     print '</div>'
     return
示例#4
0
    def analyseTitDB(self, DB, col, names=None):
        """Extract titdb pKas"""
        import matplotlib.pyplot as plt
        plt.rc('font',size=28)
        plt.rc('savefig',dpi=300)
        plt.rc('axes',linewidth=.5)
        #plt.rc('text',usetex=True)

        nuclnames = {'1H NMR':'H','15N NMR':'N'}
        t = TitrationAnalyser()
        #extract reliable pkas from selected proteins
        #p = t.extractpKas(DB, col, names=names, titratable=False, reliable=False, minspan=0.06)
        #t.analysepKas(p)
        t.compareNuclei(DB, '15N NMR', '1H NMR', names=names, titratable=True)

        return
示例#5
0
 def addpKaTables(self, DB, names, col='1H NMR'):
     """Create labbook tables for 'real' pKas for required proteins"""
     t = TitrationAnalyser()
     prots = t.getProtNames(DB)
     for name in names:
         recname = DB.getRecordName(name)
         E = DB[recname][col]
         titrresidues = t.getResidues(E, titratable=True)
         S = DB.createLabbookSheet(name+'.pKas')
         for r in titrresidues:
             d, res, resnum = r
             pKa = ''
             S.addRecord(res+resnum,pka=pKa,resname=res,
                         resnum=resnum,error='')
         DB.saveLabbook(name+'.pKas', S)
     DB.saveLabbooktoFile('titdb.labbook')
     return
示例#6
0
文件: titdb.py 项目: yongwangCPH/peat
    def showAnalysis(self):
        """Analysis of current pKas"""
        from PEATDB.Ekin.Titration import TitrationAnalyser
        self.showHeader(menu=1)
        DB = self.DB = self.connect()
        t = TitrationAnalyser()

        print '<div class="main">'
        print '<p>Selected plots below reflect some of the analysis shown in the \
               <a href="%s/paper_2010.pdf"> original paper</a> updated for the current dataset. </p>' %self.bindir
        print '<a>The distributions shown are of the change in chemical shift over all\
                detected titrations. `Reliable` pKas are those associated with\
                the largest chemical shift changes in a titration curve and that meets the criteria defined in\
                the paper. We define primary pKa values simply as the subset of the reliable pKa values \
                that originate from titration curves with with only one titration.</a>'
        sys.stdout.flush()

        colnames = ['1H NMR','15N NMR','13C NMR']

        for col in colnames:
            p = t.extractpKas(DB,col,silent=True,minspan=0.06)
            print '<div>'
            print "<h2>%s: Distribution of &Delta;&delta; for fitted pKa values</h2>" %col
            img1 = t.analysepKas(p, silent=True, prefix=col, path=self.imagepath)
            #t.makepKasTable(p)
            print '<img src="%s/%s" align=center width=800 class="plot">' %(self.plotsdir, img1)
            print '</div>'
            sys.stdout.flush()

        #compare nuclei
        img2, img3 = t.compareNuclei(DB, '15N NMR', '1H NMR', titratable=False, silent=True, path=self.imagepath)
        print '<p>Below is an analysis of the correspondence between fitted pKas for 1H and 15N \
                where they are available for the same residue in the same protein. This is the same\
                plot as figure 4 in the original paper updated for the current dataset.\
                The plots are divided into reliable and other pKas for comparison.</p>'
        print '<div>'
        print '<center><img src="%s/%s" align=center width=600 class="plot"></center>' %(self.plotsdir, img2)
        print '</div>'
        print '<p>The same plot as above broken down by residue type and shown only for titratable\
                residues.</p>'
        print '<div>'
        print '<center><img src="%s/%s" align=center width=600 class="plot"></center>' %(self.plotsdir, img3)
        print '</div>'

        self.footer()
        return
示例#7
0
文件: titdb.py 项目: yongwangCPH/peat
    def showDownloads(self):
        """Downloads links"""
        self.showHeader(menu=1)
        print '<div class="main">'
        print '<h2>Downloads</h2>'
        print '<h3>The entire dataset may be downloaded in text format as a single zip file.</h3>'
        print
        #print '<p>Exporting current data, please wait a moment...</p>'
        sys.stdout.flush()

        DB = self.DB = self.connect()
        from PEATDB.Ekin.Titration import TitrationAnalyser
        t = TitrationAnalyser()
        filename = t.exportAll(DB)
        print '<h2><a href="%s/%s"> download zip</a></h2>' %(self.bindir,os.path.basename(filename))
        print '</div>'
        self.footer()
        return
示例#8
0
from PEATDB.Ekin.Titration import TitrationAnalyser
from PEATDB.Base import PDatabase
from PEATDB.Ekin.Base import EkinProject
from PEATDB.DictEdit import DictEditor
import os
import pickle

cols =  ['15N NMR', '1H NMR']
nuclnames = {'1H NMR':'H','15N NMR':'N'}
complete = ['HEWL', 'Bovine Beta-Lactoglobulin',
                'Plastocyanin (Anabaena variabilis)',
                'Plastocyanin (Phormidium)',
                'Glutaredoxin', 'CexCD (Apo)',
                'Protein G B1','Xylanase (Bacillus subtilus)']

col=cols[0]
nucl = nuclnames[col]
t = TitrationAnalyser()

#ghost mapping..
DB = PDatabase(server='peat.ucd.ie', username='******',
               password='******', project='titration_db',
               port=8080)
p=t.extractpKas(DB, col, names=['HEWL'], titratable=False, reliable=False, minspan=0.06)
t.mappKas(DB,col,p,names=['HEWL'],
          nucleus=nucl,calculatespans=False)       




示例#9
0
 def exportAll(self, DB, col=None):
     t = TitrationAnalyser()
     t.exportAll(DB, col)
     return
示例#10
0
# Jens Nielsen
# SBBS, Conway Institute
# University College Dublin
# Dublin 4, Ireland
#
# Author: Damien Farrell 2009

import pickle, sys, os, copy, time, types
import numpy
from PEATDB.Base import PDatabase
from PEATDB.Ekin.Titration import TitrationAnalyser
from PEATDB.Ekin.Base import EkinProject, EkinDataset

path = os.environ['HOME']

t = TitrationAnalyser()
H = '1H NMR'
N = '15N NMR'
C = '13C NMR'
'''yuncerts = {H: 0.03, fields[1]:0.2, fields[2]: 0.1} #from lawrence
minspans = {fields[0]: 0.06, fields[1]:0.2, fields[2]: 0.2} '''

complete = [
    'HEWL', 'Bovine Beta-Lactoglobulin', 'Plastocyanin (Anabaena variabilis)',
    'Plastocyanin (Phormidium)', 'CexCD (Apo)', 'Protein G B1', 'Glutaredoxin',
    'Staphylococcal Nuclease D+PHS'
]


def loadDB():
    from PEATDB.Base import PDatabase
示例#11
0
from PEATDB.Ekin.Base import EkinProject
from PEATDB.DictEdit import DictEditor
import os
import pickle

cols = ['15N NMR', '1H NMR']
nuclnames = {'1H NMR': 'H', '15N NMR': 'N'}
complete = [
    'HEWL', 'Bovine Beta-Lactoglobulin', 'Plastocyanin (Anabaena variabilis)',
    'Plastocyanin (Phormidium)', 'Glutaredoxin', 'CexCD (Apo)', 'Protein G B1',
    'Xylanase (Bacillus subtilus)'
]

col = cols[0]
nucl = nuclnames[col]
t = TitrationAnalyser()

#ghost mapping..
DB = PDatabase(server='peat.ucd.ie',
               username='******',
               password='******',
               project='titration_db',
               port=8080)
p = t.extractpKas(DB,
                  col,
                  names=['HEWL'],
                  titratable=False,
                  reliable=False,
                  minspan=0.06)
t.mappKas(DB, col, p, names=['HEWL'], nucleus=nucl, calculatespans=False)