
On Feb 28, 2006, at 9:28 AM, Thomas Goddard wrote:
The PDB file reader is implemented in C++ and I believe there is no Python interface to read from a string. The C++ code can read from a C++ stream (which could be a string stream), but there does not appear to be a Python interface. I'd suggest requesting this feature in an email to chimera-bugs@cgl.ucsf.edu (also used for new feature requests).
I second Tom's idea of requesting the feature via chimera-bugs. It would seem that you have the molecular data of interest internal to your extension rather than in an external file. What you can do is construct a Molecule directly rather than via a PDB file. Here's example code that constructs a model of a single water molecule: --- import chimera H = chimera.Element("H") O = chimera.Element("O") m = chimera.Molecule() m.name = "my water" # used by the Model Panel r = m.newResidue("HOH", "water", 1, "") # name, chain, position, insertion code o = m.newAtom("O", O) # name, element h1 = m.newAtom("H1", H) h2 = m.newAtom("H2", H) for a in [o, h1, h2]: r.addAtom(a) o.setCoord(chimera.Point(35.713, 15.029, 104.298)) h1.setCoord(chimera.Point(36.2803, 15.2855, 105.025)) h2.setCoord(chimera.Point(34.848, 15.4221, 104.414)) m.newBond(o, h1) m.newBond(o, h2) chimera.openModels.add([m]) --- If you didn't want to have to explicitly specify connectivity, you could call "chimera.connectMolecule(m)" in place of the newBond() calls, which would have Chimera add bonds based on distance. --Eric