[Chimera-users] How to load PDB data inline in Chimera script/command files
Eric Pettersen
pett at cgl.ucsf.edu
Mon Sep 29 11:31:42 PDT 2014
On Sep 29, 2014, at 8:08 AM, Tony Lewis <t.lewis at ucl.ac.uk> wrote:
> Dear Chimera people,
>
> Many thanks to all Chimera contributors.
>
> Please can anyone tell me if there's a way to include PDB data *inline* in Chimera script / command / Chimerax files?
>
> PyMOL's read_pdbstr() command loads PDB data from an inline string, which means one file can contain both the structural data and the associated commands. That's rather convenient.
>
> I would much appreciate any help on how to do the same with Chimera. Apologies if the answer is obvious.
Hi Tony,
I wouldn't say the answer is obvious, but Chimera can read streams and therefore you can use a StringIO buffer to open PDB data in Chimera. Here is an example that open a histidine residue:
from StringIO import StringIO
buf = StringIO("""ATOM 1 N HIS A 1 49.668 24.248 10.436 1.00 25.00 N
ATOM 2 CA HIS A 1 50.197 25.578 10.784 1.00 16.00 C
ATOM 3 C HIS A 1 49.169 26.701 10.917 1.00 16.00 C
ATOM 4 O HIS A 1 48.241 26.524 11.749 1.00 16.00 O
ATOM 5 CB HIS A 1 51.312 26.048 9.843 1.00 16.00 C
ATOM 6 CG HIS A 1 50.958 26.068 8.340 1.00 16.00 C
ATOM 7 ND1 HIS A 1 49.636 26.144 7.860 1.00 16.00 N
ATOM 8 CD2 HIS A 1 51.797 26.043 7.286 1.00 16.00 C
ATOM 9 CE1 HIS A 1 49.691 26.152 6.454 1.00 17.00 C
ATOM 10 NE2 HIS A 1 51.046 26.090 6.098 1.00 17.00 N """)
from chimera import openModels
models = openModels.open(buf, type="PDB", identifyAs="his")
--Eric
Eric Pettersen
UCSF Computer Graphics Lab
http://www.cgl.ucsf.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20140929/a810c673/attachment.html>
More information about the Chimera-users
mailing list