Victor
 All Data Structures Functions Variables Friends Pages
PdbLoader.h
1 /* This file is part of Victor.
2 
3  Victor is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 3 of the License, or
6  (at your option) any later version.
7 
8  Victor is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with Victor. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef _PDB_LOADER_H_
18 #define _PDB_LOADER_H_
19 
20 // Includes:
21 #include <string.h>
22 #include <utility>
23 #include <Loader.h>
24 #include <AminoAcid.h>
25 #include <Spacer.h>
26 #include <LigandSet.h>
27 #include <Protein.h>
28 
29 // Global constants, typedefs, etc. (to avoid):
30 
31 namespace Victor { namespace Biopool {
32 
36  class PdbLoader : public Loader {
37  public:
38 
39  // CONSTRUCTORS/DESTRUCTOR:
55  PdbLoader(istream& _input = cin, bool _permissive = false,
56  bool _noHAtoms = false, bool _noHetAtoms = false, bool _noSecondary = false,
57  bool _noConnection = false, bool _noWater = true,
58  bool _verb = true, bool _allChains = false, string _NULL = "", bool _onlyMetal = false,
59  bool _noNucleotideChains = true)
60  : input(_input), permissive(_permissive), valid(true),
61  noHAtoms(_noHAtoms), noHetAtoms(_noHetAtoms), noSecondary(_noSecondary),
62  noConnection(_noConnection), noWater(_noWater), verbose(_verb),
63  allChains(_allChains), chain(' '), model(999), altAtom('A'), helixCode(_NULL),
64  //sheetCode(_NULL), helixData(), sheetData(), onlyMetalHetAtoms(_onlyMetal),
65  sheetCode(_NULL), onlyMetalHetAtoms(_onlyMetal),
66  noNucleotideChains(_noNucleotideChains) {
67  }
68 
69  // this class uses the implicit copy operator.
70 
71  virtual ~PdbLoader() {
72  PRINT_NAME;
73  }
74 
75  // PREDICATES:
76 
77  bool isValid() {
78  return valid;
79  }
80  void checkModel(); //to check input values ​​
81  void checkAndSetChain(); //chosen by the user
82  unsigned int getMaxModels();
83  unsigned int getMaxModelsFast();
84  vector<char> getAllChains();
85 
86  // MODIFIERS:
87 
88  void setPermissive() {
89  permissive = true;
90  }
91 
92  void setNonPermissive() {
93  permissive = false;
94  }
95 
96  void setVerbose() {
97  verbose = true;
98  }
99 
100  void setNoVerbose() {
101  verbose = false;
102  }
103 
104  void setChain(char _ch) {
105  chain = _ch;
106  }
107 
108  void setModel(unsigned int _mod) {
109  model = _mod;
110  }
111 
112  void setAltAtom(char _a) {
113  altAtom = _a;
114  }
115 
116  void setNoHAtoms() {
117  noHAtoms = true;
118  }
119 
120  void setNoHetAtoms() {
121  noHetAtoms = true;
122  }
123  void setOnlyMetalHetAtoms();
124 
125  void setNoSecondary() {
126  noSecondary = true;
127  }
128 
129  void setWithSecondary() {
130  noSecondary = false;
131  }
132 
133  void setNoConnection() {
134  noConnection = true;
135  }
136 
137  void setWithConnection() {
138  noConnection = false;
139  }
140 
141  void setWater();
142 
143  void setAllChains() {
144  allChains = true;
145  }
146 
147 
148 
149  //virtual void loadSpacer(Spacer& sp);
150  //virtual void loadLigandSet(LigandSet& l);
151  virtual void loadProtein(Protein& prot);
152 
153 
154 
155  //virtual void loadNucleotideChainSet(NucleotideChainSet& ns); //new class, new code by Damiano
156 
157  protected:
158  // HELPERS:
159  bool setBonds(Spacer& sp);
160  bool inSideChain(const AminoAcid& aa, const Atom& at);
161  void loadSecondary();
162  void assignSecondary(Spacer& sp);
163  int parsePDBline(string atomLine, string tag, Ligand* lig, AminoAcid* aa);
164 
165 
166 
167  // ATTRIBUTES
168  private:
169  istream& input; //input stream
170  bool permissive; //
171  bool valid; //
172  bool noHAtoms; //
173  bool noHetAtoms; //hetatms contain water, simpleMetalIons and cofactors
174  bool onlyMetalHetAtoms; //with this flag we select only 2nd cathegory
175  bool noSecondary;
176  bool noConnection; //skip connecting aminoacids
177  bool noWater; //
178  bool verbose;
179  bool allChains; //
180  char chain; //chain ID to be loaded
181  unsigned int model; //model number to be loaded
182  char altAtom; //ID of alternate atoms to be loaded
183 
184  bool noNucleotideChains; //does not load nucleotide atoms
185 
186  string helixCode; // parallel vector of helix data, chain name for each helixData element
187  string sheetCode;
188 
189  vector<pair<int, int> > helixData; //inizio e fine dell'elica
190  vector<pair<int, int> > sheetData;
191 
192  };
193 
194 }} //namespace
195 #endif //_PDB_LOADER_H_
196 
void assignSecondary(Spacer &sp)
Definition: PdbLoader.cc:195
PdbLoader(istream &_input=cin, bool _permissive=false, bool _noHAtoms=false, bool _noHetAtoms=false, bool _noSecondary=false, bool _noConnection=false, bool _noWater=true, bool _verb=true, bool _allChains=false, string _NULL="", bool _onlyMetal=false, bool _noNucleotideChains=true)
Definition: PdbLoader.h:55
bool inSideChain(const AminoAcid &aa, const Atom &at)
Definition: PdbLoader.cc:176
void checkAndSetChain()
Definition: PdbLoader.cc:66
Loads components (Atoms, Groups, Spacer, etc.) in standard PDB format.
Definition: PdbLoader.h:36
virtual void loadProtein(Protein &prot)
Definition: PdbLoader.cc:258
int parsePDBline(string atomLine, string tag, Ligand *lig, AminoAcid *aa)
Definition: PdbLoader.cc:574
Base class for loading components (Atoms, Groups, etc.).
Definition: Loader.h:39
vector< char > getAllChains()
Definition: PdbLoader.cc:127
unsigned int getMaxModelsFast()
Definition: PdbLoader.cc:103
bool setBonds(Spacer &sp)
Definition: PdbLoader.cc:160
void checkModel()
Definition: PdbLoader.cc:89
unsigned int getMaxModels()
Definition: PdbLoader.cc:43