| 1 | /* ligand/helix-placement.cc |
| 2 | * |
| 3 | * Copyright 2005 The University of York |
| 4 | * Author: Paul Emsley, Kevin Cowtan |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or (at |
| 9 | * your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 19 | */ |
| 20 | |
| 21 | #include "clipper/core/coords.h" |
| 22 | #include "clipper/core/xmap.h" |
| 23 | #include "mini-mol/mini-mol.hh"cxx . . $ `<file>/mini-mol/mini-mol.hh`/ |
| 24 | #include "coot-utils/coot-map-utils.hh"cxx . . $ `<file>/coot-utils/coot-map-utils.hh`/ |
| 25 | |
| 26 | namespace cootcxx . . $ coot/ { |
| 27 | |
| 28 | class scored_helix_info_tcxx . . $ coot/scored_helix_info_t# { |
| 29 | public: |
| 30 | minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# molcxx . . $ coot/scored_helix_info_t#mol.; |
| 31 | float scorecxx . . $ coot/scored_helix_info_t#score.; |
| 32 | scored_helix_info_tcxx . . $ coot/scored_helix_info_t#scored_helix_info_t(5ef2f84fc85ee5de).(const minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# &mol_in, float score_in):molcxx . . $ coot/scored_helix_info_t#mol.(mol_in) { |
| 33 | scorecxx . . $ coot/scored_helix_info_t#score. = score_in; |
| 34 | } |
| 35 | scored_helix_info_tcxx . . $ coot/scored_helix_info_t#scored_helix_info_t(49f6e7a06ebc5aa8).() { scorecxx . . $ coot/scored_helix_info_t#score. = -9999999.9;} |
| 36 | }; |
| 37 | bool compare_scored_strandscxx . . $ coot/compare_scored_strands(3e275b95b61d3837).(const scored_helix_info_tcxx . . $ coot/scored_helix_info_t# &a, const scored_helix_info_tcxx . . $ coot/scored_helix_info_t# &b); |
| 38 | |
| 39 | class eigen_info_tcxx . . $ coot/eigen_info_t# { |
| 40 | public: |
| 41 | clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# rtopcxx . . $ coot/eigen_info_t#rtop.; |
| 42 | int best_eigen_value_indexcxx . . $ coot/eigen_info_t#best_eigen_value_index.; |
| 43 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> eigen_valuescxx . . $ coot/eigen_info_t#eigen_values.; |
| 44 | eigen_info_tcxx . . $ coot/eigen_info_t#eigen_info_t(ec3ffd7e4c509f84).(const clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# &rtop_in, |
| 45 | int best_eigen_index_in, |
| 46 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> &eigen_values_in) : rtopcxx . . $ coot/eigen_info_t#rtop.(rtop_in), eigen_valuescxx . . $ coot/eigen_info_t#eigen_values.(eigen_values_in) { |
| 47 | best_eigen_value_indexcxx . . $ coot/eigen_info_t#best_eigen_value_index. = best_eigen_index_in; |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | class helix_placement_info_tcxx . . $ coot/helix_placement_info_t# { |
| 52 | public: |
| 53 | // the first mol [0] is the best fit. If there is a second one |
| 54 | // in [1] then it is the reverse fit. |
| 55 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule#> molcxx . . $ coot/helix_placement_info_t#mol.; |
| 56 | short int successcxx . . $ coot/helix_placement_info_t#success.; |
| 57 | stdcxx . . $ std/::stringcxx . . $ std/string# failure_messagecxx . . $ coot/helix_placement_info_t#failure_message.; |
| 58 | helix_placement_info_tcxx . . $ coot/helix_placement_info_t#helix_placement_info_t(d7525711b08e4f59).(const minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# &mol_in, |
| 59 | short int success_in, |
| 60 | const stdcxx . . $ std/::stringcxx . . $ std/string# &f_message_in) { |
| 61 | molcxx . . $ coot/helix_placement_info_t#mol..clearcxx . . $ std/vector#clear(ced63f7c635d850d).(); |
| 62 | molcxx . . $ coot/helix_placement_info_t#mol..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(mol_in); |
| 63 | successcxx . . $ coot/helix_placement_info_t#success. = success_in; |
| 64 | failure_messagecxx . . $ coot/helix_placement_info_t#failure_message. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). f_message_in; |
| 65 | } |
| 66 | helix_placement_info_tcxx . . $ coot/helix_placement_info_t#helix_placement_info_t(3c8a5f91d8691310).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule#> &mol_v, |
| 67 | short int success_in, |
| 68 | const stdcxx . . $ std/::stringcxx . . $ std/string# &f_message_in) :molcxx . . $ std/vector#vector(a1201200cf0efa42).(mol_v), failure_messagecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).(f_message_in) { |
| 69 | successcxx . . $ coot/helix_placement_info_t#success. = success_in; |
| 70 | } |
| 71 | }; |
| 72 | |
| 73 | class helix_placementcxx . . $ coot/helix_placement# { |
| 74 | |
| 75 | clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> xmapcxx . . $ coot/helix_placement#xmap.; |
| 76 | clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# |
| 77 | move_helix_centre_point_guesscxx . . $ coot/helix_placement#move_helix_centre_point_guess(14c1b8bf9c0dd15a).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt, float density_max) const; |
| 78 | eigen_info_tcxx . . $ coot/eigen_info_t# helix_eigen_systemcxx . . $ coot/helix_placement#helix_eigen_system(bf62a47acffef0f4).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# pt, float search_radius) const; |
| 79 | helix_placement_info_tcxx . . $ coot/helix_placement_info_t# get_20_residue_helix_standard_orientationcxx . . $ coot/helix_placement#get_20_residue_helix_standard_orientation(6c960eda6f397b1).(int n_residues, |
| 80 | float b_factor) const; |
| 81 | helix_placement_info_tcxx . . $ coot/helix_placement_info_t# get_20_residue_helixcxx . . $ coot/helix_placement#get_20_residue_helix(ec885671b9e62f07).(int nresidues) const; |
| 82 | float score_helix_positioncxx . . $ coot/helix_placement#score_helix_position(a0b84a170f8981cf).(const minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# &m) const; |
| 83 | // pair(other atoms, c-betas) |
| 84 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth#> |
| 85 | optimize_rotation_fitcxx . . $ coot/helix_placement#optimize_rotation_fit(431d14f672c8af74).(const minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# &helix, |
| 86 | const clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# &axis_ori, |
| 87 | const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &helix_point) const; |
| 88 | stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#>, stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> > |
| 89 | decompose_helix_by_cbetacxx . . $ coot/helix_placement#decompose_helix_by_cbeta(efc016816866d094).(minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# &m) const; |
| 90 | utilcxx . . $ coot/util/::density_stats_info_tcxx . . $ coot/util/density_stats_info_t# score_residuecxx . . $ coot/helix_placement#score_residue(b5a505dc0dda3861).(const minimolcxx . . $ coot/minimol/::residuecxx . . $ coot/minimol/residue# &residue) const; |
| 91 | utilcxx . . $ coot/util/::density_stats_info_tcxx . . $ coot/util/density_stats_info_t# score_atomscxx . . $ coot/helix_placement#score_atoms(9b6e4287d8edf03a).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> &atom_pos) const; |
| 92 | stdcxx . . $ std/::paircxx . . $ std/pair#<int, int> trim_endscxx . . $ coot/helix_placement#trim_ends(6312286c277ca48).(minimolcxx . . $ coot/minimol/::fragmentcxx . . $ coot/minimol/fragment# *m, float min_density_limit) const; // modify m by chopping off residues |
| 93 | int trim_endcxx . . $ coot/helix_placement#trim_end(2f1f4a0c385f8268).(minimolcxx . . $ coot/minimol/::fragmentcxx . . $ coot/minimol/fragment# *m, short int end_type, float min_density_limit) const; |
| 94 | |
| 95 | void build_on_N_endcxx . . $ coot/helix_placement#build_on_N_end(4d563378ef3fb4e5).(minimolcxx . . $ coot/minimol/::fragmentcxx . . $ coot/minimol/fragment# *m, float min_density_limit, float b_factor) const; |
| 96 | void build_on_C_endcxx . . $ coot/helix_placement#build_on_C_end(4d563378ef3fb4e5).(minimolcxx . . $ coot/minimol/::fragmentcxx . . $ coot/minimol/fragment# *m, float min_density_limit, float b_factor) const; |
| 97 | minimolcxx . . $ coot/minimol/::residuecxx . . $ coot/minimol/residue# |
| 98 | build_N_terminal_ALAcxx . . $ coot/helix_placement#build_N_terminal_ALA(48cef1a107f65814).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &prev_n, |
| 99 | const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &prev_ca, |
| 100 | const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &prev_c, |
| 101 | int seqno, |
| 102 | float b_factor) const; |
| 103 | minimolcxx . . $ coot/minimol/::residuecxx . . $ coot/minimol/residue# |
| 104 | build_C_terminal_ALAcxx . . $ coot/helix_placement#build_C_terminal_ALA(48cef1a107f65814).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &prev_n, |
| 105 | const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &prev_ca, |
| 106 | const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &prev_c, |
| 107 | int seqno, |
| 108 | float b_factor) const; |
| 109 | // tinker with m |
| 110 | void trim_and_growcxx . . $ coot/helix_placement#trim_and_grow(b7af30d83b4d586e).(minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# *m, float min_density_limit, float b_factor) const; |
| 111 | |
| 112 | // factoring out for strand tubes |
| 113 | clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# |
| 114 | find_best_tube_orientationcxx . . $ coot/helix_placement#find_best_tube_orientation(60e92e1d6131eae1).(clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# ptc, |
| 115 | double cyl_len, double cyl_rad, |
| 116 | float density_level) const; // uses member data xmap |
| 117 | |
| 118 | scored_helix_info_tcxx . . $ coot/scored_helix_info_t# fit_strandcxx . . $ coot/helix_placement#fit_strand(4ffaeb59d5fbf002).(const minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# &mol, |
| 119 | const clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# &rtop, |
| 120 | int imol, |
| 121 | float map_rmsd) const; |
| 122 | |
| 123 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<scored_helix_info_tcxx . . $ coot/scored_helix_info_t#> |
| 124 | find_strand_candidates_by_shift_samplingcxx . . $ coot/helix_placement#find_strand_candidates_by_shift_sampling(3c27bd0e13c81a63).(const minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# &mol, |
| 125 | const clippercxx . . $ clipper/::RTop_orthcxx . . $ clipper/RTop_orth# &rtop) const; |
| 126 | |
| 127 | |
| 128 | public: |
| 129 | explicit helix_placementcxx . . $ coot/helix_placement#helix_placement(a3d327df7f340b51).(const clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> &xmap_in) : xmapcxx . . $ coot/helix_placement#xmap.(xmap_in) { } |
| 130 | void discrimination_mapcxx . . $ coot/helix_placement#discrimination_map(83f5f38750778ac8).() const; //debugging |
| 131 | |
| 132 | // Pass the initial testing helix length. Typically start with |
| 133 | // 20, try 12 if that fails. |
| 134 | helix_placement_info_tcxx . . $ coot/helix_placement_info_t# place_alpha_helix_nearcxx . . $ coot/helix_placement#place_alpha_helix_near(71d970a9573fc0a).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt, |
| 135 | int n_helix_residues_start, |
| 136 | float density_level_for_trim, |
| 137 | float b_factor, |
| 138 | float map_rmsd) const; |
| 139 | |
| 140 | // Kevin's engine: do MR-like search on the surface of a |
| 141 | // cylinder, not just the eigen vectors |
| 142 | // |
| 143 | // For triming and growing we grow into density that is at least |
| 144 | // density_level_for_trim. |
| 145 | // |
| 146 | // For scoring (and to help not to build into "U" sites) we use |
| 147 | // high_density_turning_point (that is we begin to score |
| 148 | // progressively badly when the density is higher than |
| 149 | // high_density_turning_point) i.e. high_density_turning_point |
| 150 | // is the top of the "triangle". |
| 151 | // |
| 152 | helix_placement_info_tcxx . . $ coot/helix_placement_info_t# place_alpha_helix_near_kc_versioncxx . . $ coot/helix_placement#place_alpha_helix_near_kc_version(15796e59cf8c115c).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt, |
| 153 | int n_helix_residues_start, |
| 154 | float density_level_for_trim, |
| 155 | float high_density_turning_point, |
| 156 | float b_factor, |
| 157 | float map_rmds) const; |
| 158 | |
| 159 | // and now for strands, we use much of the same code, including |
| 160 | // the perhaps mis-leading helper class names |
| 161 | // |
| 162 | // n_sample_strands is the number of sample strands that we should get from the database |
| 163 | // |
| 164 | helix_placement_info_tcxx . . $ coot/helix_placement_info_t# place_strandcxx . . $ coot/helix_placement#place_strand(c04162e362f218fb).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt, int n_residues, |
| 165 | int n_sample_strands, float sigma_level); |
| 166 | |
| 167 | }; |
| 168 | } |