IMP logo
IMP Reference Guide  2.19.0
The Integrative Modeling Platform
mmcif.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/mmcif.h
3  * \brief Functions to read PDBs in mmCIF format
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPATOM_MMCIF_H
10 #define IMPATOM_MMCIF_H
11 
12 #include <IMP/atom/atom_config.h>
13 #include <IMP/atom/Hierarchy.h>
14 #include <IMP/atom/pdb.h>
15 
16 IMPATOM_BEGIN_NAMESPACE
17 
18 //! Read all models from the mmCIF file.
19 IMPATOMEXPORT Hierarchies read_multimodel_mmcif(TextInput input, Model *model,
20  PDBSelector *selector = get_default_pdb_selector()
21 #ifndef IMP_DOXYGEN
22  , bool noradii = false
23 #endif
24  );
25 
26 //! Read all the molecules in the first model of the mmCIF file.
27 IMPATOMEXPORT Hierarchy read_mmcif(TextInput input, Model *model,
28  PDBSelector *selector = get_default_pdb_selector(),
29  bool select_first_model = true
30 #ifndef IMP_DOXYGEN
31  , bool noradii = false
32 #endif
33  );
34 
35 //! Read all the molecules in the first model of the PDB or mmCIF file.
36 /** If the filename ends in '.cif' it is treated as an mmCIF file,
37  otherwise a PDB file is read.
38  Note that TextInputs created from streams don't have a name and so
39  will always be treated as PDB. */
41  PDBSelector *selector = get_default_pdb_selector(),
42  bool select_first_model = true
43 #ifndef IMP_DOXYGEN
44  , bool noradii = false
45 #endif
46  ) {
47  std::string filename = input.get_name();
48  if (filename.find(".cif") == filename.size() - 4) {
49  return read_mmcif(input, model, selector, select_first_model, noradii);
50  } else {
51  return read_pdb(input, model, selector, select_first_model, noradii);
52  }
53 }
54 
55 //! Read all models from the PDB or mmCIF file.
56 /** If the filename ends in '.cif' it is treated as an mmCIF file,
57  otherwise a PDB file is read.
58  Note that TextInputs created from streams don't have a name and so
59  will always be treated as PDB. */
61  PDBSelector *selector = get_default_pdb_selector()
62 #ifndef IMP_DOXYGEN
63  , bool noradii = false
64 #endif
65  ) {
66  std::string filename = input.get_name();
67  if (filename.find(".cif") == filename.size() - 4) {
68  return read_multimodel_mmcif(input, model, selector, noradii);
69  } else {
70  return read_multimodel_pdb(input, model, selector, noradii);
71  }
72 }
73 
74 IMPATOM_END_NAMESPACE
75 
76 #endif /* IMPATOM_MMCIF_H */
Hierarchy read_pdb_or_mmcif(TextInput input, Model *model, PDBSelector *selector=get_default_pdb_selector(), bool select_first_model=true)
Read all the molecules in the first model of the PDB or mmCIF file.
Definition: mmcif.h:40
Hierarchy read_mmcif(TextInput input, Model *model, PDBSelector *selector=get_default_pdb_selector(), bool select_first_model=true)
Read all the molecules in the first model of the mmCIF file.
Functions to read PDBs.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Hierarchies read_multimodel_mmcif(TextInput input, Model *model, PDBSelector *selector=get_default_pdb_selector())
Read all models from the mmCIF file.
Decorator for helping deal with a hierarchy of molecules.
The standard decorator for manipulating molecular structures.
Hierarchy read_pdb(TextInput input, Model *model, PDBSelector *selector=get_default_pdb_selector(), bool select_first_model=true)
Read all the molecules in the first model of the PDB file.
Hierarchies read_multimodel_pdb_or_mmcif(TextInput input, Model *model, PDBSelector *selector=get_default_pdb_selector())
Read all models from the PDB or mmCIF file.
Definition: mmcif.h:60
Hierarchies read_multimodel_pdb(TextInput input, Model *model, PDBSelector *selector=get_default_pdb_selector())
Select which atoms to read from a PDB file.
Definition: pdb.h:43