OpenStructure
__init__.py
Go to the documentation of this file.
1 #------------------------------------------------------------------------------
2 # This file is part of the OpenStructure project <www.openstructure.org>
3 #
4 # Copyright (C) 2008-2020 by the OpenStructure authors
5 #
6 # This library is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU Lesser General Public License as published by the Free
8 # Software Foundation; either version 3.0 of the License, or (at your option)
9 # any later version.
10 # This library is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this library; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #------------------------------------------------------------------------------
19 import os, tempfile, ftplib, http.client
20 
21 from ._ost_io import *
22 from ost import mol, geom, conop, seq
23 
24 class IOProfiles:
25  def __init__(self):
26  self._dict_dict={}
27 
28  if conop.GetDefaultLib():
29  processor = conop.RuleBasedProcessor(conop.GetDefaultLib())
30  else:
31  processor = conop.HeuristicProcessor()
32  self['STRICT'] = IOProfile(dialect='PDB', fault_tolerant=False,
33  processor=processor.Copy())
34  self['SLOPPY'] = IOProfile(dialect='PDB', fault_tolerant=True,
35  processor=processor.Copy())
36  self['CHARMM'] = IOProfile(dialect='CHARMM', fault_tolerant=True,
37  processor=processor.Copy())
38  self['DEFAULT'] = 'STRICT'
39 
40  def __getitem__(self, key):
41  return IOProfileRegistry.Instance().Get(key)
42 
43  def __setitem__(self, key, value):
44  if isinstance(value, str):
45  value=self[value].Copy()
46  IOProfileRegistry.Instance().Set(key, value)
47  self._dict_dict[key]=value
48 
49  def Get(self, key):
50  """ Getter which keeps compound library up to date
51 
52  Keeps compound library for default profiles up to date. Reason for that is
53  that conop.SetDefaultLib() after importing io has no effect. Processors
54  (and the associated compound library) are set at import. Custom profiles,
55  i.e. profiles that are not defined in constructor of this class, are
56  returned as is without any update.
57  """
58  if key not in ['STRICT', 'SLOPPY', 'CHARMM', 'DEFAULT']:
59  return self[key].Copy()
60  prof = self[key].Copy()
61  if conop.GetDefaultLib():
62  processor = conop.RuleBasedProcessor(conop.GetDefaultLib())
63  else:
64  processor = conop.HeuristicProcessor()
65  prof.processor = processor
66  return prof
67 
68  def __len__(self):
69  return len(self._dict_dict)
70 
71  def __iter__(self):
72  return self._dict_dict.__iter__()
73 
74 profiles = IOProfiles()
75 
76 def _override(val1, val2):
77  if val2!=None:
78  return val2
79  else:
80  return val1
81 
82 def LoadPDB(filename, restrict_chains="", no_hetatms=None,
83  fault_tolerant=None, load_multi=False,
84  join_spread_atom_records=None, calpha_only=None,
85  profile='DEFAULT', remote=False, remote_repo='pdb',
86  dialect=None, seqres=False, bond_feasibility_check=None,
87  read_conect=False):
88  """
89  Load PDB file from disk and return one or more entities. Several options
90  allow to customize the exact behaviour of the PDB import. For more information
91  on these options, see :doc:`profile`.
92 
93  Residues are flagged as ligand if they are mentioned in a HET record.
94 
95  :param filename: File to be loaded
96  :type filename: :class:`str`
97 
98  :param restrict_chains: If not an empty string, only chains listed in the
99  string will be imported.
100  :type restrict_chains: :class:`str`
101 
102  :param no_hetatms: If set to True, HETATM records will be ignored. Overrides
103  the value of :attr:`IOProfile.no_hetatms`
104  :type no_hetatms: :class:`bool`
105 
106  :param fault_tolerant: Enable/disable fault-tolerant import. If set, overrides
107  the value of :attr:`IOProfile.fault_tolerant`.
108  :type fault_tolerant: :class:`bool`
109 
110  :param load_multi: If set to True, a list of entities will be returned instead
111  of only the first. This is useful when dealing with
112  multi-PDB files.
113  :type load_multi: :class:`bool`
114 
115  :param join_spread_atom_records: If set, overrides the value of
116  :attr:`IOProfile.join_spread_atom_records`.
117  :type join_spread_atom_records: :class:`bool`
118 
119  :param calpha_only: When set to true, forces the importer to only load atoms
120  named CA. If set, overrides the value of
121  :attr:`IOProfile.calpha_only`.
122  :type calpha_only: :class:`bool`
123 
124  :param profile: Aggregation of flags and algorithms to control import and
125  processing of molecular structures. Can either be a
126  :class:`str` specifying one of the default profiles
127  ['DEFAULT', 'SLOPPY', 'CHARMM', 'STRICT'] or an actual object
128  of type :class:`ost.io.IOProfile`. If a :class:`str` defines
129  a default profile, :attr:`IOProfile.processor` is set to
130  :class:`ost.conop.RuleBasedProcessor` with the currently
131  set :class:`ost.conop.CompoundLib` available as
132  :func:`ost.conop.GetDefaultLib()`. If no
133  :class:`ost.conop.CompoundLib` is available,
134  :class:`ost.conop.HeuristicProcessor` is used instead. See
135  :doc:`profile` for more info.
136  :type profile: :class:`str`/:class:`ost.io.IOProfile`
137 
138  :param remote: If set to True, the method tries to load the pdb from the remote
139  repository given as *remote_repo*. The filename is then
140  interpreted as the entry id as further specified for the
141  *remote_repo* parameter.
142  :type remote: :class:`bool`
143 
144  :param remote_repo: Remote repository to fetch structure if *remote* is True.
145  Must be one in ['pdb', 'smtl', 'pdb_redo']. In case of
146  'pdb' and 'pdb_redo', the entry must be given as lower
147  case pdb id, which loads the deposited assymetric unit
148  (e.g. '1ake'). In case of 'smtl', the entry must also
149  specify the desired biounit (e.g. '1ake.1').
150  :type remote_repo: :class:`str`
151 
152  :param dialect: Specifies the particular dialect to use. If set, overrides
153  the value of :attr:`IOProfile.dialect`
154  :type dialect: :class:`str`
155 
156  :param seqres: Whether to read SEQRES records. If set to True, the loaded
157  entity and seqres entry will be returned as a tuple.
158  If file doesnt contain SEQRES records, the returned
159  :class:`ost.seq.SequenceList` will be invalid.
160  :type seqres: :class:`bool`
161 
162  :param bond_feasibility_check: Flag for :attr:`IOProfile.processor`. If
163  turned on, atoms are only connected by
164  bonds if they are within a reasonable distance
165  (as defined by
166  :func:`ost.conop.IsBondFeasible`).
167  If set, overrides the value of
168  :attr:`ost.conop.Processor.check_bond_feasibility`
169  :type bond_feasibility_check: :class:`bool`
170  :param read_conect: By default, OpenStructure doesn't read CONECT statements in
171  a pdb file. Reason is that they're often missing and we prefer
172  to rely on the chemical component dictionary from the PDB.
173  However, there may be cases where you really want these CONECT
174  statements. For example novel compounds with no entry in
175  the chemical component dictionary. Setting this to True has
176  two effects: 1) CONECT statements are read and blindly applied
177  2) The processor does not connect any pair of HETATOM atoms in
178  order to not interfer with the CONECT statements.
179  :type read_conect: :class:`bool`
180 
181  :rtype: :class:`~ost.mol.EntityHandle` or a list thereof if `load_multi` is
182  True.
183 
184  :raises: :exc:`~ost.io.IOException` if the import fails due to an erroneous or
185  inexistent file
186  """
187  def _override(val1, val2):
188  if val2!=None:
189  return val2
190  else:
191  return val1
192  if isinstance(profile, str):
193  prof=profiles.Get(profile)
194  elif isinstance(profile, IOProfile):
195  prof=profile.Copy()
196  else:
197  raise TypeError('profile must be of type string or IOProfile, '+\
198  'instead of %s'%type(profile))
199  if dialect not in (None, 'PDB', 'CHARMM',):
200  raise ValueError('dialect must be PDB or CHARMM')
201  prof.calpha_only=_override(prof.calpha_only, calpha_only)
202  prof.no_hetatms=_override(prof.no_hetatms, no_hetatms)
203  prof.dialect=_override(prof.dialect, dialect)
204  prof.read_conect=_override(prof.read_conect, read_conect)
205  if prof.processor:
206  prof.processor.check_bond_feasibility=_override(prof.processor.check_bond_feasibility,
207  bond_feasibility_check)
208  prof.processor.connect_hetatm=_override(prof.processor.connect_hetatm,
209  not read_conect)
210  prof.fault_tolerant=_override(prof.fault_tolerant, fault_tolerant)
211  prof.join_spread_atom_records=_override(prof.join_spread_atom_records,
212  join_spread_atom_records)
213 
214  tmp_file = None # avoid getting out of scope
215  if remote:
216  if remote_repo not in ['pdb', 'smtl', 'pdb_redo']:
217  raise IOError("remote_repo must be in ['pdb', 'smtl', 'pdb_redo']")
218  from ost.io.remote import RemoteGet
219  tmp_file =RemoteGet(filename, from_repo=remote_repo)
220  filename = tmp_file.name
221 
222  conop_inst=conop.Conopology.Instance()
223  if prof.processor:
224  if prof.dialect=='PDB':
225  prof.processor.dialect=conop.PDB_DIALECT
226  elif prof.dialect=='CHARMM':
227  prof.processor.dialect=conop.CHARMM_DIALECT
228  reader=PDBReader(filename, prof)
229  reader.read_seqres=seqres
230  try:
231  if load_multi:
232  ent_list=[]
233  while reader.HasNext():
234  ent=mol.CreateEntity()
235  reader.Import(ent, restrict_chains)
236  if prof.processor:
237  prof.processor.Process(ent)
238  ent_list.append(ent)
239  if len(ent_list)==0:
240  raise IOError("File '%s' doesn't contain any entities" % filename)
241  return ent_list
242  else:
243  ent=mol.CreateEntity()
244  if reader.HasNext():
245  reader.Import(ent, restrict_chains)
246  if prof.processor:
247  prof.processor.Process(ent)
248  else:
249  raise IOError("File '%s' doesn't contain any entities" % filename)
250  if seqres:
251  return ent, reader.seqres
252  return ent
253  except:
254  raise
255 
256 def SavePDB(models, filename, dialect=None, pqr=False, profile='DEFAULT'):
257  """
258  Save entity or list of entities to disk. If a list of entities is supplied
259  the PDB file will be saved as a multi PDB file. Each of the entities is
260  wrapped into a MODEL/ENDMDL pair.
261 
262  If the atom number exceeds 99999, '*****' is used.
263 
264  :param models: The entity or list of entities (handles or views) to be saved
265  :param filename: The filename
266  :type filename: string
267  :raises: IOException if the restrictions of the PDB format are not satisfied
268  (with the exception of atom numbers, see above):
269 
270  * Chain names with more than one character
271  * Atom positions with coordinates outside range [-999.99, 9999.99]
272  * Residue names longer than three characters
273  * Atom names longer than four characters
274  * Numeric part of :class:`ost.mol.ResNum` outside range [-999, 9999]
275  * Alternative atom indicators longer than one character
276  """
277  if not getattr(models, '__len__', None):
278  models=[models]
279  if isinstance(profile, str):
280  profile=profiles.Get(profile)
281  elif isinstance(profile, IOProfile):
282  profile = profile.Copy()
283  else:
284  raise TypeError('profile must be of type string or IOProfile, '+\
285  'instead of %s'%type(profile))
286  profile.dialect=_override(profile.dialect, dialect)
287  writer=PDBWriter(filename, profile)
288  writer.SetIsPQR(pqr)
289  if len(models)>1:
290  writer.write_multi_model=True
291  for model in models:
292  writer.Write(model)
293 
294 try:
295  from ost import img
296  LoadMap = LoadImage
297  SaveMap = SaveImage
298 except ImportError:
299  pass
300 
301 
303 def LoadImageList (files):
304  image_list=img.ImageList()
305  for file in files:
306  image=LoadImage(file)
307  image_list.append(image)
308  return image_list
309 
310 LoadMapList=LoadImageList
311 
312 def LoadCHARMMTraj(crd, dcd_file=None, profile='CHARMM',
313  lazy_load=False, stride=1,
314  dialect=None, detect_swap=True,swap_bytes=False):
315  """
316  Load CHARMM trajectory file.
317 
318  :param crd: EntityHandle or filename of the (PDB) file containing the
319  structure. The structure must have the same number of atoms as the
320  trajectory
321  :param dcd_file: The filename of the DCD file. If not set, and crd is a
322  string, the filename is set to the <crd>.dcd
323  :param layz_load: Whether the trajectory should be loaded on demand. Instead
324  of loading the complete trajectory into memory, the trajectory frames are
325  loaded from disk when requested.
326  :param stride: The spacing of the frames to load. When set to 2, for example,
327  every second frame is loaded from the trajectory. By default, every frame
328  is loaded.
329  :param dialect: The dialect for the PDB file to use. See :func:`LoadPDB`. If
330  set, overrides the value of the profile
331  :param profile: The IO profile to use for loading the PDB file. See
332  :doc:`profile`.
333  :param detect_swap: if True (the default), then automatic detection of endianess
334  is attempted, otherwise the swap_bytes parameter is used
335  :param swap_bytes: is detect_swap is False, this flag determines whether bytes
336  are swapped upon loading or not
337  """
338  if not isinstance(crd, mol.EntityHandle):
339  if dcd_file==None:
340  dcd_file='%s.dcd' % os.path.splitext(crd)[0]
341  crd=LoadPDB(crd, profile=profile, dialect=dialect)
342 
343  else:
344  if not dcd_file:
345  raise ValueError("No DCD filename given")
346  return LoadCHARMMTraj_(crd, dcd_file, stride, lazy_load, detect_swap, swap_bytes)
347 
348 def LoadMMCIF(filename, fault_tolerant=None, calpha_only=None,
349  profile='DEFAULT', remote=False, seqres=False, info=False):
350  """
351  Load an mmCIF file and return the first model as an entity.
352 
353  Several options allow to customize the exact behaviour of the mmCIF import.
354  For more information on these options, see :doc:`profile`.
355 
356  Residues are flagged as ligand if they are not waters nor covered by an
357  ``entity_poly`` record (ie. they are non-polymer entities in
358  ``pdbx_entity_nonpoly``). Note that all residues except waters will be
359  flagged as ligands if ``seqres=False`` (the default).
360 
361  :param filename: File to be loaded
362  :type filename: :class:`str`
363 
364  :param fault_tolerant: Enable/disable fault-tolerant import. If set, overrides
365  the value of :attr:`IOProfile.fault_tolerant`.
366  :type fault_tolerant: :class:`bool`
367 
368  :param calpha_only: When set to true, forces the importer to only load atoms
369  named CA. If set, overrides the value of
370  :attr:`IOProfile.calpha_only`.
371  :type calpha_only: :class:`bool`
372 
373  :param profile: Aggregation of flags and algorithms to control import and
374  processing of molecular structures. Can either be a
375  :class:`str` specifying one of the default profiles
376  ['DEFAULT', 'SLOPPY', 'CHARMM', 'STRICT'] or an actual object
377  of type :class:`ost.io.IOProfile`. If a :class:`str` defines
378  a default profile, :attr:`IOProfile.processor` is set to
379  :class:`ost.conop.RuleBasedProcessor` with the currently
380  set :class:`ost.conop.CompoundLib` available as
381  :func:`ost.conop.GetDefaultLib()`. If no
382  :class:`ost.conop.CompoundLib` is available,
383  :class:`ost.conop.HeuristicProcessor` is used instead. See
384  :doc:`profile` for more info.
385  :type profile: :class:`str`/:class:`ost.io.IOProfile`
386 
387  :param remote: If set to True, the method tries to load the pdb from the
388  remote pdb repository www.pdb.org. The filename is then
389  interpreted as the pdb id.
390  :type remote: :class:`bool`
391 
392  :param seqres: Whether to return SEQRES records. If True, a
393  :class:`~ost.seq.SequenceList` object is returned as the second
394  item. The sequences in the list are named according to the
395  mmCIF chain name.
396  This feature requires a default
397  :class:`compound library <ost.conop.CompoundLib>`
398  to be defined and accessible via
399  :func:`~ost.conop.GetDefaultLib`. One letter codes of non
400  standard compounds are set to X otherwise.
401  :type seqres: :class:`bool`
402 
403  :param info: Whether to return an info container with the other output.
404  If True, a :class:`MMCifInfo` object is returned as last item.
405  :type info: :class:`bool`
406 
407  :rtype: :class:`~ost.mol.EntityHandle` (or tuple if *seqres* or *info* are
408  True).
409 
410  :raises: :exc:`~ost.io.IOException` if the import fails due to an erroneous
411  or non-existent file.
412  """
413  def _override(val1, val2):
414  if val2!=None:
415  return val2
416  else:
417  return val1
418  if isinstance(profile, str):
419  prof = profiles.Get(profile)
420  else:
421  prof = profile.Copy()
422 
423  prof.calpha_only=_override(prof.calpha_only, calpha_only)
424  prof.fault_tolerant=_override(prof.fault_tolerant, fault_tolerant)
425 
426  if remote:
427  from ost.io.remote import RemoteGet
428  tmp_file = RemoteGet(filename, from_repo='cif')
429  filename = tmp_file.name
430 
431  try:
432  ent = mol.CreateEntity()
433  reader = MMCifReader(filename, ent, prof)
434 
435  # NOTE: to speed up things, we could introduce a restrict_chains parameter
436  # similar to the one in LoadPDB. Here, it would have to be a list/set
437  # of chain-name-strings.
438 
439  #if reader.HasNext():
440  reader.Parse() # branch links are connected in here
441  if prof.processor:
442  prof.processor.Process(ent)
443  #else:
444  # raise IOError("File doesn't contain any entities")
445  if seqres and info:
446  return ent, reader.seqres, reader.info
447  if seqres:
448  return ent, reader.seqres
449  if info:
450  return ent, reader.info
451  return ent
452  except:
453  raise
454 
455 
456 def SaveMMCIF(ent, filename, compound_lib = conop.GetDefaultLib(),
457  data_name="OST_structure", mmcif_conform = True,
458  entity_info = MMCifWriterEntityList()):
459  """
460  Save OpenStructure entity in mmCIF format
461 
462  :param ent: OpenStructure Entity to be saved
463  :param filename: Filename - .gz suffix triggers gzip compression
464  :param compound_lib: Compound library required when writing, uses
465  :func:`ost.conop.GetDefaultLib` if not given
466  :param data_name: Name of data block that will be written to
467  mmCIF file. Typically, thats the PDB ID or some
468  identifier.
469  :param mmcif_conform: Controls processing of structure, i.e. identification
470  of mmCIF entities etc. before writing. Detailed
471  description in :ref:`MMCif writing`. In short:
472  If *mmcif_conform* is set to True, Chains in *ent* are
473  expected to be valid mmCIF entities with residue numbers
474  set according to underlying SEQRES. That should be the
475  case when *ent* has been loaded with :func:`LoadMMCIF`.
476  If *mmcif_conform* is set to False, heuristics kick in
477  to identify and separate mmCIF entities based on
478  :class:`ost.mol.ChemClass` of the residues in a chain.
479  :type ent: :class:`ost.mol.EntityHandle`/:class:`ost.mol.EntityView`
480  :param entity_info: Advanced usage - description in :ref:`MMCif writing`
481  :type filename: :class:`str`
482  :type compound_lib: :class:`ost.conop.CompoundLib`
483  :type data_name: :class:`str`
484  :type mmcif_conform: :class:`bool`
485  :type entity_info: :class:`MMCifWriterEntityList`
486  """
487  if compound_lib is None:
488  raise RuntimeError("Require valid compound library to write mmCIF format")
489  writer = MMCifWriter()
490  writer.SetStructure(ent, compound_lib, mmcif_conform = mmcif_conform,
491  entity_info = entity_info)
492  writer.Write(data_name, filename)
493 
494 
495 
496 # this function uses a dirty trick: should be a member of MMCifInfoBioUnit
497 # which is totally C++, but we want the method in Python... so we define it
498 # here (__init__) and add it as a member to the class. With this, the first
499 # arguement is the usual 'self'.
500 # documentation for this function was moved to mmcif.rst,
501 # MMCifInfoBioUnit.PDBize, since this function is not included in SPHINX.
502 def _PDBize(biounit, asu, seqres=None, min_polymer_size=None,
503  transformation=False, peptide_min_size=10, nucleicacid_min_size=10,
504  saccharide_min_size=10):
505  if min_polymer_size is not None:
506  pdbizer = mol.alg.PDBize(min_polymer_size=min_polymer_size)
507  else:
508  pdbizer = mol.alg.PDBize(peptide_min_size=peptide_min_size,
509  nucleicacid_min_size=nucleicacid_min_size,
510  saccharide_min_size=saccharide_min_size)
511 
512  chains = biounit.GetChainList()
513  c_intvls = biounit.GetChainIntervalList()
514  o_intvls = biounit.GetOperationsIntervalList()
515  ss = seqres
516  if not ss:
517  ss = seq.CreateSequenceList()
518  # create list of operations
519  # for cartesian products, operations are stored in a list, multiplied with
520  # the next list of operations and re-stored... until all lists of operations
521  # are multiplied in an all-against-all manner.
522  operations = biounit.GetOperations()
523  for i in range(0,len(c_intvls)):
524  trans_matrices = geom.Mat4List()
525  l_operations = operations[o_intvls[i][0]:o_intvls[i][1]]
526  if len(l_operations) > 0:
527  for op in l_operations[0]:
528  rot = geom.Mat4()
529  rot.PasteRotation(op.rotation)
530  trans = geom.Mat4()
531  trans.PasteTranslation(op.translation)
532  tr = geom.Mat4()
533  tr = trans * rot
534  trans_matrices.append(tr)
535  for op_n in range(1, len(l_operations)):
536  tmp_ops = geom.Mat4List()
537  for o in l_operations[op_n]:
538  rot = geom.Mat4()
539  rot.PasteRotation(o.rotation)
540  trans = geom.Mat4()
541  trans.PasteTranslation(o.translation)
542  tr = geom.Mat4()
543  tr = trans * rot
544  for t_o in trans_matrices:
545  tp = t_o * tr
546  tmp_ops.append(tp)
547  trans_matrices = tmp_ops
548  # select chains into a view as basis for each transformation
549  assu = asu.Select('cname='+','.join(mol.QueryQuoteName(name) \
550  for name in \
551  chains[c_intvls[i][0]:c_intvls[i][1]]))
552  pdbizer.Add(assu, trans_matrices, ss)
553  pdb_bu = pdbizer.Finish(transformation)
554  if transformation:
555  return pdb_bu, pdb_bu.GetTransform().GetMatrix()
556  return pdb_bu
557 
558 MMCifInfoBioUnit.PDBize = _PDBize
559 
560 
561 def LoadSDF(filename, fault_tolerant=None, profile='DEFAULT'):
562  """
563  Load SDF file from disk and return an entity.
564 
565  :param filename: File to be loaded
566  :type filename: :class:`str`
567 
568  :param fault_tolerant: Enable/disable fault-tolerant import. If set, overrides
569  the value of :attr:`IOProfile.fault_tolerant`.
570  :type fault_tolerant: :class:`bool`
571 
572  :param profile: Aggregation of flags and algorithms to control import and
573  processing of molecular structures. Can either be a
574  :class:`str` specifying one of the default profiles
575  ['DEFAULT', 'SLOPPY', 'CHARMM', 'STRICT'] or an actual object
576  of type :class:`ost.io.IOProfile`.
577  See :doc:`profile` for more info.
578  :type profile: :class:`str`/:class:`ost.io.IOProfile`
579 
580  :raises: :exc:`~ost.io.IOException` if the import fails due to an erroneous or
581  inexistent file
582  """
583  def _override(val1, val2):
584  if val2 != None:
585  return val2
586  else:
587  return val1
588 
589  if isinstance(profile, str):
590  prof = profiles.Get(profile)
591  elif isinstance(profile, IOProfile):
592  prof = profile.Copy()
593  else:
594  raise TypeError('profile must be of type string or IOProfile, ' + \
595  'instead of %s' % type(profile))
596  prof.fault_tolerant = _override(prof.fault_tolerant, fault_tolerant)
597 
598  reader = SDFReader(filename, prof)
599  ent = mol.CreateEntity()
600  reader.Import(ent)
601  return ent
Manages a collection of images.
Definition: image_list.hh:43
def __iter__(self)
Definition: __init__.py:71
def Get(self, key)
Definition: __init__.py:49
def __len__(self)
Definition: __init__.py:68
def __getitem__(self, key)
Definition: __init__.py:40
def __init__(self)
Definition: __init__.py:25
def __setitem__(self, key, value)
Definition: __init__.py:43
reader for the mmcif file format
Definition: mmcif_reader.hh:61
Protein or molecule.
std::vector< Mat4 > Mat4List
Definition: mat4.hh:141
def RemoteGet(id, from_repo='pdb')
Definition: remote.py:124
def SavePDB(models, filename, dialect=None, pqr=False, profile='DEFAULT')
Definition: __init__.py:256
def LoadPDB(filename, restrict_chains="", no_hetatms=None, fault_tolerant=None, load_multi=False, join_spread_atom_records=None, calpha_only=None, profile='DEFAULT', remote=False, remote_repo='pdb', dialect=None, seqres=False, bond_feasibility_check=None, read_conect=False)
Definition: __init__.py:87
def LoadImageList(files)
Definition: __init__.py:303
mol::CoordGroupHandle DLLEXPORT_OST_IO LoadCHARMMTraj(const mol::EntityHandle &ent, const String &trj_filename, unsigned int stride=1, bool lazy_load=false, bool detect_swap=true, bool byte_swap=false)
import a CHARMM trajectory in dcd format with an existing entity requires the existing entity and the...
mol::EntityHandle DLLEXPORT_OST_IO LoadSDF(const String &file_name)
def SaveMMCIF(ent, filename, compound_lib=conop.GetDefaultLib(), data_name="OST_structure", mmcif_conform=True, entity_info=MMCifWriterEntityList())
Definition: __init__.py:458
DLLEXPORT_OST_IO img::ImageHandle LoadImage(const boost::filesystem::path &loc)
Function that loads an image from a file.
def LoadMMCIF(filename, fault_tolerant=None, calpha_only=None, profile='DEFAULT', remote=False, seqres=False, info=False)
Definition: __init__.py:349