57 #include <basic/database/open.hh>
70 #include <utility/file/file_sys_util.hh>
73 #include <basic/Tracer.hh>
75 #include <numeric/random/random.hh>
79 #include <basic/options/option.hh>
80 #include <basic/options/keys/score.OptionKeys.gen.hh>
81 #include <basic/options/keys/rna.OptionKeys.gen.hh>
97 #include <utility/vector1.hh>
98 #include <ObjexxFCL/format.hh>
101 namespace ObjexxFCL {
namespace fmt { } }
using namespace ObjexxFCL::fmt;
105 using namespace core;
107 namespace protocols {
110 static numeric::random::RandomGenerator
RG(12320);
112 static basic::Tracer
TR(
"protocols.rna.rna_denovo_protocol" ) ;
114 RNA_DeNovoProtocol::RNA_DeNovoProtocol(
117 bool const heat_structure ,
118 bool const minimize_structure ,
119 bool const relax_structure ,
120 bool const allow_bulge ):
123 monte_carlo_cycles_( 0 ),
124 monte_carlo_cycles_max_default_( 100000 ),
125 user_defined_cycles_( false ),
126 all_rna_fragments_file_( basic::database::full_name(
"chemical/rna/RICHARDSON_RNA09.torsions") ),
127 silent_file_( silent_file ),
128 lores_silent_file_(
"" ),
129 heat_structure_( heat_structure ),
131 minimize_structure_( minimize_structure ),
132 relax_structure_( relax_structure ),
133 ignore_secstruct_( false ),
134 do_close_loops_( true ),
135 close_loops_at_end_( true ),
136 close_loops_in_last_round_( true ),
137 close_loops_after_each_move_( false ),
138 simple_rmsd_cutoff_relax_( false ),
139 allow_bulge_( allow_bulge ),
140 allow_consecutive_bulges_( false ),
141 use_chem_shift_data_( basic::options::option[
142 basic::options::OptionKeys::
143 score::rna_chemical_shift_exp_data].user()),
144 m_Temperature_( 2.0 ),
146 rna_params_file_(
"" ),
147 rna_data_file_(
"" ),
148 jump_library_file_( basic::database::full_name(
"chemical/rna/1jj2_RNA_jump_library.dat" ) ),
151 output_lores_silent_file_( false ),
152 filter_lores_base_pairs_( false ),
153 filter_lores_base_pairs_early_( false ),
154 filter_chain_closure_( true ),
155 filter_chain_closure_distance_( 6.0 ),
156 filter_chain_closure_halfway_( true ),
157 vary_bond_geometry_( false ),
158 binary_rna_output_( false ),
159 jump_change_frequency_( 0.1 ),
160 lores_scorefxn_(
"rna_lores.wts" ),
161 chunk_coverage_( 0.0 ),
162 staged_constraints_( false ),
163 chainbreak_weight_( -1.0 ),
164 linear_chainbreak_weight_( -1.0 ),
165 titrate_stack_bonus_( true ),
166 move_first_rigid_body_( false ),
167 root_at_first_rigid_body_( false ),
168 output_filters_( false ),
169 lores_score_early_( false ),
170 lores_score_final_( false ),
171 autofilter_( false ),
172 autofilter_score_quantile_( 0.20 )
174 Mover::type(
"RNA_DeNovoProtocol");
194 using namespace core::pose;
195 using namespace core::scoring;
196 using namespace core::io::pdb;
197 using namespace core::io::silent;
198 using namespace protocols::rna;
213 Pose start_pose = pose;
231 std::string const out_file_tag =
"S_"+lead_zero_string_of( n, 6 );
236 bool found_good_decoy(
false );
238 while( ++ntries <= max_tries && !found_good_decoy ) {
240 time_t pdb_start_time = time(NULL);
242 if ( ntries > 1 )
TR <<
"Did not pass filters. Trying the model again: trial " << ntries <<
" out of " << max_tries << std::endl;
260 TR <<
"Beginning main loop... " << std::endl;
262 Size const rounds = 10;
265 for (
Size r = 1; r <= rounds; r++ ) {
267 TR <<
"Beginning round " << r <<
" of " << rounds << std::endl;
298 TR <<
"All atom rmsd: " << rmsd << std::endl;
309 TR <<
"Checking base pairs early! Result: " << base_pairs_OK << std::endl;
310 if (!base_pairs_OK)
break;
313 if ( r == rounds/2 ){
316 bool const rna_loops_OK =
rna_loop_closer_->check_closure( pose, filter_chain_closure_distance_halfway );
317 TR <<
"Checking loop closure with tolerance of " << filter_chain_closure_distance_halfway <<
" Angstroms! Result: " << rna_loops_OK << std::endl;
318 if (!rna_loops_OK)
break;
326 time_t pdb_end_time = time(NULL);
327 TR <<
"Finished fragment assembly of " << out_file_tag <<
" in " << (long)(pdb_end_time - pdb_start_time) <<
" seconds." << std::endl;
331 found_good_decoy =
true;
363 Size const num_res_virtualized =
370 (*curr_scorefxn)( pose );
374 std::string const out_file_name = out_file_tag +
".pdb";
387 return "RNA_DeNovoProtocol";
395 using namespace core::scoring;
416 Real const CS_weight = 4.0;
431 using namespace core::scoring;
497 TR <<
"Number of moving residues: " << nres_move << std::endl;
501 if ( nbody_move > 1 ) nbody_move--;
502 if ( nbody_move > 0 )
TR <<
"Number of moving bodies: " << nbody_move << std::endl;
508 TR <<
"Using maximum default Monte Carlo cycles: " <<
monte_carlo_cycles_ <<
". Use -cycles option to change this." << std::endl;
520 using namespace core::io::silent;
530 std::cout <<
"Already done: " << *iter << std::endl;
548 if ( !rigid_body_moves )
return;
550 if ( !
binary_rna_output_ ) utility_exit_with_message(
"Asking for virtual anchor -- need to specify -binary_output" );
553 Real suppress = (r - 1.0)/(
static_cast<Real>(rounds) * (3.0/4.0) - 1.0);
555 if ( suppress > 1.0 ) suppress = 1.0;
557 Real const rot_mag_init( 10.0 ), rot_mag_final( 0.2 );
558 Real const trans_mag_init( 5.0 ), trans_mag_final( 0.1 );
559 Real const rot_mag = rot_mag_init + (rot_mag_final - rot_mag_init ) * suppress;
560 Real const trans_mag = trans_mag_init + (trans_mag_final - trans_mag_init ) * suppress;
565 TR <<
" rot_mag: " << rot_mag <<
" trans_mag: " << trans_mag << std::endl;
575 static std::string const new_prefix(
"_LORES.out" );
577 std::string::size_type pos =
silent_file_.find(
".out", 0 );
578 if (pos == std::string::npos ){
579 utility_exit_with_message(
"If you want to output a lores silent file, better use .out suffix ==> " +
silent_file_ );
589 using namespace core::scoring;
592 TR <<
"All atom rmsd: " << rmsd <<
" for " << out_file_tag << std::endl;
595 Real rmsd_stems = 0.0;
598 if ( stem_residues.size() > 0 ) {
600 TR <<
"All atom rmsd over stems: " << rmsd_stems <<
" for " << out_file_tag << std::endl;
611 bool const score_only )
const
614 using namespace core::io::silent;
615 using namespace core::scoring;
619 TR <<
"ADD_NUMBER_BASE_PAIRS" << std::endl;
621 TR <<
"ADD_NUMBER_NATIVE_BASE_PAIRS" << std::endl;
629 TR <<
"Outputting to silent file: " << silent_file << std::endl;
641 bool const score_only )
const
644 using namespace core::io::silent;
645 using namespace core::scoring;
653 TR <<
"Making silent struct for " << out_file_tag << std::endl;
683 if ( allow_insert->get( n ) ) {
684 moving_res.push_back( n );
711 if ( superimpose_res.size() == 0 ){
712 for(
Size n = 1; n <= pose.
total_residue(); n++ ) superimpose_res.push_back( n );
718 std::cout <<
"Aligning pose to native." << std::endl;
740 TR <<
"Heating up... " << std::endl;
742 for (
Size i = 1; i <= heat_cycles; i++ ){
766 using namespace protocols::rigid;
767 using namespace protocols::rna;
768 using namespace kinematics;
771 Size const found_jumps = rigid_body_jumps.size();
772 if ( found_jumps <= 1 )
return;
777 for (
Size n = 2; n <= rigid_body_jumps.size(); n++ ) {
778 Size const i = rigid_body_jumps[ n ];
782 rigid_body_randomize_mover.
apply( pose );
787 Jump jump = pose.
jump( i );
791 Real const translation_magnitude( 20.0 );
793 rigid_body_perturb_mover.
apply( pose );
804 using namespace core::scoring;
816 Real const suppress = r /
static_cast<Real>( rounds );
826 Real suppress_chainbreak = ( r - (rounds/3.0) )/ ( static_cast<Real>(rounds) - (rounds/3.0) );
827 Real const suppress_chainbreak_min = 1 /
static_cast< Real >( rounds );
828 if ( suppress_chainbreak < suppress_chainbreak_min ) suppress_chainbreak = suppress_chainbreak_min;
842 Real const suppress = ( r )/(rounds - 4.0);
844 Size separation_cutoff =
static_cast< Size > ( suppress * max_dist ) + 2;
845 if ( separation_cutoff > max_dist ) separation_cutoff = max_dist;
847 return separation_cutoff;
856 using namespace core::scoring::constraints;
866 TR <<
"ROUND " << r <<
" out of " << rounds << std::endl;
867 TR <<
"FOLD_TREE CURRENT SEPARATION CUTOFF " << separation_cutoff <<
" out of " << shortest_path_in_fold_tree.max_dist() << std::endl;
871 for (
Size n = 1; n <= csts.size(); n++ ) {
875 if ( cst->natoms() == 2 ) {
876 Size const i = cst->atom( 1 ).rsd();
877 Size const j = cst->atom( 2 ).rsd();
878 Size const dist( shortest_path_in_fold_tree.dist( i , j ) );
879 if ( dist > separation_cutoff )
continue;
882 cst_set_new->add_constraint( cst );
887 TR <<
"NUM CONSTRAINTS " << pose.
constraint_set()->get_all_constraints().size() <<
" out of " <<
888 csts.size() << std::endl;
923 bool did_a_trial(
false );
940 bool success(
false );
951 move_type =
"rigid_body";
954 move_type =
"jump_change";
957 if (!success)
return;
993 if ( !did_an_insertion )
return false;
1015 using namespace scoring::rna;
1016 using namespace conformation;
1030 Size N_WC( 0 ), N_NWC( 0 );
1034 for (
Size n = 1; n <= base_pair_list.size(); n++ ) {
1036 Base_pair
const base_pair = base_pair_list[ n ];
1038 Size const i = base_pair.res1;
1039 Size const j = base_pair.res2;
1041 Size const k = base_pair.edge1;
1042 Size const m = base_pair.edge2;
1048 && base_pair.orientation == 1 ) &&
1070 using namespace scoring::rna;
1074 for (
Size n = 1; n <= base_pair_list.size(); n++ ) {
1076 Base_pair
const base_pair2 = base_pair_list[ n ];
1078 if ( ( base_pair.
res1 == base_pair2.res1 && base_pair.
res2 == base_pair2.res2 ) &&
1079 ( base_pair.
edge1 == base_pair2.edge1 && base_pair.
edge2 == base_pair2.edge2 ) &&
1080 base_pair.
orientation == base_pair2.orientation ) {
1085 if ( ( base_pair.
res2 == base_pair2.res1 && base_pair.
res1 == base_pair2.res2 ) &&
1086 ( base_pair.
edge2 == base_pair2.edge1 && base_pair.
edge1 == base_pair2.edge2 ) &&
1087 base_pair.
orientation == base_pair2.orientation ) {
1104 using namespace scoring::rna;
1105 using namespace conformation;
1131 Size N_WC_NATIVE( 0 ), N_NWC_NATIVE( 0 );
1132 Size N_WC( 0 ), N_NWC( 0 );
1135 for (
Size n = 1; n <= base_pair_list_native.size(); n++ ) {
1169 Real f_natWC( 0.0 ), f_natNWC( 0.0 ), f_natBP( 0.0 );
1170 if (N_WC_NATIVE > 0 ) f_natWC = ( N_WC / (1.0 * N_WC_NATIVE) );
1171 if (N_NWC_NATIVE > 0 ) f_natNWC = ( N_NWC / (1.0 * N_NWC_NATIVE) );
1172 if ( (N_WC_NATIVE + N_NWC_NATIVE) > 0 ) f_natBP = ( (N_WC+N_NWC) / (1.0 * (N_WC_NATIVE + N_NWC_NATIVE) ));
1190 all_lores_score.push_back( lores_score );
1192 all_lores_score.sort();
1195 Size const n = all_lores_score.size();
1199 Real all_lores_score_cutoff = all_lores_score.front();
1201 for ( std::list< Real >::const_iterator iter = all_lores_score.begin(); iter != all_lores_score.end(); iter++, i++ ){
1202 if ( i == cutoff_index ) all_lores_score_cutoff = *iter;
1205 TR <<
"Comparing current lores score " << lores_score <<
" to automatically determined cutoff: " << all_lores_score_cutoff <<
" based on " <<
autofilter_score_quantile_ <<
" quantile from " << n <<
" models so far" << std::endl;
1206 return ( lores_score <= all_lores_score_cutoff );
1213 using namespace core::scoring;
1214 using namespace core::io::pdb;
1229 (*chem_shift_scorefxn_)( pose );
1239 using namespace core::scoring;
1240 using namespace core::pose;
1243 utility_exit_with_message(
"use_chem_shift_data_ == false!");
1252 (*temp_scorefxn)(chem_shift_pose);
1254 EnergyMap const & energy_map=chem_shift_pose.energies().total_energies();
1261 get_instance()->get_RNA_ChemicalShiftPotential() );
1267 Real const chem_shift_RMSD=sqrt( rosetta_chem_shift_score /
1268 float(num_chem_shift_data_points) );
1270 silent_struct.
add_energy(
"chem_shift_RMSD", chem_shift_RMSD);
1272 silent_struct.
add_energy(
"num_chem_shift_data",
1273 float(num_chem_shift_data_points) );
1275 if(silent_struct.
has_energy(
"rna_chem_shift")==
false){
1278 silent_struct.
add_energy(
"rna_chem_shift", 0.0);