49 #include <basic/Tracer.hh>
77 #include <numeric/NumericTraits.hh>
79 #include <ObjexxFCL/format.hh>
80 #include <ObjexxFCL/string.functions.hh>
82 #include <utility/exit.hh>
104 static basic::Tracer
TR(
"protocols.swa.rna.stepwise_rna_residue_sampler" ) ;
106 namespace protocols {
113 job_parameters_( job_parameters ),
116 silent_file_(
"silent_file.txt" ),
117 output_filename_(
"data.txt"),
120 num_pose_kept_( 108 ),
122 cluster_rmsd_(0.5001),
124 native_rmsd_screen_(false),
125 native_screen_rmsd_cutoff_(2.0),
126 perform_o2star_pack_( true ),
127 use_green_packer_( false ),
128 allow_bulge_at_chainbreak_( false ),
130 medium_fast_( false ),
131 integration_test_mode_( false ),
132 floating_base_( false ),
133 centroid_screen_(true),
134 allow_base_pair_only_centroid_screen_(false),
135 VDW_atr_rep_screen_(true),
136 include_syn_chi_(false),
137 allow_syn_pyrimidine_(false),
138 distinguish_pucker_(true),
139 build_pose_from_scratch_(false),
140 current_score_cutoff_(999999.9),
142 finer_sampling_at_chain_closure_(false),
143 PBP_clustering_at_chain_closure_(false),
144 reinitialize_CCD_torsions_(false),
145 extra_epsilon_rotamer_(false),
146 extra_beta_rotamer_(false),
147 extra_anti_chi_rotamer_(false),
148 extra_syn_chi_rotamer_(false),
149 sample_both_sugar_base_rotamer_(false),
150 include_torsion_value_in_tag_(false),
151 rebuild_bulge_mode_(false),
152 debug_eplison_south_sugar_mode_(false),
153 exclude_alpha_beta_gamma_sampling_(false),
154 combine_long_loop_mode_(false),
155 do_not_sample_multiple_virtual_sugar_(false),
156 sample_ONLY_multiple_virtual_sugar_(false),
157 assert_no_virt_ribose_sampling_(false),
167 std::map< core::Size, bool >
const & Is_prepend_map =
job_parameters_->Is_prepend_map();
184 return "StepWiseRNA_ResidueSampler";
191 return (pose_data_1.
score < pose_data_2.
score);
199 using namespace ObjexxFCL;
203 clock_t
const time_start( clock() );
206 std::cout <<
"--------SCREEN OPTIONS---------- "<< std::endl;
222 std::cout <<
"--------------------------------" << std::endl;
225 Pose const pose_save = pose;
243 Output_boolean(
" Is_five_prime_chain_break_sugar_virt=", Is_five_prime_CB_sugar_virt );
Output_boolean(
" Is_three_prime_chain_break_sugar_virt=", Is_three_prime_CB_sugar_virt );
244 std::cout << std::endl;
248 Size num_virtual_sugar=0;
249 if(Is_prev_sugar_virt==
true) num_virtual_sugar++;
250 if(Is_curr_sugar_virt==
true) num_virtual_sugar++;
251 if(Is_five_prime_CB_sugar_virt==
true) num_virtual_sugar++;
252 if(Is_three_prime_CB_sugar_virt==
true) num_virtual_sugar++;
254 std::cout <<
"num_virtual_sugar= " << num_virtual_sugar << std::endl;
258 if(num_virtual_sugar>1) utility_exit_with_message(
"assert_no_virt_ribose_sampling_==true and floating_base, but num_virtual_sugar>1");
259 if(num_virtual_sugar==1){
260 if(Is_prev_sugar_virt==
false) {
261 utility_exit_with_message(
"assert_no_virt_ribose_sampling_==true and floating_base and num_virtual_sugar==1 BUT Is_prev_sugar_virt==false!)");
265 if(num_virtual_sugar!=0) utility_exit_with_message(
"assert_no_virt_ribose_sampling_==true but num_virtual_sugar!=0");
269 if(Is_curr_sugar_virt){
271 if(gap_size!=0) utility_exit_with_message(
"Is_curr_sugar_virt==true but gap_size!=0 !!");
273 if(working_moving_partition_pos.size()<=1) utility_exit_with_message(
"Is_curr_sugar_virt==true but working_moving_partition_pos.size()<=1");
275 if(gap_size!=0 && num_virtual_sugar>1) utility_exit_with_message(
"gap_size!=0 but num_virtual_sugar>1" );
278 if(Is_five_prime_CB_sugar_virt){
279 std::cout <<
"WARNING: floating_base_ and Is_five_prime_CB_sugar_virt case. Code not implemented yet, early return!" << std::endl;
283 if(Is_three_prime_CB_sugar_virt){
284 std::cout <<
"WARNING: floating_base_ and Is_three_prime_CB_sugar_virt case. Code not implemented yet, early return!" << std::endl;
288 if(Is_curr_sugar_virt){
289 utility_exit_with_message(
"floating_base_ and Is_curr_sugar_virt case. Code not implemented yet!");
294 utility_exit_with_message(
"do_not_sample_multiple_virtual_sugar_==true && sample_ONLY_multiple_virtual_sugar_==true" );
298 if(num_virtual_sugar>1)
return;
302 if(gap_size!=0) utility_exit_with_message(
"sample_ONLY_multiple_virtual_sugar_==true but gap_size!=0" );
303 if(num_virtual_sugar<=1)
return;
311 Size const three_prime_chain_break_res = five_prime_chain_break_res+1;
321 if(Is_prev_sugar_virt){
322 std::cout <<
"previous_sugar floating_base_chain_closure" << std::endl;
324 Size const prev_moving_res = (Is_prepend) ? (moving_res+num_nucleotides) : (moving_res-num_nucleotides);
325 Size const prev_ref_res = (Is_prepend) ? (moving_res+(num_nucleotides+2)) : (moving_res-(num_nucleotides+2));
331 if(prev_sugar_FB_JP.PDL.size()==0){
332 std::cout <<
"Is_prev_sugar_virt==True but prev_sugar_FB_JP.PDL.size()==0!" << std::endl;
337 if(Is_curr_sugar_virt){
338 std::cout <<
"current_sugar floating_base_chain_closure" << std::endl;
340 Size const curr_ref_res = (Is_prepend) ? (moving_res-2) : (moving_res+2);
346 if(curr_sugar_FB_JP.PDL.size()==0){
347 std::cout <<
"Is_curr_sugar_virt==True but curr_sugar_FB_JP.PDL.size()==0!" << std::endl;
352 if(Is_five_prime_CB_sugar_virt){
353 std::cout <<
"five_prime_CB_sugar floating_base_chain_closure" << std::endl;
356 five_prime_CB_sugar_FB_JP.set_base_and_pucker_state(pose,
job_parameters_);
359 if(five_prime_CB_sugar_FB_JP.PDL.size()==0) {
360 std::cout <<
"Is_five_prime_CB_sugar_virt==True but five_prime_CB_sugar_FB_JP.PDL.size()==0!" << std::endl;
365 if(Is_three_prime_CB_sugar_virt){
366 std::cout <<
"three_prime_CB_sugar floating_base_chain_closure:" << std::endl;
369 three_prime_CB_sugar_FB_JP.set_base_and_pucker_state(pose,
job_parameters_);
372 if(three_prime_CB_sugar_FB_JP.PDL.size()==0){
373 std::cout <<
"Is_three_prime_CB_sugar_virt==True but three_prime_CB_sugar_FB_JP.PDL.size()==0!" << std::endl;
378 if( num_virtual_sugar>0 ){
379 std::cout <<
"Contain_virtual_sugar==true" << std::endl;
381 std::cout <<
"Contain_virtual_sugar==false" << std::endl;
385 std::sort(prev_sugar_FB_JP.PDL.begin(), prev_sugar_FB_JP.PDL.end(),
sort_criteria);
386 std::sort(curr_sugar_FB_JP.PDL.begin(), curr_sugar_FB_JP.PDL.end(),
sort_criteria);
387 std::sort(five_prime_CB_sugar_FB_JP.PDL.begin(), five_prime_CB_sugar_FB_JP.PDL.end(),
sort_criteria);
388 std::sort(three_prime_CB_sugar_FB_JP.PDL.begin(), three_prime_CB_sugar_FB_JP.PDL.end(),
sort_criteria);
397 standard_sampling_WRAPPER(pose, prev_sugar_FB_JP, curr_sugar_FB_JP, five_prime_CB_sugar_FB_JP, three_prime_CB_sugar_FB_JP);
407 utility_exit_with_message(
"working_moving_res: " + string_of(
job_parameters_->working_moving_res()) +
" of pose " +string_of(n) +
" is a virtual res!" );
412 std::cout <<
"Total time in StepWiseRNA_ResidueSampler::apply " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
424 using namespace core::chemical;
425 using namespace core::conformation;
426 using namespace core::scoring;
427 using namespace core::pose;
428 using namespace core::io::silent;
429 using namespace core::id;
430 using namespace core::kinematics;
432 clock_t
const time_start( clock() );
436 const Real RADS_PER_DEG = numeric::NumericTraits<Real>::pi() / 180.;
448 Size const floating_base_five_prime_chain_break= (Is_prepend) ? moving_res : moving_res - 1;
450 if(
combine_long_loop_mode_) utility_exit_with_message(
"combine_long_loop_mode_ have not been implement for floating base sampling yet!!" );
453 bool const Is_dinucleotide=(num_nucleotides==2);
455 std::cout <<
" NUM_NUCLEOTIDES= " << num_nucleotides << std::endl;
456 Output_boolean(
" IS_DINUCLEOTIDE= ", Is_dinucleotide); std::cout << std::endl;
457 std::cout <<
" GAP SIZE " << gap_size << std::endl;
458 std::cout <<
" MOVING RES " << moving_res << std::endl;
459 std::cout <<
" MOVING SUITE " << moving_suite << std::endl;
461 Output_boolean(
" INTERNAL ", Is_internal); std::cout << std::endl;
462 std::cout <<
" REFERENCE_RES " << reference_res << std::endl;
463 std::cout <<
" FLOATING_BASE_FIVE_PRIME_CHAIN_BREAK " << floating_base_five_prime_chain_break << std::endl;
466 if(Is_dinucleotide==
true && Is_internal==
true) utility_exit_with_message(
"Is_dinucleotide==true && Is_internal==true)!!" );
467 if(num_nucleotides!=1 && num_nucleotides!=2) utility_exit_with_message(
"num_nucleotides!=1 and num_nucleotides!=2" );
475 std::cout <<
"allow_base_pair_only_centroid_screen_==true for floating base + dinucleotide sampling mode " << std::endl;
476 std::cout <<
"Increase num_pose_kept by 4 folds" << std::endl;
478 std::cout <<
" user_input_num_pose_kept= " << user_input_num_pose_kept <<
" num_pose_kept_ " <<
num_pose_kept_ << std::endl;
491 Real base_rep_score(-999999), base_atr_score(-999999);
496 if( num_nucleotides == 1){
500 std::cout <<
"setup_chain_break_jump_point for floating_base_five_prime_chain_break= " << floating_base_five_prime_chain_break << std::endl;
518 print_atom_info(pose, moving_res,
"pose setup_residue_at_origin_list");
534 print_atom_info(ribose_screening_pose, moving_res,
"ribose_screening_pose");
537 if ( gap_size == 0 ) {
541 if(moving_res==(five_prime_chain_break_res+1)){
546 utility_exit_with_message(
"pose have VIRTUAL_PHOSPHATE AT five_prime_chain_break_res+1!");
549 std::cout <<
"Adding harmonic chainbreak to standard job_params five_prime_chain_break_res= " << five_prime_chain_break_res << std::endl;
554 if( num_nucleotides == 1){
558 if(moving_res==(floating_base_five_prime_chain_break+1)){
563 utility_exit_with_message(
"pose have VIRTUAL_PHOSPHATE AT floating_base_five_prime_chain_break+1!");
566 std::cout <<
"Adding harmonic chainbreak to floating_base_five_prime_chain_break= " << floating_base_five_prime_chain_break << std::endl;
575 pose::Pose pose_with_original_HO2star_torsion;
578 pose_with_original_HO2star_torsion=pose;
580 if (
use_green_packer_ ) utility_exit_with_message(
"green packer mode have not been tested for floating base sampling!" );
588 if( seq_num == moving_res )
continue;
595 o2star_pack_pose=pose;
601 print_atom_info(pose, moving_res,
"pose after remove o2star variant type");
618 std::cout <<
"Change to Residue const & screening_moving_rsd_at_origin=(*screening_moving_rsd_at_origin_list[5]) " << std::endl;
619 Residue const & screening_moving_rsd_at_origin=(*screening_moving_rsd_at_origin_list[5]);
627 if(moving_rsd_at_origin_list.size()!=screening_moving_rsd_at_origin_list.size()){
628 std::cout <<
"moving_rsd_at_origin_list.size()= " << moving_rsd_at_origin_list.size() << std::endl;
629 std::cout <<
"screening_moving_rsd_at_origin_list.size()= " << screening_moving_rsd_at_origin_list.size() << std::endl;
630 utility_exit_with_message(
"moving_rsd_at_origin_list.size()!=screening_moving_rsd_at_origin_list.size()");
633 if(moving_rsd_at_origin_list.size()!=ribose_screening_moving_rsd_at_origin_list.size()){
634 std::cout <<
"moving_rsd_at_origin_list.size()= " << moving_rsd_at_origin_list.size() << std::endl;
635 std::cout <<
"ribose_screening_moving_rsd_at_origin_list.size()= " << ribose_screening_moving_rsd_at_origin_list.size() << std::endl;
636 utility_exit_with_message(
"moving_rsd_at_origin_list.size()!=ribose_screening_moving_rsd_at_origin_list.size()");
656 Real const max_distance=Max_O3_to_C5_DIST+C5_centroid_dist+O5_centroid_dist+1;
658 std::cout <<
"max centroid to centroid distance: " << max_distance << std::endl;;
663 std::cout <<
"euler_angle_bin min= " << euler_angle_bin_min <<
" max " << euler_angle_bin_max << std::endl;
664 std::cout <<
"euler_z_bin_min min= " << euler_z_bin_min <<
" max " << euler_z_bin_max << std::endl;
665 std::cout <<
"centroid_bin min= " << centroid_bin_min<<
" max " << centroid_bin_max << std::endl;
667 std::map<Base_bin , int , compare_base_bin> base_bin_map;
668 std::map<Base_bin , int , compare_base_bin>::const_iterator it;
679 std::cout <<
"Residue.aa() " << seq_num <<
" is core::chemical::aa_vrt!" << std::endl;
685 std::cout <<
"Residue " << seq_num <<
" is a VIRTUAL_RNA_RESIDUE!" << std::endl;
689 if(seq_num==moving_res){
690 std::cout <<
"Residue " << seq_num <<
" is a MOVING RESIDUE!" << std::endl;
695 std::cout <<
"Residue " << seq_num <<
" is a TERMINAL_RESIDUE!" << std::endl;
711 std::cout <<
"distance= " <<
distance;
713 if( distance > (max_distance+6.364)) {
714 std::cout <<
" Residue " << seq_num <<
" is too far from the reference res: " << reference_res << std::endl;
718 std::cout <<
" Add to other_residues_base_list: " << seq_num << std::endl;
720 other_residues_base_list.push_back(base_info);
732 Size total_screen_bin(0);
734 Real delta_rep_score( 0.0), delta_atr_score( 0.0 );
741 for(base_bin.euler_alpha=euler_angle_bin_min; base_bin.euler_alpha<=euler_angle_bin_max; base_bin.euler_alpha++){
742 for(base_bin.euler_z=euler_z_bin_min; base_bin.euler_z<=euler_z_bin_max; base_bin.euler_z++){
752 euler_angles.beta=acos(euler_angles.z);
753 euler_angles.gamma=0;
758 moving_res_base_stub.M= reference_stub.M * O_frame_rotation;
761 for(base_bin.centroid_z=centroid_bin_min; base_bin.centroid_z<=centroid_bin_max; base_bin.centroid_z++){
762 for(base_bin.centroid_x=centroid_bin_min; base_bin.centroid_x<=centroid_bin_max; base_bin.centroid_x++){
763 for(base_bin.centroid_y=centroid_bin_min; base_bin.centroid_y<=centroid_bin_max; base_bin.centroid_y++){
769 moving_res_base_stub.v= (reference_stub.M * O_frame_centroid) + reference_stub.v;
773 if((moving_res_base_stub.v - reference_stub.v).length_squared()>max_distance*max_distance)
continue;
783 for(base_bin.euler_gamma=euler_angle_bin_min; base_bin.euler_gamma<=euler_angle_bin_max; base_bin.euler_gamma++){
792 moving_res_base_stub.M= reference_stub.M * O_frame_rotation;
800 if(
check_floating_base_chain_closable(reference_res, ribose_screening_pose, moving_rsd_at_origin_list, moving_res_base_stub, Is_prepend, (num_nucleotides - 1) )==
false)
continue;
805 Size const chain_break_reference_res= (Is_prepend) ? five_prime_chain_break_res : five_prime_chain_break_res+1;
806 if(
check_floating_base_chain_closable(chain_break_reference_res, ribose_screening_pose, moving_rsd_at_origin_list, moving_res_base_stub, !Is_prepend, 0 )==
false)
continue;
821 if( VDW_bin_screener->VDW_rep_screen(screening_pose, moving_res, screening_moving_rsd_at_origin, moving_res_base_stub )==
false)
continue;
828 if(
user_input_VDW_bin_screener_->VDW_rep_screen(screening_pose, moving_res, screening_moving_rsd_at_origin, moving_res_base_stub)==
false)
continue;
852 for(
Size n=1; n<=moving_rsd_at_origin_list.size(); n++){
856 set_base_coordinate_frame(ribose_screening_pose, moving_res, (*ribose_screening_moving_rsd_at_origin_list[n]), moving_res_base_stub);
861 std::string const moving_atom_name= (Is_prepend) ?
"O3*" :
" C5*";
862 std::string const reference_atom_name= (Is_prepend) ?
" C5*" :
"O3*";
864 if(gap_size == 0)
if(
Check_chain_closable(ribose_screening_pose, five_prime_chain_break_res, 0 )==false )
continue;
868 bool pass_for_loop_screen_1=
false;
870 for(
Size prev_sugar_ID=1; prev_sugar_ID<=prev_sugar_FB_JP.
PDL.size(); prev_sugar_ID++){
872 (*prev_sugar_FB_JP.
PDL[prev_sugar_ID].pose_OP).residue(reference_res).xyz(reference_atom_name), (num_nucleotides - 1) ))
continue;
873 pass_for_loop_screen_1=
true;
877 if(pass_for_loop_screen_1==
false)
continue;
882 bool pass_for_loop_screen_2=
false;
885 for(
Size prev_sugar_ID=1; prev_sugar_ID<=prev_sugar_FB_JP.
PDL.size(); prev_sugar_ID++){
889 (*prev_sugar_FB_JP.
PDL[prev_sugar_ID].pose_OP).residue(reference_res).xyz(reference_atom_name), (num_nucleotides - 1) ))
continue;
906 tag += prev_sugar_FB_JP.
PDL[prev_sugar_ID].tag;
907 pass_for_loop_screen_2=
true;
911 if(pass_for_loop_screen_2==
false)
continue;
915 if(!
Check_chain_closable(ribose_screening_pose.residue(moving_res).xyz(moving_atom_name), ribose_screening_pose.residue(reference_res).xyz(reference_atom_name), (num_nucleotides - 1) ))
continue;
936 if(num_nucleotides==1){
940 Copy_CCD_torsions_general(pose, CB_screening_pose, floating_base_five_prime_chain_break, floating_base_five_prime_chain_break+1);
954 std::cout << tag << std::endl;
958 if(gap_size!=0 && (num_nucleotides!=1) )
break;
964 it=base_bin_map.find(base_bin);
966 if(it==base_bin_map.end()){
967 base_bin_map[base_bin]=1;
970 base_bin_map[base_bin]=base_bin_map[base_bin]+1;
981 Output_title_text(
"Final sort and clustering: BEFORE floating base_chain_closure");
983 std::sort(pose_data_list.begin(), pose_data_list.end(),
sort_criteria);
986 std::cout<<
"after erasing.. pose_data_list= " << pose_data_list.size() << std::endl;
988 std::cout <<
"floating base sampling time : " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
1000 std::cout <<
" WARNING centroid_n count is severely UNDERSTIMATED...need to be multiply by (euler_angle_bin_max-euler_angle_bin_min+1): ";
1001 std::cout << (euler_angle_bin_max-euler_angle_bin_min+1) << std::endl;
1005 int dummy_return_code;
1006 dummy_return_code = system(
std::string(
"rm -r " + foldername).c_str());
1007 dummy_return_code = system(
std::string(
"mkdir -p " + foldername).c_str());
1024 using namespace ObjexxFCL;
1025 using namespace core::io::silent;
1026 using namespace core::id;
1027 using namespace core::scoring;
1041 if(prev_sugar_FB_JP.
PDL.size()==0 && curr_sugar_FB_JP.
PDL.size()==0 && five_prime_CB_sugar_FB_JP.
PDL.size()==0 && three_prime_CB_sugar_FB_JP.
PDL.size()==0){
1042 utility_exit_with_message(
"pose_data_list is empty for all 4 possible virtual sugar!");
1049 for(
Size prev_sugar_ID=1; prev_sugar_ID<=prev_sugar_FB_JP.
PDL.size() || prev_sugar_ID==1; prev_sugar_ID++){
1050 for(
Size curr_sugar_ID=1; curr_sugar_ID<=curr_sugar_FB_JP.
PDL.size() || curr_sugar_ID==1; curr_sugar_ID++){
1051 for(
Size five_prime_CB_sugar_ID=1; five_prime_CB_sugar_ID<=five_prime_CB_sugar_FB_JP.
PDL.size() || five_prime_CB_sugar_ID==1; five_prime_CB_sugar_ID++){
1052 for(
Size three_prime_CB_sugar_ID=1; three_prime_CB_sugar_ID<=three_prime_CB_sugar_FB_JP.
PDL.size() || three_prime_CB_sugar_ID==1; three_prime_CB_sugar_ID++){
1059 (*start_pose_data.
pose_OP)=pose_copy;
1062 start_pose_data.
score=0;
1063 start_pose_data.
tag=
"";
1065 if(prev_sugar_FB_JP.
PDL.size()>0) {
1066 start_pose_data.
tag+= prev_sugar_FB_JP.
PDL[prev_sugar_ID].tag;
1069 start_pose_data.
tag+=
"_null";
1072 if(curr_sugar_FB_JP.
PDL.size()>0) {
1073 start_pose_data.
tag+= curr_sugar_FB_JP.
PDL[curr_sugar_ID].tag;
1076 start_pose_data.
tag+=
"_null";
1079 if(five_prime_CB_sugar_FB_JP.
PDL.size()>0){
1080 start_pose_data.
tag+= five_prime_CB_sugar_FB_JP.
PDL[five_prime_CB_sugar_ID].tag;
1083 start_pose_data.
tag+=
"_null";
1086 if(three_prime_CB_sugar_FB_JP.
PDL.size()>0){
1087 start_pose_data.
tag+= three_prime_CB_sugar_FB_JP.
PDL[three_prime_CB_sugar_ID].tag;
1090 start_pose_data.
tag+=
"_null";
1093 starting_pose_data_list.push_back(start_pose_data);
1100 if(prev_sugar_FB_JP.
PDL.size()>0) sampled_sugar_FB_JP_list.push_back(prev_sugar_FB_JP);
1101 if(curr_sugar_FB_JP.
PDL.size()>0) sampled_sugar_FB_JP_list.push_back(curr_sugar_FB_JP);
1102 if(five_prime_CB_sugar_FB_JP.
PDL.size()>0 ) sampled_sugar_FB_JP_list.push_back(five_prime_CB_sugar_FB_JP);
1103 if(three_prime_CB_sugar_FB_JP.
PDL.size()>0) sampled_sugar_FB_JP_list.push_back(three_prime_CB_sugar_FB_JP);
1109 std::cout <<
"starting_pose_data_list.size()= " << starting_pose_data_list.size() << std::endl;
1113 for(
Size n=1; n<=starting_pose_data_list.size(); n++){
1114 pose=(*starting_pose_data_list[n].pose_OP);
1119 std::string starting_pose_tag=
"starting_pose" + starting_pose_data_list[n].tag;
1125 for(
Size ii=1; ii<=working_moving_partition_pos.size(); ii++){
1132 (*sampling_scorefxn_)(debug_pose);
1153 using namespace core::scoring;
1154 using namespace core::pose;
1155 using namespace core::io::silent;
1156 using namespace protocols::rna;
1157 using namespace core::id;
1161 clock_t
const time_start( clock() );
1180 if(num_nucleotides!=1 && num_nucleotides!=2){
1181 utility_exit_with_message(
"num_nucleotides!=1 and num_nucleotides!=2" );
1184 bool const Is_dinucleotide=(num_nucleotides==2);
1193 std::cout <<
"allow_base_pair_only_centroid_screen_==true + dinucleotide sampling" << std::endl;
1194 std::cout <<
"Note that allow_base_pair_only_centroid_screen_ doesn't effect the screening in standard sampling mode." <<std::endl;
1195 std::cout <<
"Just keeping more pose to be consistent with floating base mode + keep high score basepairing conformations." << std::endl;
1196 std::cout <<
"Increase num_pose_kept by 4 folds" << std::endl;
1198 std::cout <<
" user_input_num_pose_kept= " << user_input_num_pose_kept <<
" num_pose_kept_ " <<
num_pose_kept_ << std::endl;
1203 std::cout <<
"Since build_pose_from_scratch, choose to increase NUM_POSE_KEPT by 36 fold. ";
1204 std::cout <<
" Somewhat hacky..since sample both sugar..want to make sure that we keep are good energy score states " << std::endl;
1205 std::cout <<
"Old_num_pose_kept_ = " <<
num_pose_kept_ << std::endl;
1207 std::cout <<
"New_num_pose_kept_ = " <<
num_pose_kept_ << std::endl;
1211 std::cout <<
"Since build_pose_from_scratch, choose to increase NUM_POSE_KEPT by 12 fold. ";
1212 std::cout <<
" Somewhat hacky..since sample both sugar..want to make sure that we keep are good energy score states " << std::endl;
1213 std::cout <<
"Old_num_pose_kept_ = " <<
num_pose_kept_ << std::endl;
1215 std::cout <<
"New_num_pose_kept_ = " <<
num_pose_kept_ << std::endl;
1219 std::cout <<
" NUM_NUCLEOTIDES= " << num_nucleotides << std::endl;
1220 Output_boolean(
" IS_DINUCLEOTIDE= ", Is_dinucleotide); std::cout << std::endl;
1221 std::cout <<
" GAP SIZE " << gap_size << std::endl;
1222 std::cout <<
" MOVING RES " << moving_res << std::endl;
1223 std::cout <<
" MOVING SUITE " << moving_suite << std::endl;
1224 Output_boolean(
" PREPEND ", Is_prepend ); std::cout << std::endl;
1225 Output_boolean(
" INTERNAL ", Is_internal); std::cout << std::endl;
1230 Size const last_append_res=(Is_prepend) ? moving_res-1: moving_res;
1231 Size const last_prepend_res=(Is_prepend) ? moving_res: moving_res+1;
1232 Real const atom_atom_overlap_dist_cutoff=-1.0;
1235 std::cout <<
"combine_long_loop_mode_ && gap_size==0" << std::endl;
1236 std::cout <<
"Enforcing contact between LAST_APPEND_RES: " << last_append_res <<
" and LAST_PREPEND_RES: " << last_prepend_res << std::endl;
1237 std::cout <<
"atom_atom_overlap_dist_cutoff " << atom_atom_overlap_dist_cutoff << std::endl;
1244 Pose pose_with_virtual_O2star_hydrogen = pose;
1253 pose::Pose pose_with_original_HO2star_torsion;
1256 pose_with_original_HO2star_torsion=pose;
1257 o2star_pack_pose=pose;
1265 pose = pose_with_virtual_O2star_hydrogen;
1269 Real base_rep_score(-999999), base_atr_score(-999999);
1275 pose::Pose screening_pose = pose_with_virtual_O2star_hydrogen;
1283 pose::Pose chain_break_screening_pose = pose_with_virtual_O2star_hydrogen;
1285 if ( gap_size == 0 ) {
1286 std::cout <<
"five_prime_chain_break_res= " << five_prime_chain_break_res << std::endl;
1295 bool sample_sugar_and_base1(
false ), sample_sugar_and_base2(
false );
1296 if ( !Is_internal ) {
1298 sample_sugar_and_base1 =
true;
1300 sample_sugar_and_base2 =
true;
1305 sample_sugar_and_base1 =
true;
1306 sample_sugar_and_base2 =
true;
1310 if(Is_dinucleotide==
true){
1311 utility_exit_with_message(
"sample_both_sugar_base_rotamer_==true and Is_dinucleotide==true!" );
1313 sample_sugar_and_base1 =
true;
1314 sample_sugar_and_base2 =
true;
1319 utility_exit_with_message(
"Add VIRTUAL_RNA_RESIDUE_EXCLUDE_PHOSPHATE back to patches.txt before using this option!");
1320 sample_sugar_and_base1 =
true;
1321 sample_sugar_and_base2 =
false;
1330 working_moving_suite_list,
1331 sample_sugar_and_base1,
1332 sample_sugar_and_base2);
1333 rotamer_generator->set_fast(
fast_ );
1335 rotamer_generator->set_force_syn_chi_res_list(
job_parameters_->working_force_syn_chi_res_list());
1336 rotamer_generator->set_force_north_ribose_list(
job_parameters_->working_force_north_ribose_list());
1337 rotamer_generator->set_force_south_ribose_list(
job_parameters_->working_force_south_ribose_list());
1346 rotamer_generator->initialize_rotamer_generator_list();
1353 Real current_score( 0.0 ), delta_rep_score( 0.0), delta_atr_score( 0.0 );
1355 while( rotamer_generator->has_another_rotamer() ){
1381 if(
Is_residues_in_contact(last_append_res, screening_pose, last_prepend_res, screening_pose, atom_atom_overlap_dist_cutoff, 1 )==
false){
1390 bool is_possible_bulge=
false;
1398 bool found_a_centroid_interaction_partner(
false );
1402 if( !found_a_centroid_interaction_partner){
1403 if(working_moving_partition_pos.size() == 1) is_possible_bulge=
true;
1407 if(num_nucleotides>1 && is_possible_bulge==
true) utility_exit_with_message(
"num_nucleotides>1 but is_possible_bulge==true!" );
1409 if ( gap_size > 0 && !found_a_centroid_interaction_partner )
continue;
1423 if ( gap_size <= 1 ){
1460 bool bulge_added(
false);
1461 if ( gap_size == 0 ){
1464 apply_rotamer(chain_break_screening_pose, current_rotamer );
1471 if(is_possible_bulge){
1492 std::cout << tag << std::endl;
1505 std::sort(pose_data_list.begin(), pose_data_list.end(),
sort_criteria);
1508 std::cout<<
"after erasing.. pose_data_list= " << pose_data_list.size() << std::endl;
1515 for(
Size n=1; n<=pose_data_list.size(); n++){
1516 pose::Pose & current_pose=(*pose_data_list[n].pose_OP);
1519 align_poses(current_pose, tag, native_pose,
"native", working_best_alignment);
1524 std::cout <<
"FINAL COUNTS" << std::endl;
1526 if( gap_size == 0 ){
1539 std::cout <<
"Total time in StepWiseRNA_ResidueSampler: " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
1562 std::cout <<
"-----------------------get reference stub-----------------------" << std::endl;
1563 if(reference_stub_type==
"ribose"){
1570 std::cout <<
" reference_stub.v: x= " << reference_stub.
v[0] <<
" y= " << reference_stub.
v[1] <<
" z= " << reference_stub.
v[2] << std::endl;
1571 std::cout <<
"---------------------------------------------------------------------" << std::endl;
1573 return reference_stub;
1585 Size const previous_moving_res = (Is_prepend) ? (moving_res+num_nucleotides) : (moving_res-num_nucleotides);
1586 Size const previous_bulge_res = (Is_prepend) ? (moving_res+(num_nucleotides+1)) : (moving_res-(num_nucleotides+1));
1599 Size const virtual_ribose_res = moving_res;
1600 Size const bulge_res = (Is_prepend) ? (moving_res-1) : (moving_res+1);
1614 if(gap_size!=0)
return false;
1618 Size const five_prime_CB_bulge_res = (five_prime_chain_break_res-1);
1620 bool sugar_is_virtual=
Is_ribose_virtual( pose, five_prime_chain_break_res, five_prime_CB_bulge_res);
1624 if(sugar_is_virtual){
1626 if(five_prime_chain_break_res==moving_res){
1627 utility_exit_with_message(
"five_prime_chain_break_res==moving_res=" + ObjexxFCL::string_of(moving_res) );
1632 Size const previous_moving_res = (Is_prepend) ? (moving_res+num_nucleotides) : (moving_res-num_nucleotides);
1634 if(five_prime_chain_break_res==previous_moving_res){
1635 utility_exit_with_message(
"five_prime_chain_break_res==previous_moving_res=" + ObjexxFCL::string_of(previous_moving_res) );
1654 if(gap_size!=0)
return false;
1658 Size const three_prime_CB_bulge_res = (three_prime_chain_break_res+1);
1660 bool sugar_is_virtual=
Is_ribose_virtual( pose, three_prime_chain_break_res, three_prime_CB_bulge_res);
1664 if(sugar_is_virtual){
1666 if(three_prime_chain_break_res==moving_res){
1667 utility_exit_with_message(
"three_prime_chain_break_res==moving_res=" + ObjexxFCL::string_of(three_prime_chain_break_res) );
1672 Size const previous_moving_res = (Is_prepend) ? (moving_res+num_nucleotides) : (moving_res-num_nucleotides);
1674 if(three_prime_chain_break_res==previous_moving_res){
1675 utility_exit_with_message(
"three_prime_chain_break_res==previous_moving_res=" + ObjexxFCL::string_of(previous_moving_res) );
1692 using namespace core::conformation;
1693 using namespace core::scoring;
1694 using namespace core::pose;
1695 using namespace ObjexxFCL;
1714 if((working_moving_res+1)<=nres){
1719 Size const extra_sample_sugar_base_res= (Is_prepend) ? (working_moving_res+1) : (working_moving_res-1);
1720 if(
verbose_) std::cout <<
"extra_sample_sugar_base_res= " << extra_sample_sugar_base_res << std::endl;
1730 base_pose_screen.set_jump( jump_at_moving_suite, j );
1732 (*atr_rep_screening_scorefxn_)(base_pose_screen);
1734 EnergyMap const & energy_map=base_pose_screen.energies().total_energies();
1737 std::cout <<
"base_rep= " << base_rep_score <<
" base_atr= " << base_atr_score << std::endl;
1739 if(
output_pdb_) base_pose_screen.dump_pdb(
"base_atr_rep_after.pdb" );
1795 using namespace core::chemical;
1796 using namespace core::conformation;
1797 using namespace core::id;
1800 Size const three_prime_res = five_prime_res+1;
1813 using namespace core::chemical;
1814 using namespace core::conformation;
1815 using namespace core::id;
1817 if((five_prime_res)!=(three_prime_res-1)) utility_exit_with_message(
"(five_prime_res)!=(three_prime_res-1)");
1822 for(
Size n=1; n<=3; n++){
1826 for(
Size n=5; n<=6; n++){
1835 using namespace core::scoring;
1840 utility_exit_with_message(
"chain_break_screening_pose.residue(five_prime_chain_break_res).has_variant_type( chemical::CUTPOINT_LOWER )==false" );
1844 utility_exit_with_message(
"chain_break_screening_pose.residue(five_prime_chain_break_res+1).has_variant_type( chemical::CUTPOINT_UPPER )==false" );
1850 rna_loop_closer.apply( chain_break_screening_pose, five_prime_res);
1852 (*chainbreak_scorefxn)(chain_break_screening_pose);
1860 if((angle_score<5) && (distance_score<5)){
1865 std::cout <<
" angle= " << angle_score <<
" dist= " << distance_score;
1892 using namespace ObjexxFCL;
1901 static Real const atr_cutoff_for_bulge( -999999.0 );
1908 if(delta_atr_score>(+0.01)){
1909 utility_exit_with_message(
"delta_atr_score>(+0.01). delta_atr_score= " + string_of(delta_atr_score) );
1913 utility_exit_with_message(
"The base at " + string_of(working_moving_res) +
" is already virtualized!!" );
1916 bool bulge_added=
false;
1919 if ( delta_atr_score >= atr_cutoff_for_bulge ) {
1932 std::cout <<
"delta_atr " << delta_atr_score <<
" passes cutoff for bulge. " << atr_cutoff_for_bulge;
1939 if (
verbose_) std::cout <<
"delta_atr " << delta_atr_score <<
" DOES NOT PASS cutoff for bulge " << atr_cutoff_for_bulge << std::endl;
1952 bool add_pose_to_list=
false;
1958 if(add_pose_to_list){
1961 std::cout <<
"tag= " << tag <<
" current_score_cutoff_ " <<
current_score_cutoff_ <<
" score= " << current_score;
1966 (*current_pose_data.
pose_OP)=current_pose;
1967 current_pose_data.
score = current_score;
1968 current_pose_data.
tag=tag;
1975 pose_data_list.push_back(current_pose_data);
1976 if(
verbose_) std::cout <<
" pose_data_list.size= " << pose_data_list.size() << std::endl;
1984 using namespace core::scoring;
1986 Real const current_score=(*sampling_scorefxn_)(current_pose);
1991 std::sort(pose_data_list.begin(), pose_data_list.end(),
sort_criteria);
1994 pose_data_list.erase(pose_data_list.begin()+
num_pose_kept_, pose_data_list.end());
1995 std::cout<<
"after erasing.. pose_data_list.size()= " << pose_data_list.size() << std::endl;
1997 std::cout<<
"pose_data_list.size()= " << pose_data_list.size() << std::endl;
2001 return current_score;
2020 Size num_clustered_pose=0;
2022 for(
Size i=1; i<=pose_data_list.size(); i++){
2024 if(pose_state_list[i]==
true){
2025 num_clustered_pose++;
2026 for(
Size j=i+1; j<=pose_data_list.size(); j++){
2033 rmsd =
suite_rmsd( (*pose_data_list[i].pose_OP), (*pose_data_list[j].pose_OP), actually_moving_res, Is_prepend ,
false );
2036 bool const same_pucker=
Is_same_ribose_pucker((*pose_data_list[i].pose_OP), (*pose_data_list[j].pose_OP), actually_moving_res);
2039 pose_state_list[j]=
false;
2041 std::cout <<
"rmsd= " << rmsd <<
" pose " << pose_data_list[j].tag <<
" is a neighbor of pose " << pose_data_list[i].tag;
2045 std::cout << std::endl;
2055 for(
Size i=1; i<=pose_data_list.size(); i++) {
2056 if(pose_state_list[i]==
true){
2057 clustered_pose_data_list.push_back(pose_data_list[i]);
2061 pose_data_list=clustered_pose_data_list;
2080 Real const & base_rep_score,
2081 Real const & base_atr_score,
2082 Real & delta_atr_score,
2083 Real & delta_rep_score,
2084 Size const & gap_size,
2085 bool const & Is_internal){
2087 using namespace core::scoring;
2091 bool close_chain = (gap_size==0) ?
true:
false;
2093 if(close_chain && Is_internal)
return true;
2095 (*atr_rep_screening_scorefxn_)(current_pose_screen);
2102 delta_rep_score=rep_score-base_rep_score;
2103 delta_atr_score=atr_score-base_atr_score;
2106 if(close_chain) actual_rep_cutoff=10;
2107 if(close_chain && Is_internal) actual_rep_cutoff=200;
2109 bool pass_rep_screen=
false;
2111 if( delta_rep_score < actual_rep_cutoff ){
2112 pass_rep_screen=
true;
2116 bool pass_atr_rep_screen=
false;
2119 pass_atr_rep_screen=pass_rep_screen;
2121 if( delta_atr_score<(-1) && (delta_rep_score+delta_atr_score) < 0 ) pass_atr_rep_screen=
true;
2125 if( pass_atr_rep_screen ) {
2127 std::cout <<
" rep= " << delta_rep_score <<
" atr= " << delta_atr_score;
2137 std::cout << std::endl;
2148 Real const & base_rep_score,
2149 Real const & base_atr_score,
2150 Real & delta_rep_score,
2151 Real & delta_atr_score,
2152 Size const & gap_size,
2153 bool const & Is_internal){
2155 using namespace core::scoring;
2156 using namespace ObjexxFCL;
2160 bool close_chain = (gap_size==0) ?
true:
false;
2162 if(close_chain && Is_internal)
return true;
2164 (*atr_rep_screening_scorefxn_)(current_pose_screen);
2171 delta_rep_score=rep_score-base_rep_score;
2172 delta_atr_score=atr_score-base_atr_score;
2174 if(delta_rep_score<(-0.01)){
2175 std::string const message=
"delta_rep_score= " + string_of(delta_rep_score) +
" rep_score= " + string_of(rep_score) +
" base_rep_score= " + string_of(base_rep_score);
2176 utility_exit_with_message(
"delta_rep_score<(-0.01), " + message );
2179 if(delta_atr_score>(+0.01)){
2180 std::string const message=
"delta_atr_score= " + string_of(delta_atr_score) +
" atr_score= " + string_of(atr_score) +
" base_atr_score= " + string_of(base_atr_score);
2181 utility_exit_with_message(
"delta_atr_score>(+0.01), " + message );
2185 if(close_chain) actual_rep_cutoff=10;
2186 if(Is_internal) actual_rep_cutoff=200;
2188 bool pass_rep_screen=
false;
2190 if( delta_rep_score < actual_rep_cutoff ){
2191 pass_rep_screen=
true;
2197 bool pass_atr_rep_screen=
false;
2200 pass_atr_rep_screen=pass_rep_screen;
2201 }
else if(Is_internal){
2202 if( delta_atr_score<(-1) && (delta_rep_score+delta_atr_score) < (actual_rep_cutoff-
rep_cutoff_) ) pass_atr_rep_screen=
true;
2204 if( delta_atr_score<(-1) && (delta_rep_score+delta_atr_score) < 0 ) pass_atr_rep_screen=
true;
2208 if( pass_atr_rep_screen ) {
2212 std::cout <<
" rep= " << delta_rep_score <<
" atr= " << delta_atr_score;
2245 using namespace protocols::simple_moves;
2246 using namespace core::pack;
2247 using namespace core::pack::task;
2248 using namespace core::pack::task::operation;
2252 ObjexxFCL::FArray1D< bool >
const & partition_definition =
job_parameters_->partition_definition();
2253 bool const root_partition = partition_definition( pose.
fold_tree().
root() );
2259 Size current_group = 0;
2260 Size spectator_group = 1;
2262 for (
Size i = 1; i <= nres; i++ ) {
2264 if ( partition_definition( i ) != root_partition ) {
2266 std::cout <<
"GREENPACKER SAMPLER " << i << std::endl;
2268 std::cout <<
"GREENPACKER SPECTATOR " << i <<
" --> group " << spectator_group << std::endl;
2270 group_ids.push_back( current_group );
2273 user_defined_group_discriminator->set_group_ids( group_ids );
2281 for (
Size i = 1; i <= nres; i++) {
2300 using namespace core::id;
2301 using namespace core::conformation;
2325 using namespace ObjexxFCL;
2329 core::Real const principal_torsion=numeric::principal_angle_degrees( torsion_value);
2331 Size const principal_torsion_SIZE=
Size(std::abs(principal_torsion+0.00001));
2334 if(principal_torsion>0){
2335 torsion_string=
"p" + lead_zero_string_of(principal_torsion_SIZE, 3);
2337 torsion_string=
"n" + lead_zero_string_of(principal_torsion_SIZE, 3);
2340 return torsion_string;
2380 using namespace ObjexxFCL;
2384 for(
Size list_position=rotamer_generator->rotamer_generator_list_size(); list_position>=2; list_position--){
2385 tag.append(
"_" + lead_zero_string_of(rotamer_generator->group_rotamer(list_position), 4));
2388 tag.append(
"_" + lead_zero_string_of(rotamer_generator->group_rotamer(1), 4));
2389 tag.append(
"_" + lead_zero_string_of(rotamer_generator->subgroup_rotamer(1), 5));
2485 using namespace core::io::silent;
2488 utility_exit_with_message(
"verbose_==false, but StepWiseRNA_ResidueSampler::output_pose_data_list is still called?!" );
2509 std::cout <<
"Set cluster_rmsd to " <<
cluster_rmsd_ << std::endl;