Chemical Data Processing Library C++ API - Version 1.2.0
ResidueList.hpp
Go to the documentation of this file.
1 /*
2  * ResidueList.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_BIOMOL_RESIDUELIST_HPP
30 #define CDPL_BIOMOL_RESIDUELIST_HPP
31 
32 #include <cstddef>
33 #include <string>
34 #include <unordered_map>
35 #include <memory>
36 
40 
41 
42 namespace CDPL
43 {
44 
45  namespace Biomol
46  {
47 
52  {
53 
54  public:
58  typedef std::shared_ptr<ResidueList> SharedPointer;
59 
64 
70  ResidueList(const Chem::MolecularGraph& molgraph, unsigned int flags = AtomPropertyFlag::DEFAULT);
71 
77  void extract(const Chem::MolecularGraph& molgraph, unsigned int flags = AtomPropertyFlag::DEFAULT);
78 
79  private:
80  struct ResidueID
81  {
82 
83  std::size_t modelNumber;
84  std::string chainID;
85  char insCode;
86  std::string resCode;
87  long seqNumber;
88 
89  bool operator==(const ResidueID& res_id) const;
90  };
91 
92  struct ResidueIDHashFunc
93  {
94 
95  std::size_t operator()(const ResidueID& res_id) const;
96  };
97 
98  void initResidueID(const Chem::Atom& atom, ResidueID& res_id, unsigned int flags) const;
99 
100  const char* getClassName() const
101  {
102  return "ResidueList";
103  }
104 
105  typedef std::unordered_map<ResidueID, Chem::Fragment::SharedPointer, ResidueIDHashFunc> ResidueIDToFragmentMap;
106 
107  ResidueIDToFragmentMap resIDsToFragments;
108  };
109  } // namespace Biomol
110 } // namespace CDPL
111 
112 #endif // CDPL_BIOMOL_RESIDUELIST_HPP
Definition of the preprocessor macro CDPL_BIOMOL_API.
#define CDPL_BIOMOL_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of constants in namespace CDPL::Biomol::AtomPropertyFlag.
Definition of the class CDPL::Chem::FragmentList.
Implements the extraction of residues in biological macromolecules.
Definition: ResidueList.hpp:52
std::shared_ptr< ResidueList > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated ResidueList instances.
Definition: ResidueList.hpp:58
ResidueList()
Constructs an empty ResidueList instance.
Definition: ResidueList.hpp:63
ResidueList(const Chem::MolecularGraph &molgraph, unsigned int flags=AtomPropertyFlag::DEFAULT)
Constructs a ResidueList instance that contains the residues of the molecular graph molgraph.
void extract(const Chem::MolecularGraph &molgraph, unsigned int flags=AtomPropertyFlag::DEFAULT)
Replaces the current list of residues by the residues in the molecular graph molgraph.
Atom.
Definition: Atom.hpp:52
A data type for the storage of Chem::Fragment objects.
Definition: FragmentList.hpp:49
MolecularGraph.
Definition: MolecularGraph.hpp:52
constexpr unsigned int DEFAULT
Represents the default set of atom properties.
Definition: Biomol/AtomPropertyFlag.hpp:53
GridEquality< E1, E2 >::ResultType operator==(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:339
The namespace of the Chemical Data Processing Library.