Andreas, I don't understand the problem as described, but after
cmd.extend("domainDef", domainDef) the following should work from PyMOL's command line: domainDef 25880E, 1tab No, there is not a "pause" in PyMOL, though we could probably use one... Cheers, Warren -- Warren L. DeLano, Ph.D. Principal Scientist . DeLano Scientific LLC . 400 Oyster Point Blvd., Suite 213 . South San Francisco, CA 94080 . Biz:(650)-872-0942 Tech:(650)-872-0834 . Fax:(650)-872-0273 Cell:(650)-346-1154 . mailto:war...@delsci.com > -----Original Message----- > From: pymol-users-ad...@lists.sourceforge.net > [mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of > Andreas Henschel > Sent: Monday, January 31, 2005 3:24 AM > To: pymol-users@lists.sourceforge.net > Subject: [PyMOL] SQL in function with cmd.extend > > Hi all, > > I want to color code scop domains in PDB entries by querrying > a database server. > It works fine if I just call the function from the python > script, however if I define the function to be a Pymol fct, > the call from pymol causes an undefined MySQL Error in subchainString: > > Traceback (most recent call last): > File "/usr/lib/python2.3/site-packages/pymol/parser.py", > line 255, in parse > exec(com2[nest]+"\n",pymol_names,pymol_names) > File "<string>", line 1, in ? > File "scop1.py", line 19, in domainDef > cmd.select("domain", "/%s//%s/"%(pdb, subchainString(px))) > File "scop1.py", line 11, in subchainString > cursor.execute("SELECT chain_id, begin, end FROM subchain > WHERE subchain.px='%s' LIMIT 1"% px ) > File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", > line 95, in execute > return self._execute(query, args) > File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", > line 114, in _execute > self.errorhandler(self, exc, value) > File > "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", > line 33, in defaulterrorhandler > raise errorclass, errorvalue > InterfaceError: (0, '') > > I have a suspecion it's to do with the quoting? > Also, is there a command similar to Rasmol's "pause"? Or do I > have to use raw_input in the terminal I called pymol from? > > Here is the simplified code: > > ############################################################## > #################### > pdbLinkDir="/group/bioinf/Data/PDBLinks/" > > from pymol import cmd > from pymol.cgo import * > import MySQLdb > from MySQLdb.cursors import DictCursor > > def subchainString(px): > cursor.execute("SELECT chain_id, begin, end FROM subchain > WHERE subchain.px='%s' LIMIT 1"% px ) > data=cursor.fetchone() > if data["begin"]: return "%s/%s-%s"%(data["chain_id"], > data["begin"], data["end"]) > else: return "%s"%(data["chain_id"]) > > def domainDef(px, pdb): > cmd.load(pdbLinkDir+"%s.pdb"%pdb) > cmd.hide("everything","all") > cmd.select("domain", "/%s//%s/"%(pdb, subchainString(px))) > cmd.color("blue","domain") > cmd.show("cartoon", "all") > > > conn = MySQLdb.connect(db="pqs_psimap", host="dbserver", > user="...", passwd="...") cursor = conn.cursor(DictCursor) > > #domainDef("25880E", "1tab") ## This works fine!!! > cmd.extend("domainDef", domainDef) ## breaks when called from > pymol with > ## domainDef("25880E", "1tab") > > conn.close() > > ############################################################## > #################### > > Many thanks > -- > Andreas Henschel > Bioinformatics Group > TU Dresden > Tatzberg 47-51 > 01307 Dresden, Germany > > Phone: +49 351 463 40063 > EMail: a...@biotec.tu-dresden.de > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive > Reporting Tool for open source databases. Create drag-&-drop > reports. Save time by over 75%! Publish reports on the web. > Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pymol-users >