Author: bugman Date: Thu Jan 15 18:41:28 2009 New Revision: 8486 URL: http://svn.gna.org/viewcvs/relax?rev=8486&view=rev Log: Added an amino acid translation table for determining elements from PDB atom names. Modified: branches/multi_structure/generic_fns/structure/internal.py Modified: branches/multi_structure/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_structure/generic_fns/structure/internal.py?rev=8486&r1=8485&r2=8486&view=diff ============================================================================== --- branches/multi_structure/generic_fns/structure/internal.py (original) +++ branches/multi_structure/generic_fns/structure/internal.py Thu Jan 15 18:41:28 2009 @@ -1333,8 +1333,22 @@ # Strip away atom numbering, from the front and end. element = strip(atom_name, digits) + # Amino acid atom translation table (note, numbers have been stripped already!). + table = {'C': ['CA', 'CB', 'CG', 'CD', 'CE', 'CZ'], + 'N': ['NE', 'NH'], + 'H': ['HA', 'HB', 'HG', 'HD', 'HE', 'HT'], + 'O': ['OG', 'OD', 'OE'], + 'S': ['SD'] + } + + # Translate amino acids. + for key in table.keys(): + if element in table[key]: + element = key + break + # Allowed element list. - elements = ['H', 'C', 'N', 'O', 'F', 'P'] + elements = ['H', 'C', 'N', 'O', 'F', 'P', 'S'] # Return the element, if in the list. if element in elements: