ProSHADE  0.6.1 (JUN 2018)
Protein Shape Descriptors and Symmetry Detection
ProSHADE.h
1 
21 //============================================ Apply -pedantic and -Wshadow to my code only (some of the dependencies fill not compile if this is allowed for all)
22 //#define __PROSHADE_DEVEL_CODE__
23 
24 //============================================ Include once
25 #ifndef __PROSHADE_LIBRARY__
26 #define __PROSHADE_LIBRARY__
27 
28 //============================================ Standard library
29 #include <iostream>
30 #include <fstream>
31 #include <sstream>
32 #include <iterator>
33 #include <string>
34 #include <vector>
35 #include <array>
36 #include <numeric>
37 #include <functional>
38 #include <algorithm>
39 #include <ctime>
40 #include <chrono>
41 #include <memory>
42 #include <exception>
43 #include <getopt.h>
44 #include <limits>
45 #include <string.h>
46 #include <cmath>
47 #include "complex.h"
48 
49 //============================================ Development compilation pragmas
50 #ifdef __PROSHADE_DEVEL_CODE__
51 #pragma GCC diagnostic error "-Wshadow"
52 #pragma GCC diagnostic error "-Wpedantic"
53 #endif
54 
55 typedef double fftw_complex[2];
56 
62 namespace ProSHADE
63 {
64  //======================================== The Task data type
65  enum Task { Symmetry, Distances, DistancesFrag, Features, BuildDB, HalfMaps, RotateMap, OverlayMap };
66 
74  class ProSHADE_settings
75  {
76  public:
77  //==================================== Settings regarding resolutions
78  double mapResolution;
79  unsigned int bandwidth;
80  unsigned int glIntegOrder;
81  unsigned int theta;
82  unsigned int phi;
83  bool mapResDefault;
84 
85  //==================================== Settings regarding B factors
86  double bFactorValue;
87  double bFactorChange;
88 
89  //==================================== Setting regarding maps and removing noise
90  double noIQRsFromMap;
91 
92  //==================================== Settings regarding concentric shells
93  double shellSpacing;
94  unsigned int manualShells;
95 
96  //==================================== Settings regarding phase
97  bool usePhase;
98 
99  //==================================== Settings regarding map with phases
100  bool useCOM;
101  bool firstLineCOM;
102 
103  //==================================== Settings regarding space around the structure in lattice
104  double extraSpace;
105 
106  //==================================== Settings regarding weighting the distances
107  double alpha;
108  double mPower;
109 
110  //==================================== Settings regarding bands to ignore
111  std::vector<int> ignoreLs;
112 
113  //==================================== Settings regarding the structures to use
114  std::vector <std::string> structFiles;
115 
116  //==================================== Settings regarding peak finding
117  double peakHeightNoIQRs;
118  double peakDistanceForReal;
120 
121  //==================================== Settings regarding axis and angle error tolerance
122  double aaErrorTolerance;
123  double symGapTolerance;
124 
125  //==================================== Settings regarding which distances to compute
126  bool energyLevelDist;
127  bool traceSigmaDist;
128  bool fullRotFnDist;
129 
130  //==================================== Settings regarding thresholds for hierarchical distance computation
131  double enLevelsThreshold;
132  double trSigmaThreshold;
133 
134  //==================================== Settings regarding which of the task to perform
135  Task taskToPerform;
136 
137  //==================================== Settings regarding where and if to save the clear map
138  std::string clearMapFile;
139  bool useCubicMaps;
140  bool clearMapData;
141 
142  //==================================== Settings regarding map fragmentation
143  double mapFragBoxSize;
144  std::string mapFragName;
145  double mapFragBoxFraction;
146 
147  //==================================== Settings regarding structure database
148  std::string databaseName;
149  double volumeTolerance;
150 
151  //==================================== Settings regarding the symmetry type required
152  unsigned int symmetryFold;
153  std::string symmetryType;
154 
155  //==================================== Settings regarding the map rotation mode
156  double rotAngle;
157  double rotXAxis;
158  double rotYAxis;
159  double rotZAxis;
160  bool rotChangeDefault;
161  double xTranslation;
162  double yTranslation;
163  double zTranslation;
164 
165  //==================================== Settings regarding the map overlay mode
166  bool overlayDefaults;
167 
168  //==================================== Settings regarding the map saving mode
169  std::string axisOrder;
170 
171  //==================================== Settings regarding verbosity of the program
172  int verbose;
173 
174  public:
175  //==================================== Public functions available to user: Constructor and destructor
176  ProSHADE_settings ( );
177 
178  //==================================== Public functions available to user: Pecularities
179  void printSettings ( );
180  void getCommandLineParams ( int argc, char* argv[] );
181  void ignoreLsAddValuePy ( const int val );
182  };
183 
190  class ProSHADE
191  {
192  private:
193  //==================================== Decision bools
194  bool distancesAvailable;
195  bool symmetriesAvailable;
196 
197  //==================================== Values from the ProSHADE run
198  std::vector<double> crossCorrDists;
199  std::vector<double> traceSigmaDists;
200  std::vector<double> rotFunctionDists;
201  std::vector< std::array<double,5> > cyclicSymmetries;
202  std::vector< std::vector< std::array<double,6> > > dihedralSymmetries;
203  std::vector< std::array<double,5> > tetrahedralSymmetry;
204  std::vector< std::array<double,5> > octahedralSymmetry;
205  std::vector< std::array<double,5> > icosahedralSymmetry;
206 
207  public:
208  //==================================== Public functions available to user: Constructor and destructor
209  ProSHADE ( ProSHADE_settings *settings );
210  ~ProSHADE ( );
211 
212  //==================================== Public functions available to user: Accessor functions for distances
213  std::vector<double> getCrossCorrDists ( );
214  std::vector<double> getTraceSigmaDists ( );
215  std::vector<double> getRotFunctionDists ( );
216 
217  //==================================== Public functions available to user: Accessor functions for symmetries (C++)
218  std::vector< std::array<double,5> > getCyclicSymmetries ( );
219  std::vector< std::vector<std::array< double,6> > > getDihedralSymmetries ( );
220  std::vector< std::array<double,5> > getTetrahedralSymmetries ( );
221  std::vector< std::array<double,5> > getOctahedralSymmetries ( );
222  std::vector< std::array<double,5> > getIcosahedralSymmetries ( );
223  std::vector< std::array<double,5> > getSymmetryElements ( );
224  std::vector< std::array<double,5> > getSpecificSymmetryElements ( std::string symType, int symFold = 0 );
225 
226  //==================================== Public functions available to user: Accessor functions for symmetries (Python)
227  std::vector< double > getCyclicSymmetriesPy ( );
228  std::vector< double > getDihedralSymmetriesPy ( );
229  std::vector< double > getTetrahedralSymmetriesPy ( );
230  std::vector< double > getOctahedralSymmetriesPy ( );
231  std::vector< double > getIcosahedralSymmetriesPy ( );
232  std::vector< double > getSymmetryElementsPy ( );
233  std::vector< double > getSpecificSymmetryElementsPy ( std::string symType, int symFold = 0 );
234 
235  //==================================== Public functions available to user: Miscellaneous
236  std::string getProSHADEVersion ( );
237  };
238 }
239 
240 //============================================ END
241 #endif
double aaErrorTolerance
The tolerance parameter on matching axes for the angle-axis representation of rotations.
Definition: ProSHADE.h:122
std::string symmetryType
The required symmetry type. If no symmetry is required, leave empty. Possible values are: C...
Definition: ProSHADE.h:153
double mapResolution
This is the internal resolution at which the calculations are done, not necessarily the resolution of...
Definition: ProSHADE.h:78
double noIQRsFromMap
This is the number of interquartile distances from mean that is used to threshold the map masking...
Definition: ProSHADE.h:90
bool clearMapData
This value is used to decide whether the input maps should be cleared again, or not.
Definition: ProSHADE.h:140
unsigned int theta
This parameter is the longitude of the spherical grid mapping. It should be 2 * bandwidth unless ther...
Definition: ProSHADE.h:81
double bFactorValue
This is the value to which all B-factors of PDB files will be changed to.
Definition: ProSHADE.h:86
std::string clearMapFile
If map features are to be extracted, should the clear map be saved (then give file name here)...
Definition: ProSHADE.h:138
void printSettings()
Function for outputting the current settings recorded in the ProSHADE_settings class instance...
Definition: ProSHADE.cpp:169
std::string databaseName
The name of the bin file to which the database should be saved.
Definition: ProSHADE.h:148
double zTranslation
The number of angstroms by which the structure should be translated along the Z axis.
Definition: ProSHADE.h:163
bool overlayDefaults
If true, the shell spacing and distances will be doube to their typical values. This is to speed up m...
Definition: ProSHADE.h:166
bool usePhase
Here the user can decide whether to use phase information or whether to ignore it completely...
Definition: ProSHADE.h:97
double mapFragBoxFraction
Fraction of box that needs to have density in order to be passed on.
Definition: ProSHADE.h:145
unsigned int bandwidth
This parameter determines the angular resolution of the spherical harmonics decomposition.
Definition: ProSHADE.h:79
int verbose
Should the software report on the progress, or just be quiet? Value between 0 (quiet) and 4 (loud) ...
Definition: ProSHADE.h:172
double rotAngle
The angle of the rotation to be done to the map structure in the map rotation mode.
Definition: ProSHADE.h:156
double trSigmaThreshold
All structure pairs with trace sigma descriptor value less than this will not be subjected to any fur...
Definition: ProSHADE.h:132
double alpha
This parameter determines the power to which the |F|&#39;s should be raised.
Definition: ProSHADE.h:107
bool firstLineCOM
This is a special option for metal detection, please leave false.
Definition: ProSHADE.h:101
bool fullRotFnDist
Should the full rotation function distances descriptor be computed.
Definition: ProSHADE.h:128
bool useCubicMaps
When saving clear maps, should the rectangular or cubic (older versions of refmac need this) maps be ...
Definition: ProSHADE.h:139
std::vector< std::string > structFiles
This vector should contain all the structures that are being dealt with, but this does not yet work! ...
Definition: ProSHADE.h:114
int peakSurroundingPoints
For a peak to exist, how many points in every direction need to be smalled than the middle value...
Definition: ProSHADE.h:119
double rotXAxis
The X-axis element of the rotation axis along which the rotation is to be done in the map rotation mo...
Definition: ProSHADE.h:157
double shellSpacing
This parameter determines how far the radial shells should be from each other.
Definition: ProSHADE.h:93
double volumeTolerance
The percentage tolerance on each dimmension when comparing one structure to entire database...
Definition: ProSHADE.h:149
double rotYAxis
The Y-axis element of the rotation axis along which the rotation is to be done in the map rotation mo...
Definition: ProSHADE.h:158
double rotZAxis
The Z-axis element of the rotation axis along which the rotation is to be done in the map rotation mo...
Definition: ProSHADE.h:159
double peakDistanceForReal
Threshold for determining &#39;missing peaks&#39; existence.
Definition: ProSHADE.h:118
bool mapResDefault
This variable states if default resolution should be used, or whether the user has supplied a differe...
Definition: ProSHADE.h:83
bool traceSigmaDist
Should the trace sigma distances descriptor be computed.
Definition: ProSHADE.h:127
bool rotChangeDefault
If map rotation is selected, the default automatic parameter decision is changed. This variable state...
Definition: ProSHADE.h:160
unsigned int phi
This parameter is the latitudd of the spherical grid mapping. It should be 2 * bandwidth unless there...
Definition: ProSHADE.h:82
unsigned int symmetryFold
The required fold of the sought symmetry. Applicable to C and D symmetries, otherwise leave 0...
Definition: ProSHADE.h:152
std::string axisOrder
A string specifying the order of the axis. Must have three characters and any permutation of &#39;x&#39;...
Definition: ProSHADE.h:169
This namespace contains all the external objects and their forward declarations.
bool energyLevelDist
Should the energy level distances descriptor be computed.
Definition: ProSHADE.h:126
double xTranslation
The number of angstroms by which the structure should be translated along the X axis.
Definition: ProSHADE.h:161
double bFactorChange
This value will be used to change the B-factors if required by the user.
Definition: ProSHADE.h:87
ProSHADE_settings()
Contructor for the ProSHADE_settings class.
Definition: ProSHADE.cpp:65
double peakHeightNoIQRs
How many interquartile ranges should be used to distinguish &#39;false&#39; peaks from the true ones...
Definition: ProSHADE.h:117
std::vector< int > ignoreLs
This vector lists all the bandwidth values which should be ignored and not part of the computations...
Definition: ProSHADE.h:111
double yTranslation
The number of angstroms by which the structure should be translated along the Y axis.
Definition: ProSHADE.h:162
double mapFragBoxSize
Should the clear map be fragmented into boxes? If so, put box size here, otherwise leave 0...
Definition: ProSHADE.h:143
double symGapTolerance
For C-symmetries - if there are many, only those with average peak height - parameter * top symmetry ...
Definition: ProSHADE.h:123
double mPower
This parameter determines the scaling for trace sigma descriptor.
Definition: ProSHADE.h:108
unsigned int manualShells
Should the user require so, the maximum number of radial shells can be set.
Definition: ProSHADE.h:94
bool useCOM
Should the Centre of Mass (COM) be used to center the structure in the cell?
Definition: ProSHADE.h:100
double enLevelsThreshold
All structure pairs with energy level descriptor value less than this will not be subjected to any fu...
Definition: ProSHADE.h:131
Task taskToPerform
This custom type variable determines which task to perfom (i.e. symmetry detection, distances computation or map features extraction).
Definition: ProSHADE.h:135
std::string mapFragName
The prefix of the files with the cut out boxes.
Definition: ProSHADE.h:144
double extraSpace
What should be the distance added on both sides to the structure, so that the next cell density would...
Definition: ProSHADE.h:104
unsigned int glIntegOrder
This parameter controls the Gauss-Legendre integration order and so the radial resolution.
Definition: ProSHADE.h:80