| 1 | /* |
| 2 | * ligand/res-tracer.cc |
| 3 | * |
| 4 | * Copyright 2021 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 | |
| 27 | #include <clipper/ccp4/ccp4_map_io.h> |
| 28 | |
| 29 | #include "utils/ctpl.h"cxx . . $ `<file>/utils/ctpl.h`/ |
| 30 | #include "utils/coot-fasta.hh"cxx . . $ `<file>/utils/coot-fasta.hh`/ |
| 31 | #include "geometry/residue-and-atom-specs.hh"cxx . . $ `<file>/geometry/residue-and-atom-specs.hh`/ |
| 32 | #include "coot-utils/coot-coord-utils.hh"cxx . . $ `<file>/coot-utils/coot-coord-utils.hh`/ |
| 33 | #include "coot-utils/coot-map-utils.hh"cxx . . $ `<file>/coot-utils/coot-map-utils.hh`/ |
| 34 | #include "rama-rsr-extend-fragments.hh"cxx . . $ `<file>/ligand/rama-rsr-extend-fragments.hh`/ |
| 35 | #include "ligand.hh"cxx . . $ `<file>/ligand/ligand.hh`/ |
| 36 | #include "libres-tracer.hh"cxx . . $ `<file>/ligand/libres-tracer.hh`/ |
| 37 | |
| 38 | void |
| 39 | test_best_fit_phi_psi_funccxx . . $ test_best_fit_phi_psi_func(49f6e7a06ebc5aa8).() { |
| 40 | |
| 41 | stdcxx . . $ std/::stringcxx . . $ std/string# hklin_file_name = "coot-download/1gwd_map.mtz"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 42 | stdcxx . . $ std/::stringcxx . . $ std/string# f_col_label = "FWT"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 43 | stdcxx . . $ std/::stringcxx . . $ std/string# phi_col_label = "PHWT"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 44 | stdcxx . . $ std/::stringcxx . . $ std/string# pir_file_name = "1gwd.pir"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 45 | stdcxx . . $ std/::stringcxx . . $ std/string# pdb_files = "1gwd-A-no-sidechains.pdb"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 46 | |
| 47 | clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> xmapcxx . . $ clipper/Xmap#Xmap(49f6e7a06ebc5aa8).; |
| 48 | cootcxx . . $ coot/::utilcxx . . $ coot/util/::map_fill_from_mtzcxx . . $ coot/util/map_fill_from_mtz(40ff3c6231269daa).(&xmap, hklin_file_namecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., f_col_labelcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., phi_col_labelcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., 0, 0); |
| 49 | |
| 50 | mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol = new mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager#; |
| 51 | mmdbcxx . . $ mmdb/::ERROR_CODEcxx . . $ mmdb/ERROR_CODE# err = mol->ReadCoorFilecxx . . $ mmdb/Root#ReadCoorFile(9eb88f3d8809bd24).("1gwd-A-no-sidechains.pdb"); |
| 52 | if (err) { |
| 53 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "ERROR:: reading pdb file " <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 54 | } else { |
| 55 | cootcxx . . $ coot/::residue_spec_tcxx . . $ coot/residue_spec_t# speccxx . . $ coot/residue_spec_t#residue_spec_t(4c8fe34621fcbf1c).("A"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., 5, ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 56 | mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_sel_1_p = cootcxx . . $ coot/::utilcxx . . $ coot/util/::get_residuecxx . . $ coot/util/get_residue(6049532bd3c35128).(spec, mol); |
| 57 | mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_sel_2_p = cootcxx . . $ coot/::utilcxx . . $ coot/util/::get_residuecxx . . $ coot/util/get_residue(6049532bd3c35128).(spec.nextcxx . . $ coot/residue_spec_t#next(33b43fb1687af3bb).(), mol); |
| 58 | |
| 59 | if (residue_sel_1_p && residue_sel_2_p) { |
| 60 | |
| 61 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *> residues = {cxx . . $ std/vector#vector(9619226211e5a241).residue_sel_1_p, residue_sel_2_p }; |
| 62 | auto mol_for_residue = cootcxx . . $ coot/::utilcxx . . $ coot/util/::create_mmdbmanager_from_residue_vectorcxx . . $ coot/util/create_mmdbmanager_from_residue_vector(c5f5c42bfb61a5b0).(residues, mol); |
| 63 | if (mol_for_residue.first) { |
| 64 | unsigned int n_threads = cootcxx . . $ coot/::get_max_number_of_threadscxx . . $ coot/get_max_number_of_threads(db52760e79bf9054).(); |
| 65 | ctplcxx . . $ ctpl/::thread_poolcxx . . $ ctpl/thread_pool# thread_poolcxx . . $ ctpl/thread_pool#thread_pool(3e454b8ccf442868).(n_threads); |
| 66 | float weight = 60.0; |
| 67 | unsigned int n_phi_psi_trials = 1000; |
| 68 | cootcxx . . $ coot/::protein_geometrycxx . . $ coot/protein_geometry# geomcxx . . $ coot/protein_geometry#protein_geometry(49f6e7a06ebc5aa8).; |
| 69 | geom.init_standardcxx . . $ coot/protein_geometry#init_standard(b126dc7c1de90089).(); |
| 70 | unsigned int update_count = 0; |
| 71 | stdcxx . . $ std/::pair<float, float> mv = cootcxx . . $ coot/::utilcxx . . $ coot/util/::mean_and_variancecxx . . $ coot/util/mean_and_variance(71f3a0a4d906ac43).(xmap); |
| 72 | float xmap_rmsd = stdcxx . . $ std/::sqrt(mv.second); |
| 73 | rama_rsr_extend_fragmentscxx . . $ rama_rsr_extend_fragments(cd7b89f2de5ae8bf).(mol_for_residue.second, xmap, xmap_rmsd, &thread_pool, n_threads, weight, n_phi_psi_trials, geom, &update_count); |
| 74 | mol_for_residue.second->WritePDBASCIIcxx . . $ mmdb/Root#WritePDBASCII(9eb88f3d8809bd24).("test_best_fit_phi_psi_result.pdb"); |
| 75 | } else { |
| 76 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "No mol_for_residue" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 77 | } |
| 78 | } else { |
| 79 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "No mol for residue " <<cxx . . $ coot/`operator<<`(864abc555d23019c). spec <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | #include "coot-utils/atom-selection-container.hh"cxx . . $ `<file>/coot-utils/atom-selection-container.hh`/ |
| 85 | |
| 86 | void |
| 87 | learn_lysocxx . . $ learn_lyso(49f6e7a06ebc5aa8).() { |
| 88 | |
| 89 | stdcxx . . $ std/::stringcxx . . $ std/string# hklin_file_name = "1gwd_map.mtz"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 90 | stdcxx . . $ std/::stringcxx . . $ std/string# f_col_label = "FWT"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 91 | stdcxx . . $ std/::stringcxx . . $ std/string# phi_col_label = "PHWT"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 92 | stdcxx . . $ std/::stringcxx . . $ std/string# pir_file_name = "1gwd.pir"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 93 | stdcxx . . $ std/::stringcxx . . $ std/string# pdb_file = "1gwd.cif"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 94 | try { |
| 95 | cootcxx . . $ coot/::fasta_multicxx . . $ coot/fasta_multi# famcxx . . $ coot/fasta_multi#fasta_multi(49f6e7a06ebc5aa8).; |
| 96 | fam.readcxx . . $ coot/fasta_multi#read(9c546c94e5fcce4e).(pir_file_name); |
| 97 | clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> xmapcxx . . $ clipper/Xmap#Xmap(49f6e7a06ebc5aa8).; |
| 98 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Read mtz file " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). hklin_file_name <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). f_col_label <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). phi_col_label <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 99 | bool use_weights = false; |
| 100 | cootcxx . . $ coot/::utilcxx . . $ coot/util/::map_fill_from_mtzcxx . . $ coot/util/map_fill_from_mtz(40ff3c6231269daa).(&xmap, hklin_file_namecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., f_col_labelcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., phi_col_labelcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., use_weights); |
| 101 | atom_selection_container_tcxx . . $ atom_selection_container_t# asc = get_atom_selectioncxx . . $ get_atom_selection(26dc035f401aa7bb).(pdb_filecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., false); |
| 102 | double variation = 0.4; |
| 103 | unsigned int n_top_spin_pairs = 70000; // deep into the mire (scores are for backwards pairs also) |
| 104 | float flood_atom_mask_radius = 0.6; // was 1.0 |
| 105 | float weight = 8.0f; // calculate this (using rmsd) |
| 106 | mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *working_mol = new mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager#; |
| 107 | float rmsd_cuffoff = 2.3; |
| 108 | stdcxx . . $ std/::pair<float, float> mv = cootcxx . . $ coot/::utilcxx . . $ coot/util/::mean_and_variancecxx . . $ coot/util/mean_and_variance(71f3a0a4d906ac43).(xmap); |
| 109 | float xmap_rmsd = stdcxx . . $ std/::sqrt(mv.second); |
| 110 | int imol = 0; |
| 111 | watch_res_tracer_data_tcxx . . $ watch_res_tracer_data_t# tracer_datacxx . . $ watch_res_tracer_data_t#watch_res_tracer_data_t(a5562cf2222b81e0).(working_mol, imol); |
| 112 | res_tracer_learncxx . . $ res_tracer_learn(f08989321bc130b9).(xmap, weight, xmap_rmsd, rmsd_cuffoff, fam, variation, n_top_spin_pairs, flood_atom_mask_radius, asc.molcxx . . $ atom_selection_container_t#mol.); |
| 113 | |
| 114 | } |
| 115 | catch (clippercxx . . $ clipper/::Message_fatalcxx . . $ clipper/Message_fatal# &rte) { |
| 116 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "ERROR::" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). rte.textcxx . . $ clipper/Message_fatal#text(f4fff0029955a25f).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | void |
| 121 | learncxx . . $ learn(49f6e7a06ebc5aa8).() { |
| 122 | |
| 123 | learn_lysocxx . . $ learn_lyso(49f6e7a06ebc5aa8).(); |
| 124 | } |
| 125 | |
| 126 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) { |
| 127 | |
| 128 | int status = 0; |
| 129 | bool test_best_fit_phi_psi = false; |
| 130 | bool with_ncs = false; |
| 131 | |
| 132 | stdcxx . . $ std/::stringcxx . . $ std/string# hklin_file_name = "rnasa-1.8-all_refmac1.mtz"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 133 | stdcxx . . $ std/::stringcxx . . $ std/string# f_col_label = "FWT"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 134 | stdcxx . . $ std/::stringcxx . . $ std/string# phi_col_label = "PHWT"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 135 | stdcxx . . $ std/::stringcxx . . $ std/string# pir_file_name = "../src/rnase.pir"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 136 | |
| 137 | stdcxx . . $ std/::stringcxx . . $ std/string# map_file_name = "1gwd_map_mainchain-masked.map"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 138 | |
| 139 | if (false) { |
| 140 | hklin_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "../src/tm-A-1.0.mtz"; |
| 141 | f_col_label =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "FC"; |
| 142 | phi_col_label =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "PHIC"; |
| 143 | } |
| 144 | |
| 145 | if (true) { |
| 146 | hklin_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "1gwd_map.mtz"; |
| 147 | f_col_label =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "FWT"; |
| 148 | phi_col_label =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "PHWT"; |
| 149 | pir_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "1gwd.pir"; |
| 150 | } |
| 151 | |
| 152 | if (false) { // this is hard |
| 153 | hklin_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "65_bucc3atest3_fphiout_acorn.mtz"; |
| 154 | f_col_label =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "F"; |
| 155 | phi_col_label =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "PHI"; |
| 156 | // pir_file_name = "all-e-coli.fasta"; |
| 157 | pir_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "1gwd.pir"; |
| 158 | } |
| 159 | |
| 160 | if (false) { // DPS map |
| 161 | map_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "emd_11210.map"; |
| 162 | pir_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "6zgl.fasta"; |
| 163 | } |
| 164 | |
| 165 | bool do_learn = false; |
| 166 | if (argc > 1) { |
| 167 | stdcxx . . $ std/::stringcxx . . $ std/string# argv_1 = argvcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[1]; |
| 168 | if (argv_1 ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "test-best-fit-phi-psi") test_best_fit_phi_psi = true; |
| 169 | if (argv_1 ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "learn") do_learn = true; |
| 170 | } |
| 171 | |
| 172 | if (test_best_fit_phi_psi) { |
| 173 | |
| 174 | test_best_fit_phi_psi_funccxx . . $ test_best_fit_phi_psi_func(49f6e7a06ebc5aa8).(); |
| 175 | |
| 176 | } else { |
| 177 | |
| 178 | if (do_learn) { |
| 179 | |
| 180 | learncxx . . $ learn(49f6e7a06ebc5aa8).(); |
| 181 | |
| 182 | } else { |
| 183 | |
| 184 | cootcxx . . $ coot/::fasta_multicxx . . $ coot/fasta_multi# famcxx . . $ coot/fasta_multi#fasta_multi(49f6e7a06ebc5aa8).; |
| 185 | fam.readcxx . . $ coot/fasta_multi#read(9c546c94e5fcce4e).(pir_file_name); |
| 186 | |
| 187 | bool test_from_crystallography = true; |
| 188 | bool test_from_map = false; |
| 189 | |
| 190 | // =================================================================== |
| 191 | // user input map and fam file |
| 192 | // =================================================================== |
| 193 | if (argc == 3) { |
| 194 | map_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). argv[1]; |
| 195 | pir_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). argv[2]; |
| 196 | test_from_crystallography = false; |
| 197 | test_from_map = true; |
| 198 | } |
| 199 | |
| 200 | double variation = 0.8; // how much is a CA-CA distance allowed to vary from 3.81 |
| 201 | // before it is too long or short to be considered a potential |
| 202 | // peptide? |
| 203 | // make bigger at lower resolutions (maybe up to 1.0?) |
| 204 | variation = 0.4; // speed |
| 205 | // variation = 0.8; // 20240811-PE 1.4 crashes at the close of grow_trees_v4() atm, 1.0 is OK, 1.2 crashes, 1.1 crashes |
| 206 | |
| 207 | unsigned int n_top_spin_pairs = 500; // Use for tracing at most this many spin score pairs (which have been sorted). |
| 208 | // This and variation affect the run-time (and results?) |
| 209 | n_top_spin_pairs = 200000; // was 1000 |
| 210 | n_top_spin_pairs = 1000; |
| 211 | |
| 212 | unsigned int n_top_fragments = 1000; // was 4000 // The top 1000 fragments at least are all the same trace for no-side-chain lyso test |
| 213 | n_top_fragments = 10000; |
| 214 | n_top_fragments = 1000; |
| 215 | |
| 216 | // pass the atom radius from here too |
| 217 | |
| 218 | float flood_atom_mask_radius = 1.0; // was 0.6 for emdb |
| 219 | |
| 220 | unsigned int n_phi_psi_trials = 40000; // was 5000 // was 40000 // 40000 seems good for production |
| 221 | |
| 222 | float weight = 8.0f; // calculate this (using rmsd) |
| 223 | |
| 224 | if (false) { // EMD-22898 |
| 225 | // map_file_name = "emd_22898_blur_20.map"; |
| 226 | weight = 6.0; |
| 227 | flood_atom_mask_radius = 0.7; |
| 228 | n_top_fragments = 2000; |
| 229 | n_top_spin_pairs = 30000; // was 10000 |
| 230 | variation = 0.8; |
| 231 | n_phi_psi_trials = 10000;// was 50000 |
| 232 | } |
| 233 | |
| 234 | // for RNAse test |
| 235 | if (false) { |
| 236 | n_phi_psi_trials = 10000; |
| 237 | n_top_spin_pairs = 3000; |
| 238 | n_top_fragments = 5000; |
| 239 | flood_atom_mask_radius = 0.8; |
| 240 | variation = 0.3; |
| 241 | with_ncs = true; |
| 242 | } |
| 243 | |
| 244 | // for acorn |
| 245 | if (false) { |
| 246 | n_phi_psi_trials = 10000; |
| 247 | n_top_spin_pairs = 3000; |
| 248 | n_top_fragments = 10000; |
| 249 | flood_atom_mask_radius = 0.8; |
| 250 | variation = 0.4; |
| 251 | with_ncs = true; |
| 252 | } |
| 253 | |
| 254 | if (test_from_crystallography) { |
| 255 | |
| 256 | clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> xmapcxx . . $ clipper/Xmap#Xmap(49f6e7a06ebc5aa8).; |
| 257 | if (test_from_map) { |
| 258 | if (cootcxx . . $ coot/::file_existscxx . . $ coot/file_exists(7c222eea44a24d43).(map_file_name)) { |
| 259 | clippercxx . . $ clipper/::CCP4MAPfilecxx . . $ clipper/CCP4MAPfile# filecxx . . $ clipper/CCP4MAPfile#CCP4MAPfile(49f6e7a06ebc5aa8).; |
| 260 | file.open_readcxx . . $ clipper/CCP4MAPfile#open_read(b4f7366dea7cb22b).(map_file_namecxx . . $ clipper/String#String(8d4ab0a187bf9331).); |
| 261 | file.import_xmapcxx . . $ clipper/CCP4MAPfile#import_xmap(933028ebeb4ed51b).(xmap); |
| 262 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Imported map from file " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). map_file_name <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 263 | } else { |
| 264 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Map file does not exist " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). map_file_name <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 265 | } |
| 266 | } else { |
| 267 | |
| 268 | if (! f_col_label.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 269 | if (! phi_col_label.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 270 | try { |
| 271 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Read mtz file " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). hklin_file_name <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). f_col_label <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). phi_col_label <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 272 | bool use_weights = false; |
| 273 | cootcxx . . $ coot/::utilcxx . . $ coot/util/::map_fill_from_mtzcxx . . $ coot/util/map_fill_from_mtz(40ff3c6231269daa).(&xmap, hklin_file_namecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., f_col_labelcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., phi_col_labelcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., use_weights); |
| 274 | } |
| 275 | catch (clippercxx . . $ clipper/::Message_fatalcxx . . $ clipper/Message_fatal# &rte) { |
| 276 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "ERROR::" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). rte.textcxx . . $ clipper/Message_fatal#text(f4fff0029955a25f).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | if (! xmap.is_nullcxx . . $ clipper/Xmap_base#is_null(50ce9a9e25b4a850).()) { |
| 282 | |
| 283 | mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *working_mol = new mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager#; |
| 284 | unsigned int update_count = 0; |
| 285 | |
| 286 | float rmsd_cuffoff = 2.3; |
| 287 | stdcxx . . $ std/::pair<float, float> mv = cootcxx . . $ coot/::utilcxx . . $ coot/util/::mean_and_variancecxx . . $ coot/util/mean_and_variance(71f3a0a4d906ac43).(xmap); |
| 288 | float xmap_rmsd = stdcxx . . $ std/::sqrt(mv.second); |
| 289 | |
| 290 | int imol = 0; |
| 291 | watch_res_tracer_data_tcxx . . $ watch_res_tracer_data_t# tracer_datacxx . . $ watch_res_tracer_data_t#watch_res_tracer_data_t(a5562cf2222b81e0).(working_mol, imol); |
| 292 | res_tracer_proccxx . . $ res_tracer_proc(8e46cbbdcf5838ac).(xmap, xmap_rmsd, fam, variation, n_top_spin_pairs, n_top_fragments, rmsd_cuffoff, flood_atom_mask_radius, |
| 293 | weight, n_phi_psi_trials, with_ncs, &tracer_data); |
| 294 | |
| 295 | } else { |
| 296 | if (test_from_map) |
| 297 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Map from " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). map_file_name <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " is null" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 298 | } |
| 299 | |
| 300 | } else { // not crystallography |
| 301 | |
| 302 | try { |
| 303 | |
| 304 | if (cootcxx . . $ coot/::file_existscxx . . $ coot/file_exists(7c222eea44a24d43).(map_file_name)) { |
| 305 | |
| 306 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "::::::::: cryo-em map path" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). map_file_name <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 307 | clippercxx . . $ clipper/::CCP4MAPfilecxx . . $ clipper/CCP4MAPfile# filecxx . . $ clipper/CCP4MAPfile#CCP4MAPfile(49f6e7a06ebc5aa8).; |
| 308 | file.open_readcxx . . $ clipper/CCP4MAPfile#open_read(b4f7366dea7cb22b).(map_file_namecxx . . $ clipper/String#String(8d4ab0a187bf9331).); |
| 309 | clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> xmapcxx . . $ clipper/Xmap#Xmap(49f6e7a06ebc5aa8).; |
| 310 | fam.readcxx . . $ coot/fasta_multi#read(9c546c94e5fcce4e).(pir_file_name); |
| 311 | file.import_xmapcxx . . $ clipper/CCP4MAPfile#import_xmap(933028ebeb4ed51b).(xmap); |
| 312 | mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *working_mol = new mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager#; |
| 313 | int imol = 0; |
| 314 | flood_atom_mask_radius = 0.6; |
| 315 | watch_res_tracer_data_tcxx . . $ watch_res_tracer_data_t# tracer_datacxx . . $ watch_res_tracer_data_t#watch_res_tracer_data_t(a5562cf2222b81e0).(working_mol, imol); |
| 316 | stdcxx . . $ std/::pair<float, float> mv = cootcxx . . $ coot/::utilcxx . . $ coot/util/::mean_and_variancecxx . . $ coot/util/mean_and_variance(71f3a0a4d906ac43).(xmap); |
| 317 | float xmap_rmsd = stdcxx . . $ std/::sqrt(mv.second); |
| 318 | |
| 319 | bool do_reinterp = true; |
| 320 | float reinterp_factor = 2.0; // was 3.0; |
| 321 | |
| 322 | if (do_reinterp) { |
| 323 | // 1gwd has ~0.3A/grid - is that a factor? |
| 324 | // 20240809-PE doesn't seem to make a difference. |
| 325 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "reinterpreting map " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). reinterp_factor <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 326 | clippercxx . . $ clipper/::Xmapcxx . . $ clipper/Xmap#<float> xmap_fine = cootcxx . . $ coot/::utilcxx . . $ coot/util/::reinterp_mapcxx . . $ coot/util/reinterp_map(61ce6fd6f8ce7464).(xmap, reinterp_factor); |
| 327 | xmap =cxx . . $ clipper/Xmap#`operator=`(a9e8af55d9489d7d). xmap_fine; // replace it |
| 328 | } |
| 329 | |
| 330 | res_tracer_proccxx . . $ res_tracer_proc(8e46cbbdcf5838ac).(xmap, xmap_rmsd, fam, variation, n_top_spin_pairs, n_top_fragments, 4.5, flood_atom_mask_radius, weight, n_phi_psi_trials, |
| 331 | with_ncs, &tracer_data); // working_mol, &update_count |
| 332 | } else { |
| 333 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "No such file " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). map_file_name <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 334 | } |
| 335 | } |
| 336 | catch (clippercxx . . $ clipper/::Message_fatalcxx . . $ clipper/Message_fatal# &rte) { |
| 337 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "ERROR::" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). rte.textcxx . . $ clipper/Message_fatal#text(f4fff0029955a25f).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | return status; |
| 344 | } |
| 345 | // |