Debian Codegraph @

ligand/side-chain-densities.hh

raw symbols SCIP
1 /*
2 * ligand/side-chain-densities.hh
3 *
4 * Copyright 2019 by Medical Research Council
5 * Author: Paul Emsley
6 *
7 * This file is part of Coot
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published
11 * by the Free Software Foundation; either version 3 of the License, or (at
12 * your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copies of the GNU General Public License and
20 * the GNU Lesser General Public License along with this program; if not,
21 * write to the Free Software Foundation, Inc., 51 Franklin Street,
22 * Fifth Floor, Boston, MA, 02110-1301, USA.
23 * See http://www.gnu.org/licenses/
24 *
25 */
26 #ifndef SIDE_CHAIN_DENSITIES_HH
27 #define SIDE_CHAIN_DENSITIES_HHcxx . . $ `ligand/side-chain-densities.hh:27:9`!
28
29
30 #include <atomic>
31 // This file is here because we need to know the rotamer name
32 //
33 #include "coot-utils/coot-coord-utils.hh"cxx . . $ `<file>/coot-utils/coot-coord-utils.hh`/
34 #include "coot-utils/coot-map-utils.hh"cxx . . $ `<file>/coot-utils/coot-map-utils.hh`/
35 #include "coot-utils/fragment-container.hh"cxx . . $ `<file>/coot-utils/fragment-container.hh`/
36 #include "utils/coot-fasta.hh"cxx . . $ `<file>/utils/coot-fasta.hh`/
37
38 namespace cootcxx . . $ coot/ {
39
40 class density_box_tcxx . . $ coot/density_box_t# {
41 public:
42 // density_box is a copy of a filled pointer
43 density_box_tcxx . . $ coot/density_box_t#density_box_t(35bd8270c5982f34).(float *density_box, mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p, int n_steps);
44 density_box_tcxx . . $ coot/density_box_t#density_box_t(49f6e7a06ebc5aa8).() { initcxx . . $ coot/density_box_t#init(49f6e7a06ebc5aa8).(); } // needed because it's unsed in a map
45 float *density_boxcxx . . $ coot/density_box_t#density_box.;
46 mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_pcxx . . $ coot/density_box_t#residue_p.;
47 double meancxx . . $ coot/density_box_t#mean.;
48 double mean_of_positivescxx . . $ coot/density_box_t#mean_of_positives.;
49 double varcxx . . $ coot/density_box_t#var.;
50
51 double mean_around_cacxx . . $ coot/density_box_t#mean_around_ca.;
52 double mean_of_positives_around_cacxx . . $ coot/density_box_t#mean_of_positives_around_ca.;
53 double var_around_cacxx . . $ coot/density_box_t#var_around_ca.;
54
55 bool is_weirdcxx . . $ coot/density_box_t#is_weird.;
56
57 int n_stepscxx . . $ coot/density_box_t#n_steps.; // either side of the middle
58
59 void initcxx . . $ coot/density_box_t#init(49f6e7a06ebc5aa8).() {
60 density_boxcxx . . $ coot/density_box_t#density_box. = 0; residue_pcxx . . $ coot/density_box_t#residue_p. = 0; n_stepscxx . . $ coot/density_box_t#n_steps. = 0; meancxx . . $ coot/density_box_t#mean.=0; varcxx . . $ coot/density_box_t#var. = -1;
61 mean_around_cacxx . . $ coot/density_box_t#mean_around_ca. = 0; mean_of_positives_around_cacxx . . $ coot/density_box_t#mean_of_positives_around_ca. = 0;
62 var_around_cacxx . . $ coot/density_box_t#var_around_ca. = -1;
63 is_weirdcxx . . $ coot/density_box_t#is_weird. = false;
64 mean_of_positivescxx . . $ coot/density_box_t#mean_of_positives. = 0;
65 }
66 void scale_bycxx . . $ coot/density_box_t#scale_by(9364e6e7bff7660).(float scale_factor) {
67 if (n_stepscxx . . $ coot/density_box_t#n_steps. > 0) {
68 int n = 2 * n_stepscxx . . $ coot/density_box_t#n_steps. + 1;
69 int n3 = n * n * n;
70 for (int i=0; i<n3; i++)
71 if (density_boxcxx . . $ coot/density_box_t#density_box.[i] > -1000)
72 density_boxcxx . . $ coot/density_box_t#density_box.[i] *= scale_factor;
73 }
74 }
75 int nnncxx . . $ coot/density_box_t#nnn(455f465bc33b4cdf).() const {
76 int n = 2 * n_stepscxx . . $ coot/density_box_t#n_steps. + 1;
77 return n * n * n;
78 }
79 stdcxx . . $ std/::paircxx . . $ std/pair#<float, float> mean_and_variancecxx . . $ coot/density_box_t#mean_and_variance(502f650484ae04ea).() const;
80 void self_normalizecxx . . $ coot/density_box_t#self_normalize(49f6e7a06ebc5aa8).();
81 void clearcxx . . $ coot/density_box_t#clear(49f6e7a06ebc5aa8).() {
82 delete [] density_boxcxx . . $ coot/density_box_t#density_box.;
83 density_boxcxx . . $ coot/density_box_t#density_box. = 0;
84 }
85 // caller checks for valid index
86 float operatorcxx . . $ coot/density_box_t#`operator[]`(1310850a0e356fcc).[](const unsigned int &idx) const {
87 return density_boxcxx . . $ coot/density_box_t#density_box.[idx];
88 }
89 bool emptycxx . . $ coot/density_box_t#empty(50ce9a9e25b4a850).() const { return (n_stepscxx . . $ coot/density_box_t#n_steps. == 0); }
90 void set_statscxx . . $ coot/density_box_t#set_stats(3374d1a184fcc02e).(const double &mean_in, const double &var_in, const double &mean_of_positives_in) {
91 meancxx . . $ coot/density_box_t#mean. = mean_in;
92 mean_of_positivescxx . . $ coot/density_box_t#mean_of_positives. = mean_of_positives_in;
93 varcxx . . $ coot/density_box_t#var. = var_in;
94 }
95 void set_around_ca_statscxx . . $ coot/density_box_t#set_around_ca_stats(3374d1a184fcc02e).(const double &mean_in, const double &var_in, const double &mean_of_positives_in) {
96 mean_around_cacxx . . $ coot/density_box_t#mean_around_ca. = mean_in;
97 var_around_cacxx . . $ coot/density_box_t#var_around_ca. = var_in;
98 mean_of_positives_around_cacxx . . $ coot/density_box_t#mean_of_positives_around_ca. = mean_of_positives_in;
99 }
100
101 void normalize_using_ca_statscxx . . $ coot/density_box_t#normalize_using_ca_stats(49f6e7a06ebc5aa8).();
102 };
103
104
105 class side_chain_densitiescxx . . $ coot/side_chain_densities# {
106
107 // SAMPLE_FOR_RESIDUE means that we are generating a box to test a map
108 // where we don't know the residue type
109 //
110 enum mode_tcxx . . $ coot/side_chain_densities#mode_t# { GEN_USABLE_POINTScxx . . $ coot/side_chain_densities#GEN_USABLE_POINTS., SAMPLE_FOR_DBcxx . . $ coot/side_chain_densities#SAMPLE_FOR_DB., SAMPLE_FOR_RESIDUEcxx . . $ coot/side_chain_densities#SAMPLE_FOR_RESIDUE. };
111
112 int n_stepscxx . . $ coot/side_chain_densities#n_steps.;
113 float grid_box_radiuscxx . . $ coot/side_chain_densities#grid_box_radius.;
114 stdcxx . . $ std/::stringcxx . . $ std/string# data_dircxx . . $ coot/side_chain_densities#data_dir.; // we can we find side-chain-data?
115 stdcxx . . $ std/::paircxx . . $ std/pair#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#, stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> > get_residue_axescxx . . $ coot/side_chain_densities#get_residue_axes(e62ff94829d21762).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *res) const;
116 stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#>
117 make_axescxx . . $ coot/side_chain_densities#make_axes(6cdfee876c1b7720).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt_ca_this,
118 const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt_cb_this,
119 const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt_c_this,
120 const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt_n_this) const;
121 stdcxx . . $ std/::paircxx . . $ std/pair#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#, stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> >
122 get_residue_axes_type_GLYcxx . . $ coot/side_chain_densities#get_residue_axes_type_GLY(e62ff94829d21762).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *this_residue) const;
123 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<int, int, int> grid_index_to_gridcxx . . $ coot/side_chain_densities#grid_index_to_grid(b83f18818c63deb4).(int idx) const;
124
125 void proc_molcxx . . $ coot/side_chain_densities#proc_mol(1bddfe0a57c2288b).(const stdcxx . . $ std/::stringcxx . . $ std/string# &id, mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol, const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
126 void proc_chaincxx . . $ coot/side_chain_densities#proc_chain(f7246c0cc2831be7).(const stdcxx . . $ std/::stringcxx . . $ std/string# &id, mmdbcxx . . $ mmdb/::Chaincxx . . $ mmdb/Chain# *chain, const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
127 void proc_residuecxx . . $ coot/side_chain_densities#proc_residue(88a2bfb90d4fef31).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue, const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
128 // residue_next_p can be null - residue_next_p needs to be set when
129 // generating usable grid points
130 // User should check that the densty box is ok using empty()
131 density_box_tcxx . . $ coot/density_box_t# sample_mapcxx . . $ coot/side_chain_densities#sample_map(94f67d0b69f22841).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_this_p,
132 mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_next_p,
133 mode_tcxx . . $ coot/side_chain_densities#mode_t# mode,
134 const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &cb_pt,
135 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> &axes,
136 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap,
137 stdcxx . . $ std/::stringcxx . . $ std/string# gen_pts_file_name = ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).) const;
138 stdcxx . . $ std/::stringcxx . . $ std/string# get_rotamer_namecxx . . $ coot/side_chain_densities#get_rotamer_name(95139a50f52401c5).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *r) const;
139 bool is_close_to_atomscxx . . $ coot/side_chain_densities#is_close_to_atoms(7983be146a24610a).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<double, clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> > &atom_positions,
140 const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &test_position) const;
141 void write_density_boxcxx . . $ coot/side_chain_densities#write_density_box(c26e1caf19bbdc1b).(float *density_box, int n_steps, const stdcxx . . $ std/::stringcxx . . $ std/string# &id,
142 mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# * residue_p) const;
143 void write_density_boxcxx . . $ coot/side_chain_densities#write_density_box(ad20f38c85c3c439).(const density_box_tcxx . . $ coot/density_box_t# &db, const stdcxx . . $ std/::stringcxx . . $ std/string# &id) const;
144
145 void store_density_boxcxx . . $ coot/side_chain_densities#store_density_box(311c77ff7e074bef).(const density_box_tcxx . . $ coot/density_box_t# &density_box) {
146 density_boxescxx . . $ coot/side_chain_densities#density_boxes..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(density_box);
147 }
148 stdcxx . . $ std/::vectorcxx . . $ std/vector#<density_box_tcxx . . $ coot/density_box_t#> density_boxescxx . . $ coot/side_chain_densities#density_boxes.;
149 void normalize_density_boxescxx . . $ coot/side_chain_densities#normalize_density_boxes(9c546c94e5fcce4e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &id);
150 void normalize_density_boxes_v1cxx . . $ coot/side_chain_densities#normalize_density_boxes_v1(9c546c94e5fcce4e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &id);
151 void normalize_density_boxes_v2cxx . . $ coot/side_chain_densities#normalize_density_boxes_v2(9c546c94e5fcce4e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &id);
152 void normalize_density_boxes_v3cxx . . $ coot/side_chain_densities#normalize_density_boxes_v3(9c546c94e5fcce4e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &id);
153 void add_mean_and_variance_to_individual_density_blockscxx . . $ coot/side_chain_densities#add_mean_and_variance_to_individual_density_blocks(49f6e7a06ebc5aa8).();
154 void write_density_boxescxx . . $ coot/side_chain_densities#write_density_boxes(83f5f38750778ac8).() const;
155 double get_log_likelihoodcxx . . $ coot/side_chain_densities#get_log_likelihood(e34f8fd4c82e2fe2).(const unsigned int &grid_idx,
156 const density_box_tcxx . . $ coot/density_box_t# &block,
157 const double &mean,
158 const double &variance,
159 const double &skew) const;
160 double get_log_likelihood_ratiocxx . . $ coot/side_chain_densities#get_log_likelihood_ratio(af13cb92c3e95cb0).(const unsigned int &grid_idx,
161 const density_box_tcxx . . $ coot/density_box_t# &block,
162 const stdcxx . . $ std/::stringcxx . . $ std/string# &rotamer_dir, // for debugging
163 const double &step_size,
164 const double &mean,
165 const double &variance,
166 const double &skew) const;
167 bool get_test_map_is_above_model_meancxx . . $ coot/side_chain_densities#get_test_map_is_above_model_mean(a24a64925a549445).(const unsigned int &grid_idx,
168 const density_box_tcxx . . $ coot/density_box_t# &block,
169 const double &mean) const;
170 // key is residue type and value is rotamer name and score pair
171 stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, double> >
172 compare_block_vs_all_rotamerscxx . . $ coot/side_chain_densities#compare_block_vs_all_rotamers(90d87e6378f81313).(density_box_tcxx . . $ coot/density_box_t# block,
173 mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p, // for debugging
174 const stdcxx . . $ std/::stringcxx . . $ std/string# &data_dir,
175 const stdcxx . . $ std/::paircxx . . $ std/pair#<bool, stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::stringcxx . . $ std/string#> > > &rotamer_limits,
176 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
177 // fills the rotamer grid cache, non-const
178 stdcxx . . $ std/::paircxx . . $ std/pair#<bool, double>
179 compare_block_vs_rotamercxx . . $ coot/side_chain_densities#compare_block_vs_rotamer(702ed19e26cb05e6).(density_box_tcxx . . $ coot/density_box_t# block,
180 mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p,
181 const stdcxx . . $ std/::stringcxx . . $ std/string# &rotamer_dir,
182 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
183 bool in_spherecxx . . $ coot/side_chain_densities#in_sphere(fbc762cc05199bd3).(int grid_idx, const int &n_steps) const; // manhattan - not a good test
184 bool in_spherecxx . . $ coot/side_chain_densities#in_sphere(dfc377458e2976b5).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt, // Euclidean
185 const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &cb,
186 const double &d_max) const;
187 stdcxx . . $ std/::setcxx . . $ std/set#<int> useable_grid_pointscxx . . $ coot/side_chain_densities#useable_grid_points.;
188 void fill_useable_grid_points_vectorcxx . . $ coot/side_chain_densities#fill_useable_grid_points_vector(9c546c94e5fcce4e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &file_name);
189 double get_grid_point_distance_from_grid_centrecxx . . $ coot/side_chain_densities#get_grid_point_distance_from_grid_centre(1172994d0e063cdf).(const unsigned int &idx,
190 const double &step_size) const;
191
192 clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# make_pt_in_gridcxx . . $ coot/side_chain_densities#make_pt_in_grid(1893ff918ceef367).(int ix, int iy, int iz, const float &step_size,
193 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> &axes) const;
194
195 stdcxx . . $ std/::stringcxx . . $ std/string# dir_to_keycxx . . $ coot/side_chain_densities#dir_to_key(ed3976f106e8bf8e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &str) const;
196 stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::stringcxx . . $ std/string#> map_key_to_residue_and_rotamer_namescxx . . $ coot/side_chain_densities#map_key_to_residue_and_rotamer_names(afa549a2a040d78d).(const stdcxx . . $ std/::stringcxx . . $ std/string# &key) const;
197
198 double null_hypothesis_scalecxx . . $ coot/side_chain_densities#null_hypothesis_scale.;
199 double null_hypothesis_sigmacxx . . $ coot/side_chain_densities#null_hypothesis_sigma.;
200
201 // cache variable
202 stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::mapcxx . . $ std/map#<unsigned int, stdcxx . . $ std/::tuplecxx . . $ std/tuple#<double, double, double> > > rotamer_dir_grid_stats_map_cachecxx . . $ coot/side_chain_densities#rotamer_dir_grid_stats_map_cache.;
203 // cache variable (for better normalization of user/test map/model)
204 stdcxx . . $ std/::mapcxx . . $ std/map#<mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *, density_box_tcxx . . $ coot/density_box_t#> density_block_map_cachecxx . . $ coot/side_chain_densities#density_block_map_cache.;
205 // called by fill_residue_blocks()
206 void normalize_density_blockscxx . . $ coot/side_chain_densities#normalize_density_blocks(49f6e7a06ebc5aa8).();
207 // use the above cache
208 density_box_tcxx . . $ coot/density_box_t# get_blockcxx . . $ coot/side_chain_densities#get_block(1385e574aa61693f).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p) const;
209 // and the cache of likelihoods for the best rotamer of each residue type at each position:
210 // this gets added to using the results lock
211 stdcxx . . $ std/::mapcxx . . $ std/map#<mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *, stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, double> > > best_score_for_res_type_cachecxx . . $ coot/side_chain_densities#best_score_for_res_type_cache.;
212
213 stdcxx . . $ std/::mapcxx . . $ std/map#<int, stdcxx . . $ std/::stringcxx . . $ std/string#> make_sequence_for_chaincxx . . $ coot/side_chain_densities#make_sequence_for_chain(893616e83972b0f7).(mmdbcxx . . $ mmdb/::Chaincxx . . $ mmdb/Chain# *chain_p) const;
214
215 bool like_the_otherscxx . . $ coot/side_chain_densities#like_the_others(a8ca1aa145af4df4).(const stdcxx . . $ std/::mapcxx . . $ std/map#<int, stdcxx . . $ std/::stringcxx . . $ std/string#> &chain,
216 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::mapcxx . . $ std/map#<int, stdcxx . . $ std/::stringcxx . . $ std/string#> > &other_chains) const;
217
218 // return negative values on failure
219 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<double, double, double>
220 get_stats_around_cacxx . . $ coot/side_chain_densities#get_stats_around_ca(e39bde67ade6abe8).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_this,
221 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> &axes,
222 float step_size,
223 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap) const;
224
225 stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, double> relabuncxx . . $ coot/side_chain_densities#relabun.;
226 double get_relabuncxx . . $ coot/side_chain_densities#get_relabun(610a939d150cc19e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &res_name);
227
228 public:
229
230 stdcxx . . $ std/::stringcxx . . $ std/string# idcxx . . $ coot/side_chain_densities#id.;
231 stdcxx . . $ std/::atomiccxx . . $ std/atomic#<bool> results_addition_lockcxx . . $ coot/side_chain_densities#results_addition_lock.;
232 side_chain_densitiescxx . . $ coot/side_chain_densities#side_chain_densities(57dfcecb7adbbdb).(const stdcxx . . $ std/::stringcxx . . $ std/string# &id_in, mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol,
233 int n_steps_in, float grid_box_radius_in,
234 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap,
235 const stdcxx . . $ std/::stringcxx . . $ std/string# &file_name) : idcxx . . $ coot/side_chain_densities#id.(id_in) {
236 n_stepscxx . . $ coot/side_chain_densities#n_steps. = n_steps_in;
237 grid_box_radiuscxx . . $ coot/side_chain_densities#grid_box_radius. = grid_box_radius_in;
238 fill_useable_grid_points_vectorcxx . . $ coot/side_chain_densities#fill_useable_grid_points_vector(9c546c94e5fcce4e).(file_name);
239 proc_molcxx . . $ coot/side_chain_densities#proc_mol(1bddfe0a57c2288b).(idcxx . . $ coot/side_chain_densities#id., mol, xmap);
240 null_hypothesis_scalecxx . . $ coot/side_chain_densities#null_hypothesis_scale. = 1.0;
241 null_hypothesis_sigmacxx . . $ coot/side_chain_densities#null_hypothesis_sigma. = 1.0;
242 set_default_magic_numberscxx . . $ coot/side_chain_densities#set_default_magic_numbers(49f6e7a06ebc5aa8).(); // probably not needed
243 results_addition_lockcxx . . $ coot/side_chain_densities#results_addition_lock. =cxx . . $ std/atomic#`operator=`(4264aff4942d46ac). false;
244 }
245
246 // constructor for testing residues vs the "database" - using
247 // get_rotamer_likelihoods()
248 //
249 // also constructor for generating the useable grid points file(s)
250 //
251 // maybe this should be a different class?
252 //
253 side_chain_densitiescxx . . $ coot/side_chain_densities#side_chain_densities(50a2773e7030a798).(int n_steps_in,
254 float grid_box_radius_in,
255 const stdcxx . . $ std/::stringcxx . . $ std/string# &useable_grid_points_file_name) {
256 initcxx . . $ coot/side_chain_densities#init(50a2773e7030a798).(n_steps_in, grid_box_radius_in, useable_grid_points_file_name);
257 }
258
259 // "wrapper" for above using default values
260 side_chain_densitiescxx . . $ coot/side_chain_densities#side_chain_densities(49f6e7a06ebc5aa8).();
261
262 void initcxx . . $ coot/side_chain_densities#init(50a2773e7030a798).(int n_steps_in, float grid_box_radius_in, const stdcxx . . $ std/::stringcxx . . $ std/string# &useable_grid_points_file_name) {
263 n_stepscxx . . $ coot/side_chain_densities#n_steps. = n_steps_in;
264 grid_box_radiuscxx . . $ coot/side_chain_densities#grid_box_radius. = grid_box_radius_in;
265 fill_useable_grid_points_vectorcxx . . $ coot/side_chain_densities#fill_useable_grid_points_vector(9c546c94e5fcce4e).(useable_grid_points_file_name);
266 null_hypothesis_scalecxx . . $ coot/side_chain_densities#null_hypothesis_scale. = 1.0;
267 null_hypothesis_sigmacxx . . $ coot/side_chain_densities#null_hypothesis_sigma. = 1.0;
268 set_default_magic_numberscxx . . $ coot/side_chain_densities#set_default_magic_numbers(49f6e7a06ebc5aa8).();
269 results_addition_lockcxx . . $ coot/side_chain_densities#results_addition_lock. =cxx . . $ std/atomic#`operator=`(4264aff4942d46ac). false;
270 }
271
272 // magic numbers
273 double mn_log_likelihood_ratio_difference_mincxx . . $ coot/side_chain_densities#mn_log_likelihood_ratio_difference_min.;
274 double mn_scale_for_normalized_densitycxx . . $ coot/side_chain_densities#mn_scale_for_normalized_density.;
275 double mn_density_block_sample_x_maxcxx . . $ coot/side_chain_densities#mn_density_block_sample_x_max.;
276
277 class results_tcxx . . $ coot/side_chain_densities#results_t# {
278 public:
279 int offsetcxx . . $ coot/side_chain_densities#results_t#offset.;
280 double sum_scorecxx . . $ coot/side_chain_densities#results_t#sum_score.;
281 unsigned int n_scored_residuescxx . . $ coot/side_chain_densities#results_t#n_scored_residues.;
282 stdcxx . . $ std/::stringcxx . . $ std/string# sequencecxx . . $ coot/side_chain_densities#results_t#sequence.;
283 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::stringcxx . . $ std/string#> > sequence_residue_type_and_rotamer_namecxx . . $ coot/side_chain_densities#results_t#sequence_residue_type_and_rotamer_name.;
284 stdcxx . . $ std/::stringcxx . . $ std/string# sequence_namecxx . . $ coot/side_chain_densities#results_t#sequence_name.;
285 stdcxx . . $ std/::stringcxx . . $ std/string# true_sequencecxx . . $ coot/side_chain_densities#results_t#true_sequence.; // for testing/analysis
286 bool results_setcxx . . $ coot/side_chain_densities#results_t#results_set.;
287 results_tcxx . . $ coot/side_chain_densities#results_t#results_t(49f6e7a06ebc5aa8).() {
288 offsetcxx . . $ coot/side_chain_densities#results_t#offset. = -1; // unset
289 n_scored_residuescxx . . $ coot/side_chain_densities#results_t#n_scored_residues. = 0;
290 sum_scorecxx . . $ coot/side_chain_densities#results_t#sum_score. = 0;
291 results_setcxx . . $ coot/side_chain_densities#results_t#results_set. = false;
292 }
293 results_tcxx . . $ coot/side_chain_densities#results_t#results_t(811a52a0dad3e06c).(const int &offset_in, const float &f, const unsigned int &n_scored_residues_in,
294 const stdcxx . . $ std/::stringcxx . . $ std/string# &running_sequence_in,
295 const stdcxx . . $ std/::stringcxx . . $ std/string# &gene_name_in,
296 const stdcxx . . $ std/::stringcxx . . $ std/string# &true_sequence_in) : offsetcxx . . $ coot/side_chain_densities#results_t#offset.(offset_in),
297 sum_scorecxx . . $ coot/side_chain_densities#results_t#sum_score.(f),
298 n_scored_residuescxx . . $ coot/side_chain_densities#results_t#n_scored_residues.(n_scored_residues_in),
299 sequencecxx . . $ coot/side_chain_densities#results_t#sequence.(running_sequence_in),
300 sequence_namecxx . . $ coot/side_chain_densities#results_t#sequence_name.(gene_name_in),
301 true_sequencecxx . . $ coot/side_chain_densities#results_t#true_sequence.(true_sequence_in) { results_setcxx . . $ coot/side_chain_densities#results_t#results_set. = true; }
302 };
303 stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::vectorcxx . . $ std/vector#<results_tcxx . . $ coot/side_chain_densities#results_t#> > results_containercxx . . $ coot/side_chain_densities#results_container.;
304 results_tcxx . . $ coot/side_chain_densities#results_t# get_best_resultscxx . . $ coot/side_chain_densities#get_best_results(ce5897925877655c).() const; //uses results_container
305 void get_results_addition_lockcxx . . $ coot/side_chain_densities#get_results_addition_lock(49f6e7a06ebc5aa8).();
306 void release_results_addition_lockcxx . . $ coot/side_chain_densities#release_results_addition_lock(49f6e7a06ebc5aa8).();
307 void print_resultscxx . . $ coot/side_chain_densities#print_results(83f5f38750778ac8).() const;
308
309 void set_default_magic_numberscxx . . $ coot/side_chain_densities#set_default_magic_numbers(49f6e7a06ebc5aa8).() {
310 // magic numbers
311 mn_log_likelihood_ratio_difference_mincxx . . $ coot/side_chain_densities#mn_log_likelihood_ratio_difference_min. = -18.0;
312 mn_scale_for_normalized_densitycxx . . $ coot/side_chain_densities#mn_scale_for_normalized_density. = 1.0;
313 mn_density_block_sample_x_maxcxx . . $ coot/side_chain_densities#mn_density_block_sample_x_max. = 13.0;
314 }
315
316 stdcxx . . $ std/::vectorcxx . . $ std/vector#<mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *> make_a_run_of_residuescxx . . $ coot/side_chain_densities#make_a_run_of_residues(5adc58e34503c81f).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol, const stdcxx . . $ std/::stringcxx . . $ std/string# &chain_id,
317 int resno_start, int resno_end) const;
318
319 void set_magic_numbercxx . . $ coot/side_chain_densities#set_magic_number(9c01cbe9155cac4a).(const stdcxx . . $ std/::stringcxx . . $ std/string# &mn_name, double val);
320
321 // Confusing output if this is not called after constructor. So maybe
322 // the data_dir should be an argument to the constructor.
323 void set_data_dircxx . . $ coot/side_chain_densities#set_data_dir(9c546c94e5fcce4e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &dir) { data_dircxx . . $ coot/side_chain_densities#data_dir. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). dir; }
324
325 stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, double> >
326 likelihood_of_each_rotamer_at_this_residuecxx . . $ coot/side_chain_densities#likelihood_of_each_rotamer_at_this_residue(60c21ebc99b71b0f).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p,
327 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap,
328 bool limit_to_correct_rotamers_only=false,
329 bool verbose_output_mode = false);
330
331 void set_null_hypothesis_scale_and_sigmacxx . . $ coot/side_chain_densities#set_null_hypothesis_scale_and_sigma(bc12c9ec15586e6a).(double scale, double sigma) {
332 null_hypothesis_scalecxx . . $ coot/side_chain_densities#null_hypothesis_scale. = scale;
333 null_hypothesis_sigmacxx . . $ coot/side_chain_densities#null_hypothesis_sigma. = sigma;
334 }
335
336 // a function to density block map cache
337 void fill_residue_blockscxx . . $ coot/side_chain_densities#fill_residue_blocks(e4ef8f2523c9f2ba).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *> &residues,
338 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
339 // above is called by
340 void fill_residue_blockscxx . . $ coot/side_chain_densities#fill_residue_blocks(fc20d020d6b67ac1).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol, const stdcxx . . $ std/::stringcxx . . $ std/string# &chain_id,
341 int resno_start, int resno_end,
342 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
343
344 // we want to find the probability distribution from all the sample of that type
345 // of rotamer for that particular residue type.
346 //
347 static void combine_directorycxx . . $ coot/side_chain_densities#combine_directory(991f30a2cbcf87f).(const stdcxx . . $ std/::stringcxx . . $ std/string# &dir, int n_steps,
348 double mn_unreliable_minimum_counts,
349 double mn_unreliable_minimum_counts_for_low_variance,
350 double mn_unreliable_minimum_variance,
351 double mn_use_this_variance_for_unreliable);
352
353 stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, double> >
354 get_rotamer_likelihoodscxx . . $ coot/side_chain_densities#get_rotamer_likelihoods(60c21ebc99b71b0f).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p,
355 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap,
356 bool limit_to_correct_rotamers_only = false,
357 bool verbose_output_mode = true);
358
359 void gen_useable_grid_pointscxx . . $ coot/side_chain_densities#gen_useable_grid_points(8055a662253f15f8).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_this_p,
360 mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_next_p,
361 int n_steps, float grid_box_radius,
362 const stdcxx . . $ std/::stringcxx . . $ std/string# &file_name) const;
363 void check_statscxx . . $ coot/side_chain_densities#check_stats(a3051ea0e58bc478).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p,
364 const stdcxx . . $ std/::stringcxx . . $ std/string# &res_name,
365 const stdcxx . . $ std/::stringcxx . . $ std/string# &rot_name) const;
366
367 void check_useable_grid_pointscxx . . $ coot/side_chain_densities#check_useable_grid_points(6910a23876942392).(mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p,
368 const stdcxx . . $ std/::stringcxx . . $ std/string# &useable_grid_points_mapped_to_residue_file_name) const;
369
370 // return an error message (if any of the residues didn't have a mainchain and CB) or a vector of residues
371 //
372 stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::vectorcxx . . $ std/vector#<mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *> >
373 setup_test_sequencecxx . . $ coot/side_chain_densities#setup_test_sequence(73c8f392ed3a71bf).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol, const stdcxx . . $ std/::stringcxx . . $ std/string# &chain_id, int resno_start, int resno_end,
374 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
375
376 void test_sequencecxx . . $ coot/side_chain_densities#test_sequence(913b8f35dda308a0).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *> &a_run_of_residues,
377 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap,
378 const stdcxx . . $ std/::stringcxx . . $ std/string# &sequence_name, // from fasta file
379 const stdcxx . . $ std/::stringcxx . . $ std/string# &sequence,
380 bool print_slider_results=false);
381
382 void setup_likelihood_of_each_rotamer_at_every_residuecxx . . $ coot/side_chain_densities#setup_likelihood_of_each_rotamer_at_every_residue(e4ef8f2523c9f2ba).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *> &a_run_of_residues,
383 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
384
385 // find the best result stored by the above function.
386 results_tcxx . . $ coot/side_chain_densities#results_t# get_resultcxx . . $ coot/side_chain_densities#get_result(263bd4d045b568b7).(bool only_return_result_if_probably_correct, bool print_sequencing_solutions_flag=false) const;
387
388 // return the "guessed" sequence
389 stdcxx . . $ std/::stringcxx . . $ std/string#
390 guess_the_sequencecxx . . $ coot/side_chain_densities#guess_the_sequence(a039709b78583575).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol,
391 const stdcxx . . $ std/::stringcxx . . $ std/string# &chain_id,
392 int resno_start, int resno_end,
393 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap,
394 bool verbose_output_mode = false);
395
396 // Have a guess at the sequence - choose the best fitting residue at every position
397 // and turn that into a string.
398 //
399 stdcxx . . $ std/::stringcxx . . $ std/string# best_guesscxx . . $ coot/side_chain_densities#best_guess(a650572a8e2a9732).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol,
400 const stdcxx . . $ std/::stringcxx . . $ std/string# &chain_id,
401 int resno_start, int resno_end,
402 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap) const;
403
404 bool test_grid_point_to_coords_interconversioncxx . . $ coot/side_chain_densities#test_grid_point_to_coords_interconversion(50ce9a9e25b4a850).() const;
405
406 void check_vs_flat_densitycxx . . $ coot/side_chain_densities#check_vs_flat_density(83f5f38750778ac8).() const; // do TRPs score higher than a VAL? Is that bad?
407 };
408
409 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<fragment_container_tcxx . . $ coot/fragment_container_t#::fragment_range_tcxx . . $ coot/fragment_container_t#fragment_range_t#, stdcxx . . $ std/::vectorcxx . . $ std/vector#<side_chain_densitiescxx . . $ coot/side_chain_densities#::results_tcxx . . $ coot/side_chain_densities#results_t#> > >
410 get_fragment_sequence_scorescxx . . $ coot/get_fragment_sequence_scores(c6c7ba2c476ebc1f).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol,
411 const fasta_multicxx . . $ coot/fasta_multi# &fam,
412 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap);
413
414 void get_fragment_by_fragment_scorescxx . . $ coot/get_fragment_by_fragment_scores(64d1e2d37ac23efc).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol,
415 const fasta_multicxx . . $ coot/fasta_multi# &fam,
416 const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap,
417 const stdcxx . . $ std/::stringcxx . . $ std/string# &results_table_file_name_prefix);
418
419
420 }
421
422
423
424 #endif // SIDE_CHAIN_DENSITIES_HH