Re: [PyMOL] Fwd: What is the difference between Atom ID and Index
Hey Martin, rank? I didn't know that one :p Checking your structure, it seems to me that: ID is the numbering as in the PDB file rank is a numbering from 1 to N, following the order of atoms in the PDB file index is an internal index to an array that contains the atoms, sorted by element The index changes when atoms are deleted, whereas the ID and the rank do not. Loading the structure to two different objects, gives the exact same labels: load lig.pdb, lig1 load lig.pdb, lig2 label all, %d-%d-%d%(ID,rank,index) I don't think I can help you much further than this :S Maybe Jason can shed some more light on the issue. May the source be with you. Tsjerk On Mon, Nov 1, 2010 at 10:02 AM, Martin Hediger ma@bluewin.ch wrote: Hi Tsjerk, I am still wondering about how the numbering is done. Given a PDB file looking like this (some random molecule): HETATM 1 C LIG 1 -4.242 2.555 -0.814 1.00 0.00 C HETATM 2 C LIG 1 -2.736 2.361 -0.665 1.00 0.00 C HETATM 3 H LIG 1 -4.461 3.588 -1.106 1.00 0.00 H HETATM 4 C LIG 1 -4.961 2.214 0.487 1.00 0.00 C HETATM 5 H LIG 1 -4.615 1.908 -1.617 1.00 0.00 H HETATM 6 H LIG 1 -2.333 3.133 0.004 1.00 0.00 H HETATM 7 H LIG 1 -2.247 2.493 -1.637 1.00 0.00 H HETATM 8 C LIG 1 -2.409 0.977 -0.105 1.00 0.00 C HETATM 9 H LIG 1 -4.728 2.975 1.243 1.00 0.00 H HETATM 10 C LIG 1 -4.549 0.837 1.003 1.00 0.00 C HETATM 11 H LIG 1 -6.045 2.243 0.329 1.00 0.00 H HETATM 110 N LIG 1 -3.097 0.727 1.164 1.00 0.00 N HETATM 13 H LIG 1 -4.907 0.053 0.324 1.00 0.00 H HETATM 14 H LIG 1 -5.027 0.653 1.972 1.00 0.00 H HETATM 15 H LIG 1 -1.329 0.896 0.057 1.00 0.00 H HETATM 16 H LIG 1 -2.677 0.200 -0.831 1.00 0.00 H HETATM 17 H LIG 1 -2.789 1.419 1.847 1.00 0.00 H What PyMOL-function returns me the 'physical' index in the array of atoms? So for atom '12' (nitrogen), (with label '110') I would like '12' displayed in the PyMOL viewer. Right now, 'ID' displayes '110', 'RANK' displays '11' and 'INDEX' displayes '1'. After deleting row 4, again for atom labeled '110' nitrogen, 'ID' displayes '110', 'RANK' displayes '10' and index displayes '1'. I'm not sure now if this is in agreement with what we have said so far. What I dont like too much about relying on 'ID' is the fact that if the labels get changed (or none are present), its not possible to tell anymore which atom has which index. Thats why i was hoping to find a way to get the 'linenumber-dependent' index of an atom. Thanks for your help so far. Martin On 31.10.10 18:31, Tsjerk Wassenaar wrote: Hi Martin, So it seems I was right :D ID is an atomic property, read from the PDB file, whereas index is an 'internal' identifier. Following Jasons comments, ID is not changed upon additions/deletions, whereas index does. For your purpose, you probably want to make sure that the IDs are identical for corresponding atoms. Hope it helps, Tsjerk On Oct 31, 2010 3:35 PM, Martin Hediger ma@bluewin.ch wrote: Hey, Thanks for your earlier response on the issue. Its quite important to me right now, since I am trying to interpolate between two states of the same structure and therefore (let me call it 'physical') atom numbering has to be perfectly identical. I looked into it but i cant quite get my following observation into agreement with what you said. I have a PDB file with 920 atoms. Starting from the top, with no 'TER' or 'MODEL' or other PDB syntax elements, on line 909 of that file an ATOM is stated (hydrogen), with the number '909' at the line-909.split()[1] position. When I open the file in PyMOL and let it display LABELSATOM_IDENTIFIERSID, I get '909' displayed in the model. Changing the value at '909' in the PDB file to 950, reloading and redisplaying the 'ID' labels, presents '950' also in the PyMOL viewer, even if the ATOM is still on line 909 in the PDB file. How can this behavior be explained with regard to what we were talking about previously? What label-type is required to display the actual, non-label-dependent index of the atom in the system? Does the functionality depend on whether there are more detailed atom descriptors available, like residue type or chain id? Thanks one more time for any help on this. Martin Am 25.10.10 17:03, schrieb Jason Vertrees: Hi Martin Tsjerk, There is a another difference between the two aside from the off-by-o... -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands
Re: [PyMOL] Fwd: What is the difference between Atom ID and Index
Thanks Hongbo Zhu. Great summary of the topic. Rank rules. Martin On 01.11.10 11:57, Hongbo Zhu wrote: ID is theexternal-index-number, which is parsed from columns 7-11 of the PDB file (Atom serial number). Try pymol command: select id 110 RANK is the order of the atoms as they are listed in the PDB file (0-based). Therefore, the nitrogen is at rank 11 (line 12). Try pymol command: select rank 11 INDEX is theinternal-index-number of the atom. Obviously, the atoms get their internal indices based on their names as atoms of the same name are grouped together. Try pymol command: select index 1 PyMOL suggests that Atom indices are fragile and will change as atoms are added or deleted. Whenever possible, use integral atom identifiers instead of indices. I suppose you should useRANK, if you like to find a way to get the 'linenumber-dependent' index of an atom. cheers, Hongbo Zhu On 11/01/2010 10:02 AM, Martin Hediger wrote: Hi Tsjerk, I am still wondering about how the numbering is done. Given a PDB file looking like this (some random molecule): HETATM 1 C LIG 1 -4.242 2.555 -0.814 1.00 0.00 C HETATM 2 C LIG 1 -2.736 2.361 -0.665 1.00 0.00 C HETATM 3 H LIG 1 -4.461 3.588 -1.106 1.00 0.00 H HETATM 4 C LIG 1 -4.961 2.214 0.487 1.00 0.00 C HETATM 5 H LIG 1 -4.615 1.908 -1.617 1.00 0.00 H HETATM 6 H LIG 1 -2.333 3.133 0.004 1.00 0.00 H HETATM 7 H LIG 1 -2.247 2.493 -1.637 1.00 0.00 H HETATM 8 C LIG 1 -2.409 0.977 -0.105 1.00 0.00 C HETATM 9 H LIG 1 -4.728 2.975 1.243 1.00 0.00 H HETATM 10 C LIG 1 -4.549 0.837 1.003 1.00 0.00 C HETATM 11 H LIG 1 -6.045 2.243 0.329 1.00 0.00 H HETATM 110 N LIG 1 -3.097 0.727 1.164 1.00 0.00 N HETATM 13 H LIG 1 -4.907 0.053 0.324 1.00 0.00 H HETATM 14 H LIG 1 -5.027 0.653 1.972 1.00 0.00 H HETATM 15 H LIG 1 -1.329 0.896 0.057 1.00 0.00 H HETATM 16 H LIG 1 -2.677 0.200 -0.831 1.00 0.00 H HETATM 17 H LIG 1 -2.789 1.419 1.847 1.00 0.00 H What PyMOL-function returns me the 'physical' index in the array of atoms? So for atom '12' (nitrogen), (with label '110') I would like '12' displayed in the PyMOL viewer. Right now, 'ID' displayes '110', 'RANK' displays '11' and 'INDEX' displayes '1'. After deleting row 4, again for atom labeled '110' nitrogen, 'ID' displayes '110', 'RANK' displayes '10' and index displayes '1'. I'm not sure now if this is in agreement with what we have said so far. What I dont like too much about relying on 'ID' is the fact that if the labels get changed (or none are present), its not possible to tell anymore which atom has which index. Thats why i was hoping to find a way to get the 'linenumber-dependent' index of an atom. Thanks for your help so far. Martin -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ 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 -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ 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] Fwd: What is the difference between Atom ID and Index
Hi Martin, So it seems I was right :D ID is an atomic property, read from the PDB file, whereas index is an 'internal' identifier. Following Jasons comments, ID is not changed upon additions/deletions, whereas index does. For your purpose, you probably want to make sure that the IDs are identical for corresponding atoms. Hope it helps, Tsjerk On Oct 31, 2010 3:35 PM, Martin Hediger ma@bluewin.ch wrote: Hey, Thanks for your earlier response on the issue. Its quite important to me right now, since I am trying to interpolate between two states of the same structure and therefore (let me call it 'physical') atom numbering has to be perfectly identical. I looked into it but i cant quite get my following observation into agreement with what you said. I have a PDB file with 920 atoms. Starting from the top, with no 'TER' or 'MODEL' or other PDB syntax elements, on line 909 of that file an ATOM is stated (hydrogen), with the number '909' at the line-909.split()[1] position. When I open the file in PyMOL and let it display LABELSATOM_IDENTIFIERSID, I get '909' displayed in the model. Changing the value at '909' in the PDB file to 950, reloading and redisplaying the 'ID' labels, presents '950' also in the PyMOL viewer, even if the ATOM is still on line 909 in the PDB file. How can this behavior be explained with regard to what we were talking about previously? What label-type is required to display the actual, non-label-dependent index of the atom in the system? Does the functionality depend on whether there are more detailed atom descriptors available, like residue type or chain id? Thanks one more time for any help on this. Martin Am 25.10.10 17:03, schrieb Jason Vertrees: Hi Martin Tsjerk, There is a another difference between the two aside from the off-by-o... -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev___ 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] Fwd: What is the difference between Atom ID and Index
Never get used to that only-reply-to-sender policy... -- Forwarded message -- From: Tsjerk Wassenaar tsje...@gmail.com Date: Mon, Oct 25, 2010 at 12:30 PM Subject: Re: [PyMOL] What is the difference between Atom ID and Index To: Martin Hediger ma@bluewin.ch Hi Martin, ID is indeed the atom id from the coordinate (PDB) file. Index, AFAIK, is the atom index in the model, starting from 1. Probably you should get yourself acquainted with the command line and with python, as it will help you to solve these and other problems. For example, you can access properties from the atoms easily through constructions like these: x = [ at.id for at in cmd.get_model(selection).atom ] y = [ at.index for at in cmd.get_model(selection).atom ] That will first build a selection/model object, with a list of atoms (.atom), over which you can iterate to extract some properties. To check whether the index is indeed a straightforward list of increasing numbers, you can then look at the output of print y == range(1,len(y)+1) Hope it helps :) Tsjerk On Mon, Oct 25, 2010 at 10:55 AM, Martin Hediger ma@bluewin.ch wrote: Dear All I'm trying to figure out for myself, what the two labels 'Label Atom Identifiers ID' and 'Label Atom Identifiers index' mean, or what the respective difference between the two is. For sure, the numerical value is very different when I show the labels in a structure. ID seems to be the index of the atom in the list of atom-descriptor lines in the PDB input file. But I cant figure out what 'index' is referring to. Any help on this would be very welcome. Martin -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ 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 -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ 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] Fwd: What is the difference between Atom ID and Index
Thanks Tsjerk (on both occasions). As a matter of fact, I'm kind of making a living out of writing a Python script once in a while, so thats no worry ;) What I was trying to get at was that I was trying to understand how certain PyMOL scripts work, and naturally from that become able to improve my own ones. In particular, I was trying to understand the following script: http://pastebin.com/5mkwWJdd Its is supposed to find hydrogen bonds within a structure and it should allow to monitor the change in the HB network throughout a reaction. Credit to the person who wrote it. Especially, lines 61 to 69 make heavy use of iterate, but I cant quite follow it. Understanding 'iterate' (and naturally iterate_state, alter and alter_state), I believe, would help me alot in writing better scripts. Anyway, thanks again for the support. Martin On 25.10.10 12:49, Tsjerk Wassenaar wrote: Never get used to that only-reply-to-sender policy... -- Forwarded message -- From: Tsjerk Wassenaartsje...@gmail.com Date: Mon, Oct 25, 2010 at 12:30 PM Subject: Re: [PyMOL] What is the difference between Atom ID and Index To: Martin Hedigerma@bluewin.ch Hi Martin, ID is indeed the atom id from the coordinate (PDB) file. Index, AFAIK, is the atom index in the model, starting from 1. Probably you should get yourself acquainted with the command line and with python, as it will help you to solve these and other problems. For example, you can access properties from the atoms easily through constructions like these: x = [ at.id for at in cmd.get_model(selection).atom ] y = [ at.index for at in cmd.get_model(selection).atom ] That will first build a selection/model object, with a list of atoms (.atom), over which you can iterate to extract some properties. To check whether the index is indeed a straightforward list of increasing numbers, you can then look at the output of print y == range(1,len(y)+1) Hope it helps :) Tsjerk On Mon, Oct 25, 2010 at 10:55 AM, Martin Hedigerma@bluewin.ch wrote: Dear All I'm trying to figure out for myself, what the two labels 'Label Atom Identifiers ID' and 'Label Atom Identifiers index' mean, or what the respective difference between the two is. For sure, the numerical value is very different when I show the labels in a structure. ID seems to be the index of the atom in the list of atom-descriptor lines in the PDB input file. But I cant figure out what 'index' is referring to. Any help on this would be very welcome. Martin -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ 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 -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ 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] Fwd: What is the difference between Atom ID and Index
Hi Martin Tsjerk, There is a another difference between the two aside from the off-by-one characteristic. PyMOL has to keep track of atoms, so a simple 'index' could work. But, then when the user removes an atom from the middle of a structure, do we shift indices above it down? (This could make bonds point to new places!) Leave them as is? (But there aren't N-atoms anymore, there's N-1.) So, PyMOL has two indices, one tracks the absolute numbering (ID) and doesn't change between (molecular) object builds, and the other tracks the atom's relative position from the first atom found. This could be confusing, so how about some code: # create an alanine fragment frag ala # now read the label on the ALA`2/HA; C-alpha's hydrogen # it should read, '7-9' label *, %s-%s % (index,ID) [.. read the label before copying and pasting below ..] # Now, remove the alpha carbon; subsequent commands # will need to rebuild the connection table, generating # new numbers for index remove 2/CA # hide the labels hide labels # now read the label on the 2/HA atom (6-9) label *, %s-%s % (index,ID) Cheers, -- Jason On Mon, Oct 25, 2010 at 6:49 AM, Tsjerk Wassenaar tsje...@gmail.com wrote: Never get used to that only-reply-to-sender policy... -- Forwarded message -- From: Tsjerk Wassenaar tsje...@gmail.com Date: Mon, Oct 25, 2010 at 12:30 PM Subject: Re: [PyMOL] What is the difference between Atom ID and Index To: Martin Hediger ma@bluewin.ch Hi Martin, ID is indeed the atom id from the coordinate (PDB) file. Index, AFAIK, is the atom index in the model, starting from 1. Probably you should get yourself acquainted with the command line and with python, as it will help you to solve these and other problems. For example, you can access properties from the atoms easily through constructions like these: x = [ at.id for at in cmd.get_model(selection).atom ] y = [ at.index for at in cmd.get_model(selection).atom ] That will first build a selection/model object, with a list of atoms (.atom), over which you can iterate to extract some properties. To check whether the index is indeed a straightforward list of increasing numbers, you can then look at the output of print y == range(1,len(y)+1) Hope it helps :) Tsjerk On Mon, Oct 25, 2010 at 10:55 AM, Martin Hediger ma@bluewin.ch wrote: Dear All I'm trying to figure out for myself, what the two labels 'Label Atom Identifiers ID' and 'Label Atom Identifiers index' mean, or what the respective difference between the two is. For sure, the numerical value is very different when I show the labels in a structure. ID seems to be the index of the atom in the list of atom-descriptor lines in the PDB input file. But I cant figure out what 'index' is referring to. Any help on this would be very welcome. Martin -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ 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 -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ 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 -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) jason.vertr...@schrodinger.com (o) +1 (603) 374-7120 -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia