Beispiel #1
0
    def showpKD(self):
        """Show pKD calcs with exp data for selected ekindata"""
        protein = self.form.getfirst('protein')
        col = self.form.getfirst('column')
        showopt = self.form.getfirst('option')

        self.showHeader(menu=1)
        sys.stdout.flush()
        DB = self.DB = self.connect()
        protname = DB[protein]['name']
        pdbid = DB[protein]['PDB_link']['text']
        expdata = DB[protein][col]
        if type(expdata) is types.StringType:
            print '<a>No data for column %s, go back and choose another nucleus..</a>' %col
            return

        P = pKDInterface()
        calcs, pkas, pdblines = P.loadfrompKD(pdbid)

        print '<div><a>Protein: %s PDB: %s </a><br>' %(protname, pdbid)
        print 'Column data: %s <p></div>' %col
        if calcs == None or not type(calcs) is types.DictType:
            print '<a>There are currently no pKD calculations for this protein.</a>'
            return
        else:
            print '<a>Found data on pKD server. We can plot.</a>'
            sys.stdout.flush()
        #plot them
        self.plotpKDCalcs(calcs, expdata, showopt)
        self.footer()
        return
Beispiel #2
0
    def selectpKD(self):
        """Allow user to select a protein and field for pKD"""

        self.showHeader(menu=1)
        sys.stdout.flush()
        DB = self.DB = self.connect()

        names = []
        for p in DB.getRecs():
            names.append((DB[p].name,p))
        names.sort()
        nucl = ['1H NMR', '15N NMR', '13C NMR']

        #check pKD available calcs
        P = pKDInterface()
        pkdprots = [string.upper(e[0]) for e in P.getProteins()]

        #add selection boxes
        print '<div align=left>'
        print '<form name="pkdform" action="%s/main.cgi" METHOD="POST" ENCTYPE="multipart/form-data">' %self.bindir
        self.write_sessionkey('showpKD')

        print '<big>Select experimental curves to compare with calculated curves in pKD</big><br>'
        print '<a>This will show a set of plots for each residue where there is an experimental and calculated curve</a><p>'
        print 'Choose the protein and nucleus:<p>'
        print '<select name="protein" class="btn">'
        for n in names:
            print '<option value="%s">%s</option>' %(n[1],n[0])
        print '</select>'
        print '<select name="column" class="btn">'
        for c in nucl:
            print '<option value="%s">%s</option>' %(c,c)
        print '</select>'
        print '<p>'
        #button
        print '<input type=submit value="Display Plots" name=submit class="btn">'
        print '<label><input type=radio name="option" value=1 checked="yes">compare both</label>'
        print '<label><input type=radio name="option" value=2>exp only</label>'
        print '<label><input type=radio name="option" value=3>calcs only</label>'
        print '</form>'

        print '</div>'
        print 'Below is a reference table showing which proteins in our DB currently have calculations in the pKD, with the PDB ID and PDB link.<br>'
        print 'If the protein is not yet available, you can go to <a href=http://enzyme.ucd.ie/cgi-bin/pKD/server_start.cgi target="blank"> \
                    the pKD page</a> and submit the calculation.<p>'
        #table of proteins and their PDBs
        print '<div align=left>'
        print '<table id="mytable" cellspacing="0">'
        r=0
        print '<th>Protein</th><th>PDB</th><th>Has pKD data</th>'
        for name in names:
            protein = name[1]
            protname = name[0]
            if not DB[protein].has_key('PDB_link'):
                continue
            pdbinfo = DB[protein].PDB_link
            if pdbinfo == '':
                continue
            pdbid = pdbinfo['text']
            pdblink = pdbinfo['link']
            if r % 2 == 0:
                cls = 'alt'
            else:
                cls = ''
            print '<tr>'
            print '<td class=%s> %s </td>' % (cls, protname)
            print '<td class=%s> <a href=%s target="blank"> %s</a> </td>' % (cls, pdblink, pdbid)
            if pdbid in pkdprots:
                status = 'yes'
            else:
                status = 'no'
            print '<td class=%s> <b>%s</b> </td>' %(cls, status)
            print '</tr>'
            r=r+1
        print '</table>'
        return