Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions iotbx/pdb/atom_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class cache(slots_getstate_setstate):
"nucleotide",
"single_atom_residue",
"water",
'ion',
"hetero",
"backbone",
"sidechain",
Expand All @@ -207,6 +208,7 @@ def __init__(self, root, wildcard_escape_char='\\',
self.protein = None
self.nucleotide = None
self.water = None
self.ion = None
self.hetero = None
self.backbone = None
self.sidechain = None
Expand Down Expand Up @@ -340,6 +342,17 @@ def get_water(self):
self.water = (atoms.extract_tmp_as_size_t() == 1).iselection()
return [self.water]

def get_ion(self):
from mmtbx.monomer_library.linking_setup import ad_hoc_single_metal_residue_element_types
if self.ion is None:
atoms = self.root.atoms()
atoms.set_chemical_element_simple_if_necessary()
for atom in atoms:
if atom.element.upper() in ad_hoc_single_metal_residue_element_types:
atom.tmp=1
self.ion = (atoms.extract_tmp_as_size_t() == 1).iselection()
return [self.ion]

def get_protein(self):
if self.protein is None:
import iotbx.pdb
Expand Down Expand Up @@ -524,6 +537,9 @@ def sel_nucleotide(self):
def sel_water(self):
return self.union(iselections=self.get_water())

def sel_ion(self):
return self.union(iselections=self.get_ion())

def sel_hetero(self):
return self.union(iselections=self.get_hetero())

Expand Down Expand Up @@ -711,6 +727,8 @@ def try_compose_sequence():
result_stack.append(self.sel_single_atom_residue())
elif (lword == "water"):
result_stack.append(self.sel_water())
elif (lword == "ion"):
result_stack.append(self.sel_ion())
elif (lword == "hetero") or (lword == "hetatm"):
result_stack.append(self.sel_hetero())
elif (lword == "bfactor") or (lword == "occupancy"):
Expand Down
39 changes: 39 additions & 0 deletions mmtbx/monomer_library/linking_setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# see iotbx/pdb/common_residue_names.h; additionally here only: U I
from __future__ import absolute_import, division, print_function

ad_hoc_single_metal_residue_element_types_more_complete = """\
LI BE
NA MG
AL
K CA
SC TI V CR MN FE CO NI CU ZN
GA GE AS SE
RB SR
Y ZR NB MO TC RU RH PD AG CD
IN SN SB TE I
CS BA
LA HF TA W RE OS IR PT AU HG
TL PB BI PO AT
FR RA
AC
CE PR ND PM SM EU GD TB DY HO ER TM YB LU
TB PA U NP PU AM CM BK CF ES FM MD NO LW
""".split()

ad_hoc_single_metal_residue_element_types = """\
ZN CA MG NA MN K FE CU CD HG NI CO SR CS PT BA TL PB SM AU RB YB LI
MO LU CR OS GD TB LA AG HO GA CE W RU RE PR IR EU AL V PD U
Expand Down Expand Up @@ -148,5 +167,25 @@ def skip_if_non_linking(lookup, atom1, atom2):
assert 0

if __name__=="__main__":
from libtbx import easy_run
print(skip_if_both)
print(skip_if_longer)
from mmtbx.monomer_library.pdb_interpretation import ad_hoc_single_atom_residue_element_types
s1 = set(ad_hoc_single_metal_residue_element_types_more_complete)
s1 = set(ad_hoc_single_atom_residue_element_types)
s2 = set(ad_hoc_single_metal_residue_element_types)
print(s1)
print(s2)
print('-'*80)
print(s1.difference(s2))
print('-'*80)
print(s2.difference(s1))
print('-'*80)
# for e in ad_hoc_single_metal_residue_element_types_more_complete:
# cmd='mmtbx.where_is_that_cif_file %s source=ccd' % e
# print(cmd)
# rc=easy_run.go(cmd)
# print(dir(rc))
# for line in rc.stdout_lines:
# print(line)
# # assert 0
Loading