Re: [PyMOL] pdbml
Hi Thomas, thank you very much for help. Since PDB made pdbml default for large systems (i'm particularly interested in ribosomes) it was a kind of pain. And it seems i have to upgrade my PyMOL and read documentation more often: help for fetch in PyMOL from svn shows '{default: cif (default was "pdb" up to 1.7.6)}'. Regards, Arthur On 23.10.2015 00:48, Thomas Holder wrote: > Hi Arthur, > > The script I sent you earlier had one Incentive PyMOL specific line > and won't work in Open-Source PyMOL unless you delete that line. My > apologies. > > However, if you are compiling the latest code from SVN you don't need > the script, I already have incorporated it into the code base! Simply > load files with .xml or .pdbml extension. > > I have to add that loading 4v50 in PDBML format into PyMOL is a rather > bad idea. PDBML is utterly bloated, the uncompressed file for 4v50 is > over 300MB, and the in-memory xml representation will explode into the > gigabytes. You should really use mmCIF format instead, PyMOL loads > 4v50.cif in 2 seconds. > > Cheers, > Thomas > > On 22 Oct 2015, at 12:38, Arthur Zalevsky> wrote: > >> Hi Thomas! >> >> I've tried your parser with pymol 1.4.1 from ubuntu 12.04 repos and >> freshly compiled 1.7.7.2 from svn with no luck at all. I've tried to >> load PDB ID 4V50 (full E.coli ribosome). Pymol simply hangs with 100% >> cpu usage. >> >> From 1.4.1 i've got following traceback (after i left it overnight): >> >> Traceback (most recent call last): >> File "/usr/lib/python2.7/dist-packages/pymol/parser.py", line 254, >> in >> parse >> self.result=apply(layer.kw[0],layer.args,layer.kw_args) >> File "/home/domain/silwer/Downloads/load_pdbml.py", line 80, in >> load_pdbml >> atom.properties['entity_id'] = child.text or '' >> File "/usr/lib/python2.7/dist-packages/chempy/__init__.py", line 59, >> in __getattr__ >> raise AttributeError(attr) >> AttributeError: properties >> >> Any help would be appreciated. >> >> >> Regards, >> Arthur >> >> >> On 25.09.2015 01:50, Thomas Holder wrote: >>> Hi Arthur & Jerome, >>> >>> I wrote a basic PDBML importer for PyMOL, see attached script which >>> adds a "load_pdbml" command. I meant to assess the complexity of such >>> a project and ended up writing the entire thing. So far, this only >>> reads atoms and symmetry information. If you find this useful we can >>> include that in the next PyMOL release. >>> >>> Cheers, >>> Thomas >>> >>> >>> >>> On 23 Sep 2015, at 03:27, Arthur Zalevsky >>> wrote: >>> Sorry for bumping old thread, but is support for pdbml still unimplemented? In such case i think it's a good project for our students. Regards, Arthur > From: Thomas Holder - 2013-12-02 19:23:18 > Hi Jerome, > > I think the simple reason is that nobody ever wrote a PDBML parser > for > PyMOL. Is that a good reason? > > Cheers, > Thomas > >> On 28 Nov 2013, at 13:21, Jerome BENOIT wrote: >> Hello List, >> >> is there any good reason why PyMOL can not read PDBML data files ? >> >> Cheers, >> Jerome -- ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Re: [PyMOL] pdbml
Hi John, Yeah, i know about limitations of PDB format. I've missed the news you mentioned so it was a kind of surprise when i found ribosome pdbs superseded by merged pdbml. So basically j'm just a bit outdated and updating of once established pipelines is always a bit frustrating. Thanks again, Thomas and John. Regards, Arthur On 23.10.2015 10:17, John Berrisford wrote: > Dear Authur > > As the PDB format is not suitable for structures with over 99,999 atom > lines > or over 62 chains we only distribute these structures in both mmCIF and > PDBML > formats. > > See: > http://www.wwpdb.org/news/news?year=2014#10-December-2014 > > > We (PDBe) have been using mmCIF format in pymol for number of years to > generate our images. > See: > pdbe.org/4v50 > > Regards > > John > PDBe depositions > > > On Friday 23 October 2015 07:21:07 Arthur Zalevsky wrote: >> Hi Thomas, >> >> thank you very much for help. >> >> Since PDB made pdbml default for large systems (i'm particularly >> interested in ribosomes) it was a kind of pain. >> And it seems i have to upgrade my PyMOL and read documentation more >> often: help for fetch in PyMOL from svn shows '{default: cif (default >> was "pdb" up to 1.7.6)}'. >> >> Regards, >> Arthur >> >> On 23.10.2015 00:48, Thomas Holder wrote: >> > Hi Arthur, >> > >> > The script I sent you earlier had one Incentive PyMOL specific line >> > and won't work in Open-Source PyMOL unless you delete that line. My >> > apologies. >> > >> > However, if you are compiling the latest code from SVN you don't need >> > the script, I already have incorporated it into the code base! Simply >> > load files with .xml or .pdbml extension. >> > >> > I have to add that loading 4v50 in PDBML format into PyMOL is a rather >> > bad idea. PDBML is utterly bloated, the uncompressed file for 4v50 is >> > over 300MB, and the in-memory xml representation will explode into the >> > gigabytes. You should really use mmCIF format instead, PyMOL loads >> > 4v50.cif in 2 seconds. >> > >> > Cheers, >> > Thomas >> > >> > On 22 Oct 2015, at 12:38, Arthur Zalevsky>> > >> > wrote: >> >> Hi Thomas! >> >> >> >> I've tried your parser with pymol 1.4.1 from ubuntu 12.04 repos and >> >> freshly compiled 1.7.7.2 from svn with no luck at all. I've tried to >> >> load PDB ID 4V50 (full E.coli ribosome). Pymol simply hangs with 100% >> >> cpu usage. >> >> >> >> From 1.4.1 i've got following traceback (after i left it overnight): >> >> >> >> Traceback (most recent call last): >> >> File "/usr/lib/python2.7/dist-packages/pymol/parser.py", line 254, >> >> in >> >> parse >> >> self.result=apply(layer.kw[0],layer.args,layer.kw_args) >> >> File "/home/domain/silwer/Downloads/load_pdbml.py", line 80, in >> >> load_pdbml >> >> atom.properties['entity_id'] = child.text or '' >> >> File "/usr/lib/python2.7/dist-packages/chempy/__init__.py", line 59, >> >> in __getattr__ >> >> raise AttributeError(attr) >> >> AttributeError: properties >> >> >> >> Any help would be appreciated. >> >> >> >> >> >> Regards, >> >> Arthur >> >> >> >> On 25.09.2015 01:50, Thomas Holder wrote: >> >>> Hi Arthur & Jerome, >> >>> >> >>> I wrote a basic PDBML importer for PyMOL, see attached script which >> >>> adds a "load_pdbml" command. I meant to assess the complexity of such >> >>> a project and ended up writing the entire thing. So far, this only >> >>> reads atoms and symmetry information. If you find this useful we can >> >>> include that in the next PyMOL release. >> >>> >> >>> Cheers, >> >>> Thomas >> >>> >> >>> >> >>> >> >>> On 23 Sep 2015, at 03:27, Arthur Zalevsky >> >>> >> >>> wrote: >> Sorry for bumping old thread, but is support for pdbml still >> unimplemented? In such case i think it's a good project for our >> students. >> >> Regards, >> Arthur >> >> > From: Thomas Holder - 2013-12-02 19:23:18 >> > Hi Jerome, >> > >> > I think the simple reason is that nobody ever wrote a PDBML parser >> > for >> > PyMOL. Is that a good reason? >> > >> > Cheers, >> > Thomas >> > >> >> On 28 Nov 2013, at 13:21, Jerome BENOIT wrote: >> >> Hello List, >> >> >> >> is there any good reason why PyMOL can not read PDBML data files ? >> >> >> >> Cheers, >> >> Jerome >> >> --- >> --- ___ >> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> Archives: >> http://www.mail-archive.com/pymol-users@lists.sourceforge.net >> -- ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page:
Re: [PyMOL] pdbml
Hi Arthur, The script I sent you earlier had one Incentive PyMOL specific line and won't work in Open-Source PyMOL unless you delete that line. My apologies. However, if you are compiling the latest code from SVN you don't need the script, I already have incorporated it into the code base! Simply load files with .xml or .pdbml extension. I have to add that loading 4v50 in PDBML format into PyMOL is a rather bad idea. PDBML is utterly bloated, the uncompressed file for 4v50 is over 300MB, and the in-memory xml representation will explode into the gigabytes. You should really use mmCIF format instead, PyMOL loads 4v50.cif in 2 seconds. Cheers, Thomas On 22 Oct 2015, at 12:38, Arthur Zalevskywrote: > Hi Thomas! > > I've tried your parser with pymol 1.4.1 from ubuntu 12.04 repos and > freshly compiled 1.7.7.2 from svn with no luck at all. I've tried to > load PDB ID 4V50 (full E.coli ribosome). Pymol simply hangs with 100% > cpu usage. > > From 1.4.1 i've got following traceback (after i left it overnight): > > Traceback (most recent call last): > File "/usr/lib/python2.7/dist-packages/pymol/parser.py", line 254, in > parse > self.result=apply(layer.kw[0],layer.args,layer.kw_args) > File "/home/domain/silwer/Downloads/load_pdbml.py", line 80, in > load_pdbml > atom.properties['entity_id'] = child.text or '' > File "/usr/lib/python2.7/dist-packages/chempy/__init__.py", line 59, > in __getattr__ > raise AttributeError(attr) > AttributeError: properties > > Any help would be appreciated. > > > Regards, > Arthur > > > On 25.09.2015 01:50, Thomas Holder wrote: >> Hi Arthur & Jerome, >> >> I wrote a basic PDBML importer for PyMOL, see attached script which >> adds a "load_pdbml" command. I meant to assess the complexity of such >> a project and ended up writing the entire thing. So far, this only >> reads atoms and symmetry information. If you find this useful we can >> include that in the next PyMOL release. >> >> Cheers, >> Thomas >> >> >> >> On 23 Sep 2015, at 03:27, Arthur Zalevsky >> wrote: >> >>> Sorry for bumping old thread, but is support for pdbml still >>> unimplemented? In such case i think it's a good project for our >>> students. >>> >>> Regards, >>> Arthur >>> From: Thomas Holder - 2013-12-02 19:23:18 Hi Jerome, I think the simple reason is that nobody ever wrote a PDBML parser for PyMOL. Is that a good reason? Cheers, Thomas > On 28 Nov 2013, at 13:21, Jerome BENOIT wrote: > Hello List, > > is there any good reason why PyMOL can not read PDBML data files ? > > Cheers, > Jerome -- Thomas Holder PyMOL Principal Developer Schrödinger, Inc. -- ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Re: [PyMOL] pdbml
Hi Thomas! I've tried your parser with pymol 1.4.1 from ubuntu 12.04 repos and freshly compiled 1.7.7.2 from svn with no luck at all. I've tried to load PDB ID 4V50 (full E.coli ribosome). Pymol simply hangs with 100% cpu usage. From 1.4.1 i've got following traceback (after i left it overnight): Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pymol/parser.py", line 254, in parse self.result=apply(layer.kw[0],layer.args,layer.kw_args) File "/home/domain/silwer/Downloads/load_pdbml.py", line 80, in load_pdbml atom.properties['entity_id'] = child.text or '' File "/usr/lib/python2.7/dist-packages/chempy/__init__.py", line 59, in __getattr__ raise AttributeError(attr) AttributeError: properties Any help would be appreciated. Regards, Arthur On 25.09.2015 01:50, Thomas Holder wrote: > Hi Arthur & Jerome, > > I wrote a basic PDBML importer for PyMOL, see attached script which > adds a "load_pdbml" command. I meant to assess the complexity of such > a project and ended up writing the entire thing. So far, this only > reads atoms and symmetry information. If you find this useful we can > include that in the next PyMOL release. > > Cheers, > Thomas > > > > On 23 Sep 2015, at 03:27, Arthur Zalevsky> wrote: > >> Sorry for bumping old thread, but is support for pdbml still >> unimplemented? In such case i think it's a good project for our >> students. >> >> Regards, >> Arthur >> >>> From: Thomas Holder - 2013-12-02 19:23:18 >>> Hi Jerome, >>> >>> I think the simple reason is that nobody ever wrote a PDBML parser >>> for >>> PyMOL. Is that a good reason? >>> >>> Cheers, >>> Thomas >>> On 28 Nov 2013, at 13:21, Jerome BENOIT wrote: Hello List, is there any good reason why PyMOL can not read PDBML data files ? Cheers, Jerome > > -- > > ___ > PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net -- ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Re: [PyMOL] pdbml
Hi Arthur & Jerome, I wrote a basic PDBML importer for PyMOL, see attached script which adds a "load_pdbml" command. I meant to assess the complexity of such a project and ended up writing the entire thing. So far, this only reads atoms and symmetry information. If you find this useful we can include that in the next PyMOL release. Cheers, Thomas ''' Adds a "load_pdbml" command to PyMOL. (c) Thomas Holder, Schrodinger, LLC ''' import os from pymol import cmd @cmd.extend def load_pdbml(filename, object='', discrete=0, multiplex=1, zoom=-1, quiet=1, _self=cmd): ''' DESCRIPTION Load a PDBML formatted structure file ''' from lxml import etree from chempy import Atom, models from collections import defaultdict multiplex, discrete = int(multiplex), int(discrete) try: root = etree.parse(filename).getroot() atom_site_list = root.xpath('./PDBx:atom_siteCategory/PDBx:atom_site', namespaces=root.nsmap) except etree.XMLSyntaxError: print " Error: File doesn't look like XML" return except etree.XPathEvalError: print " Error: XML file doesn't look like a PDBML file" return if not atom_site_list: print ' Error: no PDBx:atom_site nodes found in XML file' return # state -> model dictionary model_dict = defaultdict(models.Indexed) # atoms for atom_site in atom_site_list: atom = Atom() atom.coord = [None, None, None] model_num = 1 for child in atom_site: tag = etree.QName(child).localname if tag == 'Cartn_x': atom.coord[0] = float(child.text) elif tag == 'Cartn_y': atom.coord[1] = float(child.text) elif tag == 'Cartn_z': atom.coord[2] = float(child.text) elif tag == 'B_iso_or_equiv': atom.b = float(child.text) elif tag == 'auth_asym_id': atom.chain = child.text or '' elif tag == 'auth_atom_id': atom.name = child.text or '' elif tag == 'auth_comp_id': atom.resn = child.text or '' elif tag == 'auth_seq_id': atom.resi = child.text or '' elif tag == 'label_alt_id': atom.resi = child.text or '' elif tag == 'label_asym_id': atom.segi = child.text or '' elif tag == 'label_atom_id': if not atom.name: atom.name = child.text or '' elif tag == 'label_comp_id': if not atom.resn: atom.resn = child.text or '' elif tag == 'label_seq_id': if not atom.resi: atom.resi = child.text or '' elif tag == 'label_entity_id': atom.properties['entity_id'] = child.text or '' elif tag == 'occupancy': atom.q = float(child.text) elif tag == 'pdbx_PDB_model_num': model_num = int(child.text) elif tag == 'type_symbol': atom.symbol = child.text or '' elif tag == 'group_PDB': atom.hetatm = (child.text == 'HETATM') if None not in atom.coord: model_dict[model_num].add_atom(atom) # symmetry and cell try: node = root.xpath('./PDBx:cellCategory/PDBx:cell', namespaces=root.nsmap)[0] cell = [float(node.xpath('./PDBx:' + a + '/text()', namespaces=root.nsmap)[0]) for a in ['length_a', 'length_b', 'length_c', 'angle_alpha', 'angle_beta', 'angle_gamma']] spacegroup = root.xpath( './PDBx:symmetryCategory/PDBx:symmetry/PDBx:space_group_name_H-M/text()', namespaces=root.nsmap)[0] except IndexError: cell = None spacegroup = '' # object name if not object: object = os.path.basename(filename).split('.', 1)[0] # only multiplex if more than one model/state multiplex = multiplex and len(model_dict) > 1 # load models as objects or states for model_num in sorted(model_dict): if model_num < 1: print " Error: model_num < 1 not supported" continue model = model_dict[model_num] model.connect_mode = 3 if cell: model.cell = cell model.spacegroup = spacegroup if multiplex: oname = '%s_%04d' % (object , model_num) model_num = 1 else: oname = object _self.load_model(model, oname, state=model_num, zoom=zoom, discrete=discrete) On 23 Sep 2015, at 03:27, Arthur Zalevskywrote: > Sorry for bumping old thread, but is support for pdbml still > unimplemented? In such case i think it's a good project for our > students. > > Regards, > Arthur > >> From: Thomas Holder -
Re: [PyMOL] pdbml
Sorry for bumping old thread, but is support for pdbml still unimplemented? In such case i think it's a good project for our students. Regards, Arthur > From: Thomas Holder- 2013-12-02 19:23:18 > Hi Jerome, > > I think the simple reason is that nobody ever wrote a PDBML parser for > PyMOL. Is that a good reason? > > Cheers, > Thomas > >> On 28 Nov 2013, at 13:21, Jerome BENOIT wrote: >> Hello List, >> >> is there any good reason why PyMOL can not read PDBML data files ? >> >> Cheers, >> Jerome -- Monitor Your Dynamic Infrastructure at Any Scale With Datadog! Get real-time metrics from all of your servers, apps and tools in one place. SourceForge users - Click here to start your Free Trial of Datadog now! http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140 ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Re: [PyMOL] pdbml
Hi Jerome, I think the simple reason is that nobody ever wrote a PDBML parser for PyMOL. Is that a good reason? Cheers, Thomas On 28 Nov 2013, at 13:21, Jerome BENOIT g62993...@rezozer.net wrote: Hello List, is there any good reason why PyMOL can not read PDBML data files ? Cheers, Jerome -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
[PyMOL] pdbml
Hello List, is there any good reason why PyMOL can not read PDBML data files ? Cheers, Jerome -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net