40 #include <basic/datacache/BasicDataCache.hh>
41 #include <basic/datacache/CacheableString.hh>
42 #include <basic/Tracer.hh>
43 #include <utility/vector1.hh>
44 #include <utility/tools/make_vector1.hh>
53 #include <ObjexxFCL/format.hh>
54 #include <ObjexxFCL/string.functions.hh>
63 static basic::Tracer
TR(
"protocols.swa.rna_stepwise_rna_clusterer" );
71 SlicedPoseJobParameters::~SlicedPoseJobParameters() {}
78 initialize_parameters_and_input();
79 input_->set_record_source(
true );
80 input_->filenames( silent_files_in );
83 StepWiseRNA_Clusterer::StepWiseRNA_Clusterer(
std::string const & silent_file_in )
85 initialize_parameters_and_input();
86 input_->set_record_source(
true );
89 silent_files_.push_back( silent_file_in );
90 input_->filenames( silent_files_ );
95 initialize_parameters_and_input();
96 input_->set_silent_file_data( sfd );
101 StepWiseRNA_Clusterer::~StepWiseRNA_Clusterer()
106 StepWiseRNA_Clusterer::initialize_parameters_and_input(){
108 input_->set_order_by_energy(
true );
112 max_decoys_ = 999999;
113 score_diff_cut_ = 100000.0;
114 perform_score_diff_cut_ =
false;
116 whole_struct_cluster_radius_ = 0.5;
117 suite_cluster_radius_= 999.99;
118 loop_cluster_radius_= 999.99;
120 rename_tags_ =
false;
121 job_parameters_exist_=
false;
122 distinguish_pucker_=
true;
123 add_lead_zero_to_tag_=
false;
124 quick_alignment_=
false;
125 align_only_over_base_atoms_=
true;
126 optimize_memory_usage_=
false;
128 keep_pose_in_memory_=
true;
129 keep_pose_in_memory_hydrid_=
true;
130 max_memory_pose_num_=0;
131 two_stage_clustering_ =
false;
132 use_triangle_inequality_ =
false;
133 PBP_clustering_at_chain_closure_ =
false;
134 quick_alignment_pose_is_intialized_=
false;
135 skip_clustering_=
false;
136 perform_VDW_rep_screen_=
false;
137 perform_filters_=
false;
138 VDW_rep_screen_info_.clear();
139 full_length_loop_rmsd_clustering_=
false;
140 ignore_FARFAR_no_auto_bulge_tag_=
false;
141 ignore_FARFAR_no_auto_bulge_parent_tag_=
false;
142 ignore_unmatched_virtual_res_=
false;
144 min_num_south_ribose_filter_=0;
150 StepWiseRNA_Clusterer::cluster()
152 using namespace core::scoring;
153 using namespace core::import_pose::pose_stream;
154 using namespace core::chemical;
155 using namespace core::pose;
157 clock_t
const time_start( clock() );
161 Output_boolean(
"skip_clustering_= ", skip_clustering_); std::cout << std::endl;
163 if(skip_clustering_){
169 std::cout <<
"skip_clustering==true --> set keep_pose_in_memory_hydrid_ to false" << std::endl;
170 keep_pose_in_memory_hydrid_=
false;
175 if(( perform_VDW_rep_screen_==
true) && (VDW_rep_screen_info_.size()==0) ){
176 std::cout <<
"User pass in perform_VDW_rep_screen_==true but VDW_rep_screen_info_.size()==0" << std::endl;
177 std::cout <<
"Override and set perform_VDW_rep_screen_ to false" << std::endl;
178 perform_VDW_rep_screen_=
false;
181 Output_boolean(
"perform_VDW_rep_screen_= ", perform_VDW_rep_screen_); std::cout << std::endl;
182 Output_boolean(
"perform_filters_= ", perform_filters_); std::cout << std::endl;
184 if(perform_filters_ && (skip_clustering_==
false)) utility_exit_with_message(
"perform_filters_ but skip_clustering_==false");
185 if(perform_VDW_rep_screen_ && (skip_clustering_==
false)) utility_exit_with_message(
"perform_VDW_rep_screen_ but skip_clustering_==false");
188 std::cout <<
"suite_cluster_radius_= " << suite_cluster_radius_ << std::endl;
189 std::cout <<
"loop_cluster_radius_= " << loop_cluster_radius_ << std::endl;
190 Output_boolean(
"job_parameters_exist_= ", job_parameters_exist_); std::cout << std::endl;
191 Output_boolean(
"quick_alignment_= ", quick_alignment_); std::cout << std::endl;
192 Output_boolean(
"align_only_over_base_atoms_=", align_only_over_base_atoms_); std::cout << std::endl;
193 Output_boolean(
"two_stage_clustering_= ", two_stage_clustering_); std::cout << std::endl;
194 Output_boolean(
"keep_pose_in_memory_= ", keep_pose_in_memory_); std::cout << std::endl;
195 Output_boolean(
"keep_pose_in_memory_hydrid_= ", keep_pose_in_memory_hydrid_); std::cout << std::endl;
196 Output_boolean(
"optimize_memory_usage_(by slicing out fixed region of the pose)= ", optimize_memory_usage_); std::cout << std::endl;
197 Output_boolean(
"distinguish_pucker_= ", distinguish_pucker_); std::cout << std::endl;
198 Output_boolean(
"add_lead_zero_to_tag_= ", add_lead_zero_to_tag_); std::cout << std::endl;
199 Output_boolean(
"PBP_clustering_at_chain_closure_= ", PBP_clustering_at_chain_closure_); std::cout << std::endl;
200 Output_boolean(
"full_length_loop_rmsd_clustering_= ", full_length_loop_rmsd_clustering_); std::cout << std::endl;
201 Output_boolean(
"ignore_FARFAR_no_auto_bulge_tag_= ", ignore_FARFAR_no_auto_bulge_tag_); std::cout << std::endl;
202 Output_boolean(
"ignore_FARFAR_no_auto_bulge_parent_tag_= ", ignore_FARFAR_no_auto_bulge_parent_tag_); std::cout << std::endl;
203 Output_boolean(
"ignore_unmatched_virtual_res_= ", ignore_unmatched_virtual_res_); std::cout << std::endl;
205 std::cout <<
"max_decoys_= " << max_decoys_ << std::endl;
206 std::cout <<
"score_diff_cut_= " << score_diff_cut_ << std::endl;
207 Output_boolean(
"perform_score_diff_cut_= ", perform_score_diff_cut_); std::cout << std::endl;
210 pose_output_list_.clear();
211 tag_output_list_.clear();
212 silent_struct_output_list_.clear();
215 if(optimize_memory_usage_){
216 if(!job_parameters_exist_) utility_exit_with_message(
"optimize_memory_usage=True but job_parameters_exist_=False!");
217 sliced_pose_job_params_.setup(job_parameters_);
220 if(ignore_FARFAR_no_auto_bulge_tag_ || ignore_FARFAR_no_auto_bulge_parent_tag_){
224 if(quick_alignment_) initialize_quick_alignment_pose();
226 if(perform_VDW_rep_screen_) initialize_VDW_rep_screener();
228 initialize_max_memory_pose_num();
230 if(skip_clustering_){
231 create_silent_file_and_tag_list();
232 }
else if(two_stage_clustering_){
233 two_stage_clustering();
235 do_some_clustering();
239 if(tag_output_list_.size()!=silent_struct_output_list_.size()) utility_exit_with_message(
"tag_output_list_.size()!=silent_struct_output_list_.size()");
241 if((keep_pose_in_memory_==
true) && (keep_pose_in_memory_hydrid_==
false) ){
242 if(pose_output_list_.size()!=tag_output_list_.size()) utility_exit_with_message(
"pose_output_list_.size()!=tag_output_list_.size()");
246 std::cout <<
"Final cluster_pose_list size= " << silent_struct_output_list_.size() << std::endl;
247 std::cout <<
"Total clustering time : " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
253 StepWiseRNA_Clusterer::initialize_max_memory_pose_num(){
255 using namespace core::pose;
256 using namespace ObjexxFCL;
258 clock_t
const time_start( clock() );
264 Size num_silent_struct=0;
265 bool found_valid_struct=
false;
271 while ( input_->has_another_pose() ) {
276 if(found_valid_struct==
false){
278 silent_struct->fill_pose( *pose_op, *rsd_set_ );
280 std::string const & tag( silent_struct->decoy_tag() );
284 first_pose_before_slicing=(*pose_op);
286 if(optimize_memory_usage_) (*pose_op)=sliced_pose_job_params_.create_sliced_pose(*pose_op);
289 first_pose=(*pose_op);
290 found_valid_struct=
true;
296 Size const total_res_before_slicing=first_pose_before_slicing.total_residue();
298 Size const total_res=first_pose.total_residue();
321 Real const total_memory=4000000;
323 Real const memory_taken_by_silent_struct=(num_silent_struct*0.55*total_res_before_slicing);
325 if(memory_taken_by_silent_struct > total_memory){
326 max_memory_pose_num_=0;
327 std::cout <<
"memory_taken_by_silent_struct (" << memory_taken_by_silent_struct <<
") > specified_total_memory(" << total_memory <<
")" << std::endl;
329 max_memory_pose_num_=
int( 0.7*( (total_memory-memory_taken_by_silent_struct)/(19*total_res) ) );
332 std::cout <<
"--------------StepWiseRNA_Clusterer::initialize_max_memory_pose_num----------" << std::endl;
333 Output_boolean(
"optimize_memory_usage_ (by slicing)= ", optimize_memory_usage_); std::cout << std::endl;
334 std::cout <<
"first_pose total_res (before_slicing)= " << total_res_before_slicing << std::endl;
335 std::cout <<
"first_pose total_res (already account for slicing)= " << total_res << std::endl;
336 std::cout <<
"num_silent_struct= " << num_silent_struct << std::endl;
337 std::cout <<
"memory_taken_by_silent_struct= " << memory_taken_by_silent_struct << std::endl;
338 std::cout <<
"max_memory_pose_num_= " << max_memory_pose_num_ << std::endl;
339 std::cout <<
"time in function= " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
340 std::cout <<
"--------------StepWiseRNA_Clusterer::initialize_max_memory_pose_num----------" << std::endl;
346 StepWiseRNA_Clusterer::initialize_VDW_rep_screener(){
348 using namespace core::pose;
349 using namespace ObjexxFCL;
351 if(!job_parameters_exist_) utility_exit_with_message(
"perform_VDW_rep_screen_=True but job_parameters_exist_=False!");
353 if(optimize_memory_usage_) utility_exit_with_message(
"perform_VDW_rep_screen_=True and optimize_memory_usage_=True!");
355 if(job_parameters_->Is_simple_full_length_job_params()==
true) utility_exit_with_message(
"job_parameters_->Is_simple_full_length_job_params()==true!");
360 while ( input_->has_another_pose() ) {
364 silent_struct->fill_pose( *pose_op, *rsd_set_ );
366 std::string const & tag( silent_struct->decoy_tag() );
370 if(optimize_memory_usage_) (*pose_op)=sliced_pose_job_params_.create_sliced_pose(*pose_op);
374 user_input_VDW_bin_screener_->setup_using_user_input_VDW_pose( VDW_rep_screen_info_, (*pose_op),
StepWiseRNA_JobParametersCOP(job_parameters_) );
387 StepWiseRNA_Clusterer::initialize_quick_alignment_pose(){
389 using namespace core::pose;
390 using namespace ObjexxFCL;
392 if(!job_parameters_exist_) utility_exit_with_message(
"quick_alignment_=True but job_parameters_exist_=False!");
400 for(
Size n=1; n<=working_best_alignment.size(); n++){
401 Size const seq_num=working_best_alignment[n];
408 utility_exit_with_message(
"quick_alignment_mode is true. However: seq_num " + string_of(seq_num) +
" is a element of working_best_alignment BUT not a element of working_fixed_res ");
416 quick_alignment_pose_is_intialized_=
true;
419 while ( input_->has_another_pose() ) {
424 silent_struct->fill_pose( *pose_op, *rsd_set_ );
426 std::string const & tag( silent_struct->decoy_tag() );
430 if(optimize_memory_usage_) (*pose_op)=sliced_pose_job_params_.create_sliced_pose(*pose_op);
434 quick_alignment_pose_=(*pose_op);
435 quick_alignment_tag_=tag;
436 std::cout <<
"found quick alignment_pose, tag= " << tag << std::endl;
442 if(output_pdb_) quick_alignment_pose_.dump_pdb(
"quick_alignment_pose_" + quick_alignment_tag_ +
".pdb");
453 using namespace core::pose;
455 if(quick_alignment_pose_is_intialized_==
false) utility_exit_with_message(
"quick_alignment_pose_is_intialized_==false");
459 align_poses(pose, tag, quick_alignment_pose_,
"quick_alignment_tag_" + quick_alignment_tag_, alignment_res, align_only_over_base_atoms_);
466 StepWiseRNA_Clusterer::two_stage_clustering(){
470 Real const whole_struct_cluster_radius_actual=whole_struct_cluster_radius_;
471 Real const loop_cluster_radius_actual = loop_cluster_radius_;
472 Real const suite_cluster_radius_actual = suite_cluster_radius_;
473 bool const keep_pose_in_memory_actual=keep_pose_in_memory_;
474 bool const keep_pose_in_memory_hydrid_actual=keep_pose_in_memory_hydrid_;
476 whole_struct_cluster_radius_=2.0;
477 loop_cluster_radius_= 2.0;
478 suite_cluster_radius_= 999;
479 keep_pose_in_memory_=
true;
480 keep_pose_in_memory_hydrid_=
false;
481 use_triangle_inequality_=
false;
486 do_some_clustering();
488 large_cluster_pose_list_ = pose_output_list_;
489 pose_output_list_.clear();
490 tag_output_list_.clear();
491 silent_struct_output_list_.clear();
497 create_large_cluster_centers_member_list();
504 whole_struct_cluster_radius_=whole_struct_cluster_radius_actual;
505 loop_cluster_radius_ = loop_cluster_radius_actual;
506 suite_cluster_radius_ = suite_cluster_radius_actual;
507 keep_pose_in_memory_=keep_pose_in_memory_actual;
508 keep_pose_in_memory_hydrid_=keep_pose_in_memory_hydrid_actual;
510 use_triangle_inequality_=
true;
513 do_some_clustering();
521 StepWiseRNA_Clusterer::create_large_cluster_centers_member_list(){
523 using namespace core::pose;
527 clock_t
const time_start( clock() );
529 cluster_centers_neighbor_list_.clear();
532 cluster_centers_neighbor_list_.assign(large_cluster_pose_list_.size(), empty_vector);
537 std::map< core::Size, core::Size >
const & full_to_sub = get_act_full_to_sub();
538 std::map< core::Size, bool >
const & Is_prepend_map = get_act_Is_prepend_map();
542 Real last_cluster_center_score( 0.0 );
543 getPoseExtraScores( *(large_cluster_pose_list_[large_cluster_pose_list_.size()]),
"score", last_cluster_center_score );
545 while ( input_->has_another_pose() ) {
549 if( (input_ID % 1000) ==0){
550 std::cout <<
"input_ID= " << input_ID <<
" time taken so far= " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
557 if(pass_FARFAR_no_auto_bulge_filter(silent_struct)==
false)
continue;
559 silent_struct->fill_pose( *pose_op, *rsd_set_ );
561 std::string const & tag( silent_struct->decoy_tag() );
566 if(optimize_memory_usage_) (*pose_op)=sliced_pose_job_params_.create_sliced_pose(*pose_op);
569 if(quick_alignment_) align_to_quick_alignment_pose(*pose_op, tag);
574 if(score>(last_cluster_center_score+0.001) )
break;
576 for(
Size n=1; n<=large_cluster_pose_list_.size(); n++){
578 pose::Pose const & cluster_center_pose=*(large_cluster_pose_list_[n]);
580 if(quick_alignment_==
false)
align_poses(*pose_op,
"current_pose", cluster_center_pose,
"large_cluster_center", alignment_res, align_only_over_base_atoms_);
584 if(RMSD<(loop_cluster_radius_*1.5)){
589 cluster_centers_neighbor_list_[n].push_back(member);
594 std::cout <<
"check large_cluster_pose_list_ member size " << std::endl;
595 for(
Size n=1; n<=large_cluster_pose_list_.size(); n++){
596 std::cout <<
"cluster center " << n <<
" has " << cluster_centers_neighbor_list_[n].size() <<
" members " << std::endl;
607 StepWiseRNA_Clusterer::create_silent_file_and_tag_list(){
609 using namespace core::pose;
610 using namespace ObjexxFCL;
617 tag_output_list_.clear();
618 silent_struct_output_list_.clear();
619 pose_output_list_.clear();
625 if(perform_VDW_rep_screen_ || perform_filters_){
627 if(job_parameters_exist_==
false) utility_exit_with_message(
"(perform_VDW_rep_screen_ || perform_filters_) but job_parameters_exist_==false!");
629 working_global_sample_res_list=job_parameters_->working_global_sample_res_list();
633 Output_seq_num_list(
"working_filter_virtual_res_list=", working_filter_virtual_res_list, 50);
634 Output_seq_num_list(
"working_global_sample_res_list=", working_global_sample_res_list, 50);
635 std::cout <<
"min_num_south_ribose_filter_=" << min_num_south_ribose_filter_ << std::endl;
640 bool filter_verbose=
true;
642 while ( input_->has_another_pose() ) {
646 std::string const & tag( silent_struct->decoy_tag() );
648 if(pass_FARFAR_no_auto_bulge_filter(silent_struct)==
false)
continue;
650 if(perform_VDW_rep_screen_ || perform_filters_ ){
653 silent_struct->fill_pose( *pose_op, *rsd_set_ );
658 if(job_parameters_exist_){
659 if( (*pose_op).total_residue()!=job_parameters_->working_sequence().size()){
660 utility_exit_with_message(
"(*pose_op).total_residue()=("+string_of((*pose_op).total_residue())+
")!=("+string_of(job_parameters_->working_sequence().size())+
")=job_parameters_working_sequence().size()");
665 if(perform_VDW_rep_screen_){
667 if(user_input_VDW_bin_screener_->user_inputted_VDW_screen_pose()!=
true){
668 utility_exit_with_message(
"user_input_VDW_bin_screener_->user_inputted_VDW_screen_pose()!=true");
671 bool const pass_VDW_rep_screen=user_input_VDW_bin_screener_->VDW_rep_screen_with_act_pose( (*pose_op), working_global_sample_res_list,
false );
672 if(pass_VDW_rep_screen==
false){
673 if(filter_verbose) std::cout <<
"tag= " << tag <<
" fail VDW_rep_screen! " << std::endl;
678 if(perform_filters_){
679 bool pass_filter=
true;
685 for(
Size n=1; n<=force_north_ribose_list.size(); n++){
686 Size const seq_num=force_north_ribose_list[n];
687 if((*pose_op).residue(seq_num).has_variant_type(
"BULGE"))
continue;
688 if((*pose_op).residue(seq_num).has_variant_type(
"VIRTUAL_RIBOSE"))
continue;
689 if((*pose_op).residue(seq_num).has_variant_type(
"VIRTUAL_RNA_RESIDUE"))
continue;
692 if(filter_verbose) std::cout <<
"pose= " << tag <<
" doesn't have north_ribose at seq_num= " << seq_num << std::endl;
696 for(
Size n=1; n<=force_south_ribose_list.size(); n++){
697 Size const seq_num=force_south_ribose_list[n];
698 if((*pose_op).residue(seq_num).has_variant_type(
"BULGE"))
continue;
699 if((*pose_op).residue(seq_num).has_variant_type(
"VIRTUAL_RIBOSE"))
continue;
700 if((*pose_op).residue(seq_num).has_variant_type(
"VIRTUAL_RNA_RESIDUE"))
continue;
703 if(filter_verbose) std::cout <<
"pose= " << tag <<
" doesn't have south_ribose at seq_num= " << seq_num << std::endl;
707 for(
Size n=1; n<=force_syn_chi_res_list.size(); n++){
708 Size const seq_num=force_syn_chi_res_list[n];
709 if((*pose_op).residue(seq_num).has_variant_type(
"BULGE"))
continue;
710 if((*pose_op).residue(seq_num).has_variant_type(
"VIRTUAL_RIBOSE"))
continue;
711 if((*pose_op).residue(seq_num).has_variant_type(
"VIRTUAL_RNA_RESIDUE"))
continue;
714 if(filter_verbose) std::cout <<
"pose= " << tag <<
" doesn't have syn_chi at seq_num= " << seq_num << std::endl;
718 for(
Size n=1; n<=working_filter_virtual_res_list.size(); n++){
719 Size const seq_num=working_filter_virtual_res_list[n];
720 if((*pose_op).residue(seq_num).has_variant_type(
"VIRTUAL_RNA_RESIDUE")==
false){
722 if(filter_verbose) std::cout <<
"pose= " << tag <<
" doesn't have virtual_rna_residue variant_type at seq_num= " << seq_num << std::endl;
726 if(min_num_south_ribose_filter_!=0){
727 Size num_south_ribose=0;
728 for(
Size n=1; n<=working_global_sample_res_list.size(); n++){
729 Size const seq_num=working_global_sample_res_list[n];
735 if(num_south_ribose<min_num_south_ribose_filter_) pass_filter=
false;
738 if(pass_filter==
false)
continue;
744 if(verbose_) std::cout <<
"Adding " << tag <<
" ID= " << input_ID << std::endl;
746 tag_output_list_.push_back( tag );
747 silent_struct_output_list_.push_back( silent_struct );
750 if(keep_pose_in_memory_){
751 if( (keep_pose_in_memory_hydrid_==
false) || (pose_output_list_.size() < max_memory_pose_num_) ){
753 silent_struct->fill_pose( *localized_pose_op, *rsd_set_ );
754 pose_output_list_.push_back( localized_pose_op );
760 if(perform_VDW_rep_screen_ || perform_filters_){
761 std::cout << tag_output_list_.size() <<
" out of " << input_ID <<
" poses pass the filters." << std::endl;
773 StepWiseRNA_Clusterer::do_some_clustering() {
775 using namespace core::pose;
776 using namespace ObjexxFCL;
778 clock_t
const time_start( clock() );
781 tag_output_list_.clear();
782 silent_struct_output_list_.clear();
783 pose_output_list_.clear();
785 if(use_triangle_inequality_) all_pose_to_output_pose_ID_map_.clear();
787 bool Is_first_pose =
true;
788 bool score_min_defined =
false;
789 Real score_min = 0.0;
791 Size num_pose_clustered = 0;
793 while( input_->has_another_pose() ){
796 if(use_triangle_inequality_) all_pose_to_output_pose_ID_map_.push_back(0);
801 if(pass_FARFAR_no_auto_bulge_filter(silent_struct)==
false)
continue;
803 silent_struct->fill_pose( *pose_op, *rsd_set_ );
808 if ( score_min_defined==
false ){
810 score_min_defined =
true;
813 if( perform_score_diff_cut_ && (score > (score_min + score_diff_cut_) ) )
break;
815 std::string const & tag( silent_struct->decoy_tag() );
816 TR <<
"CHECKING " << tag <<
" with score " << score <<
" ( score_min= " << score_min <<
" ) against list of size " << silent_struct_output_list_.size();
817 TR <<
" Num_pose_clustered so far " << num_pose_clustered << std::endl;
823 if(job_parameters_exist_){
824 if (job_parameters_ -> add_virt_res_as_root() ) {
825 if( (*pose_op).total_residue() - 1 != job_parameters_->working_sequence().size()){
826 utility_exit_with_message(
"(*pose_op).total_residue()=("+string_of((*pose_op).total_residue())+
")!=("+string_of(job_parameters_->working_sequence().size())+
")=job_parameters_working_sequence().size()");
829 if( (*pose_op).total_residue()!=job_parameters_->working_sequence().size()){
830 utility_exit_with_message(
"(*pose_op).total_residue()=("+string_of((*pose_op).total_residue())+
")!=("+string_of(job_parameters_->working_sequence().size())+
")=job_parameters_working_sequence().size()");
836 if(optimize_memory_usage_) (*pose_op)=sliced_pose_job_params_.create_sliced_pose(*pose_op);
839 first_pose_=(*pose_op);
847 bool const OK = check_for_closeness( pose_op , tag );
850 TR <<
"ADDING " << tag << std::endl;
852 tag_output_list_.push_back( tag );
854 if(keep_pose_in_memory_==
true){
855 if( (keep_pose_in_memory_hydrid_==
false) || (pose_output_list_.size() < max_memory_pose_num_) ){
857 pose_output_list_.push_back( pose_op );
862 silent_struct_output_list_.push_back( silent_struct );
864 if(use_triangle_inequality_) {
866 if(input_ID>all_pose_to_output_pose_ID_map_.size()){
867 utility_exit_with_message(
"input_ID>all_pose_to_output_pose_ID_map_.size(), input_ID= " + string_of(input_ID) +
", all_pose_to_output_pose_ID_map_.size()=" + string_of(all_pose_to_output_pose_ID_map_.size()));
870 all_pose_to_output_pose_ID_map_[input_ID]=silent_struct_output_list_.size();
873 if( silent_struct_output_list_.size() >= max_decoys_ )
break;
877 num_pose_clustered++;
879 if( (num_pose_clustered % 100) ==0){
880 std::cout <<
"num_pose_clustered= " << num_pose_clustered <<
" num_cluster_centers= " << silent_struct_output_list_.size() <<
" time_taken_so_far= " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
884 TR <<
"After clustering, number of decoys: " << silent_struct_output_list_.size() <<
" from " << num_pose_clustered <<
" input poses " << std::endl;
892 StepWiseRNA_Clusterer::Is_old_individual_suite_cluster(
pose::Pose const & current_pose,
895 std::map< core::Size, core::Size >
const & full_to_sub,
896 std::map< core::Size, bool >
const & Is_prepend_map,
904 for(
Size i=1; i<=rmsd_res_list.size(); i++){
906 Size const full_seq_num= rmsd_res_list[i];
908 if(full_to_sub.find(full_seq_num)==full_to_sub.end() ) utility_exit_with_message(
"full_to_sub.find(full_seq_num)==full_to_sub.end()!");
909 if(Is_prepend_map.find(full_seq_num)==Is_prepend_map.end() ) utility_exit_with_message(
"Is_prepend_map.find(full_seq_num)==Is_prepend_map.end()!");
911 Size const seq_num=full_to_sub.find(full_seq_num)->second;
912 bool Is_prepend=Is_prepend_map.find(full_seq_num)->second;
924 if(ignore_unmatched_virtual_res_==
false){
926 if(current_is_virtual_res != center_is_virtual_res){
932 if(current_is_virtual_res && center_is_virtual_res){
933 rmsd_list[i]=8888.88;
938 if(PBP_clustering_at_chain_closure_ && job_parameters_->gap_size()==0 ){
941 rmsd_list[i] =
suite_rmsd(current_pose, cluster_center_pose, seq_num, Is_prepend,
false );
944 if(rmsd_list[i]> cluster_radius )
return false;
947 if(distinguish_pucker_){
949 if(current_is_virtual_ribose != center_is_virtual_ribose){
954 bool check_pucker=
true;
956 if(current_is_virtual_ribose && center_is_virtual_ribose){
961 if(check_pucker && (same_ribose_pucker_list[i]==
false)){
979 for(
Size i=1; i<=rmsd_res_list.size(); i++){
981 Size const full_seq_num= rmsd_res_list[i];
982 Size const seq_num=full_to_sub.find(full_seq_num)->second;
983 bool Is_prepend=Is_prepend_map.find(full_seq_num)->second;
984 bool both_pose_res_is_virtual=
false;
986 both_pose_res_is_virtual=
true;
988 std::cout <<
"full_seq_num= " << full_seq_num <<
" seq_num= " << seq_num;
Output_boolean(
" Is_prepend= ",Is_prepend);
Output_boolean(
" both_pose_res_is_virtual= ",both_pose_res_is_virtual);
989 std::cout <<
" same_pucker[" << i <<
"]= ";
Output_boolean(same_ribose_pucker_list[i]);
992 std::cout <<
" rmsd_list[" << i <<
"]= " << rmsd_list[i];
994 if(ignore_unmatched_virtual_res_){
996 std::cout <<
" Ignoring unmatched_virtual_res= ";
1002 std::cout << std::endl;
1012 StepWiseRNA_Clusterer::get_poseOP(
Size const n){
1014 using namespace core::pose;
1015 using namespace ObjexxFCL;
1019 if(keep_pose_in_memory_){
1020 if(keep_pose_in_memory_hydrid_==
false || n<=max_memory_pose_num_){
1022 if(pose_output_list_.size()<n) utility_exit_with_message(
"pose_output_list_.size() (" +string_of(pose_output_list_.size()) +
") <n ("+ string_of(n) +
")" );
1024 return pose_output_list_[ n ];
1030 silent_struct_output_list_[n]->fill_pose( *pose_op, *rsd_set_ );
1032 if(optimize_memory_usage_) (*pose_op)=sliced_pose_job_params_.create_sliced_pose(*pose_op);
1034 if(quick_alignment_) align_to_quick_alignment_pose((*pose_op), tag_output_list_[n] );
1045 using namespace core::scoring;
1046 using namespace ObjexxFCL;
1050 std::map< core::Size, core::Size >
const & full_to_sub = get_act_full_to_sub();
1051 std::map< core::Size, bool >
const & Is_prepend_map = get_act_Is_prepend_map();
1053 Size num_fail_triangle_inequality=0;
1054 Size num_cluster_center_used=0;
1056 Real current_score( 0.0 );
1060 fail_triangle_inequality_list.assign(silent_struct_output_list_.size(),
false);
1062 for(
Size n =1; n<=large_cluster_pose_list_.size(); n++){
1064 Real cluster_center_score( 0.0 );
1066 pose::Pose & cluster_center_pose=*(large_cluster_pose_list_[n]);
1068 if(quick_alignment_==
false)
align_poses(current_pose, tag, cluster_center_pose,
"large_cluster_center", alignment_res, align_only_over_base_atoms_);
1072 if((cluster_center_score+0.001)>current_score)
break;
1076 num_cluster_center_used++;
1078 Real const RMSD=
rmsd_over_residue_list(current_pose, cluster_center_pose, rmsd_res_list, full_to_sub, Is_prepend_map,
false);
1083 for(
Size ii=1; ii<=member_list.size(); ii++){
1087 if((member.
score+0.001)>current_score)
break;
1089 if( (RMSD-member.
RMSD)>(loop_cluster_radius_+0.02) ){
1091 if( (member.
ID>all_pose_to_output_pose_ID_map_.size()) || (member.
ID < 1) ){
1092 utility_exit_with_message(
"member.ID (" + string_of(member.
ID) +
") > all_pose_to_output_pose_ID_map_.size() ( " + string_of(all_pose_to_output_pose_ID_map_.size()) +
") ");
1095 Size const output_pose_ID=all_pose_to_output_pose_ID_map_[member.
ID];
1097 if(output_pose_ID==0)
continue;
1099 if( (output_pose_ID>silent_struct_output_list_.size()) || (output_pose_ID < 1) ){
1100 utility_exit_with_message(
"output_pose_ID (" + string_of(output_pose_ID) +
") > silent_struct_output_list_.size() ( " + string_of(silent_struct_output_list_.size() )+
") ");
1103 if(fail_triangle_inequality_list[output_pose_ID]==
false) num_fail_triangle_inequality++;
1105 fail_triangle_inequality_list[output_pose_ID]=
true;
1111 std::cout <<
"num_fail_triangle_inequality= " << num_fail_triangle_inequality <<
" out_of= " << silent_struct_output_list_.size() << std::endl;
1119 using namespace core::scoring;
1120 using namespace ObjexxFCL;
1126 std::map< core::Size, core::Size >
const & full_to_sub = get_act_full_to_sub();
1127 std::map< core::Size, bool >
const & Is_prepend_map = get_act_Is_prepend_map();
1131 if(quick_alignment_) align_to_quick_alignment_pose(current_pose, tag);
1135 if(use_triangle_inequality_) setup_fail_triangle_inequailty_list(current_pose, tag, fail_triangle_inequality_list);
1137 for (
Size n = silent_struct_output_list_.size(); n >= 1; n-- ) {
1139 if(use_triangle_inequality_ && (fail_triangle_inequality_list[n]==
true))
continue;
1141 pose::PoseOP const cluster_center_poseOP=get_poseOP(n);
1142 pose::Pose const & cluster_center_pose=(*cluster_center_poseOP);
1143 std::string const & cluster_center_tag=tag_output_list_[n];
1146 if(quick_alignment_==
false)
align_poses(current_pose, tag, cluster_center_pose, cluster_center_tag, alignment_res, align_only_over_base_atoms_);
1150 bool old_suite_cluster=Is_old_individual_suite_cluster(current_pose, cluster_center_pose, rmsd_res_list, full_to_sub, Is_prepend_map, suite_cluster_radius_ );
1155 if(full_length_loop_rmsd_clustering_){
1156 if(optimize_memory_usage_) utility_exit_with_message(
"Both full_length_loop_rmsd_clustering_ and optimize_memory_usage_ equal true");
1157 std::string const & full_sequence=job_parameters_->full_sequence();
1160 loop_rmsd=
rmsd_over_residue_list(current_pose, cluster_center_pose, rmsd_res_list, full_to_sub, Is_prepend_map,
false ,
false );
1163 bool old_loop_cluster=(loop_rmsd < loop_cluster_radius_ );
1166 std::cout <<
"Between " << tag <<
" AND " << cluster_center_tag <<
": loop_rmsd=" << loop_rmsd <<
" ";
1167 Output_boolean(
"Is_old_suite_cluster= ", old_suite_cluster); std::cout << std::endl;
1170 if(old_suite_cluster==
true && old_loop_cluster==
true){
1171 std::cout << tag <<
" is a neighbor of " << cluster_center_tag << std::endl;
1185 using namespace core::scoring;
1189 for (
Size n = silent_struct_output_list_.size(); n >= 1; n-- ) {
1193 if ( rmsd < whole_struct_cluster_radius_ )
return false;
1203 if(skip_clustering_==
true){
1204 utility_exit_with_message(
"skip_clustering==true but StepWiseRNA_Clusterer::check_for_closeness() is called! " );
1207 if(job_parameters_exist_){
1208 return Is_new_cluster_center_with_job_parameters(pose_op, tag);
1210 return check_for_closeness_without_job_parameters(pose_op);
1219 StepWiseRNA_Clusterer::output_silent_file(
std::string const & silent_file ){
1221 using namespace core::io::silent;
1225 for (
Size n = 1 ; n <= silent_struct_output_list_.size(); n++ ) {
1229 if ( rename_tags_ ){
1230 s->add_comment(
"PARENT_TAG", s->decoy_tag() );
1233 if(add_lead_zero_to_tag_){
1234 tag =
"S_"+ ObjexxFCL::lead_zero_string_of( n-1 , 6);
1236 tag =
"S_"+ ObjexxFCL::string_of( n-1 );
1239 s->set_decoy_tag( tag );
1242 silent_file_data.write_silent_struct( *s, silent_file,
false );
1250 StepWiseRNA_Clusterer::recalculate_rmsd_and_output_silent_file(
std::string const & silent_file,
1252 bool const write_score_only){
1254 using namespace core::io::silent;
1255 using namespace core::scoring;
1256 using namespace core::pose;
1258 clock_t
const time_start( clock() );
1260 Output_title_text(
"ENTER StepWiseRNA_Clusterer::recalculate_rmsd_and_output_silent_file()");
1262 if(job_parameters_exist_==
false) utility_exit_with_message(
"job_parameters_exist_==false!");
1265 if(job_parameters_->Is_simple_full_length_job_params()==
true) utility_exit_with_message(
"job_parameters_->Is_simple_full_length_job_params()==true!");
1267 Output_boolean(
"write_score_only= ", write_score_only); std::cout << std::endl;
1271 std::string const & full_sequence=job_parameters_->full_sequence();
1274 stepwise_rna_pose_setup->set_verbose(
true);
1276 if(tag_output_list_.size()!=silent_struct_output_list_.size()) utility_exit_with_message(
"pose_output_list_.size()!=silent_struct_output_list_!" );
1281 std::map< core::Size, core::Size >
const & full_to_sub = job_parameters_->const_full_to_sub();
1288 std::map< core::Size, bool > Is_prepend_map;
1289 Is_prepend_map.clear();
1291 Is_prepend_map = job_parameters_->Is_prepend_map();
1293 bool Is_full_length_pose=
true;
1295 bool Is_valid_first_struct=
true;
1297 for (
Size n = 1 ; n <= silent_struct_output_list_.size(); n++ ) {
1303 std::cout <<
"recalculate rmsd for " << tag <<
" n= " << n <<
" taken time " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
1314 if(Is_valid_first_struct){
1316 stepwise_rna_pose_setup->setup_native_pose( pose );
1317 Is_full_length_pose=( pose.
total_residue()==full_sequence.size()) ?
true :
false;
1318 Output_boolean(
"Is_full_length_pose= ", Is_full_length_pose); std::cout << std::endl;
1320 Is_valid_first_struct=
false;
1326 (*native_pose_OP)=(*job_parameters_->working_native_pose());
1328 align_poses((*native_pose_OP),
"native", pose, tag, working_best_alignment, align_only_over_base_atoms_);
1332 s->add_energy(
"NEW_loop_rmsd",
rmsd_over_residue_list( pose, *native_pose_OP, rmsd_res_list, full_to_sub, Is_prepend_map,
false,
false) );
1336 if(working_native_alignment.size()!=0){
1337 align_poses((*native_pose_OP),
"native", pose, tag, working_native_alignment, align_only_over_base_atoms_);
1339 align_poses((*native_pose_OP),
"native", pose, tag, working_best_alignment, align_only_over_base_atoms_);
1341 s->add_energy(
"NEW_O_loop_rmsd",
rmsd_over_residue_list( pose, *native_pose_OP, rmsd_res_list, full_to_sub, Is_prepend_map,
false,
false) );
1343 if(Is_full_length_pose){
1351 if(working_native_alignment.size()!=0){
1352 align_poses((*native_pose_OP),
"native", curr_pose_no_variants, tag +
"_no_variants", working_native_alignment, align_only_over_base_atoms_);
1354 align_poses((*native_pose_OP),
"native", curr_pose_no_variants, tag +
"_no_variants", working_best_alignment, align_only_over_base_atoms_);
1357 s->add_energy(
"NEW_NAT_rmsd",
rmsd_over_residue_list( curr_pose_no_variants, *native_pose_OP, rmsd_res_list, full_to_sub, Is_prepend_map,
false ,
true ) );
1366 if ( rename_tags_ ){
1367 s->add_comment(
"PARENT_TAG", s->decoy_tag() );
1368 if(add_lead_zero_to_tag_) tag =
"S_"+ ObjexxFCL::lead_zero_string_of( n-1 , 6);
1369 s->set_decoy_tag( tag );
1374 silent_file_data.write_silent_struct( *s, silent_file, write_score_only );
1378 std::cout <<
"Total # pose alignment and rmsd recalculation= " << silent_struct_output_list_.size() << std::endl;
1379 std::cout <<
"Total recalculate rmsd time : " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
1381 Output_title_text(
"EXIT StepWiseRNA_Clusterer::recalculate_rmsd_and_output_silent_file()");
1387 StepWiseRNA_Clusterer::get_best_neighboring_shift_RMSD_and_output_silent_file(
std::string const & silent_file){
1389 using namespace core::io::silent;
1390 using namespace core::scoring;
1391 using namespace core::pose;
1393 clock_t
const time_start( clock() );
1395 Output_title_text(
"ENTER StepWiseRNA_Clusterer::get_best_neighboring_shift_RMSD_and_output_silent_file()");
1397 if(job_parameters_exist_==
false) utility_exit_with_message(
"job_parameters_exist_==false!");
1400 if(job_parameters_->Is_simple_full_length_job_params()==
true) utility_exit_with_message(
"job_parameters_->Is_simple_full_length_job_params()==true!");
1405 std::map< core::Size, core::Size >
const & full_to_sub = job_parameters_->const_full_to_sub();
1407 std::map< core::Size, bool > Is_prepend_map;
1408 Is_prepend_map.clear();
1410 Is_prepend_map = job_parameters_->Is_prepend_map();
1412 std::string const & full_sequence=job_parameters_->full_sequence();
1416 std::cout <<
"loop_cluster_radius_ = " << loop_cluster_radius_ << std::endl;
1417 std::cout <<
"suite_cluster_radius_= " << suite_cluster_radius_ << std::endl;
1419 bool Is_full_length_pose=
true;
1421 bool Is_valid_first_struct=
true;
1423 for(
Size n = 1 ; n <= silent_struct_output_list_.size(); n++ ) {
1429 std::cout <<
"find_best_neighboring_shift_rmsd for " << tag <<
" n= " << n <<
" taken time " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
1437 if(Is_valid_first_struct){
1438 Is_full_length_pose=( current_pose.
total_residue()==full_sequence.size()) ?
true :
false;
1439 Output_boolean(
"Is_full_length_pose= ", Is_full_length_pose); std::cout << std::endl;
1441 Is_valid_first_struct=
false;
1445 Real start_score( 0.0 );
1447 if(has_total_score==
false) utility_exit_with_message(
"current_pose (" + tag +
") missing total score!");
1450 Real start_shift_score( 0.0 );
1451 bool has_shift_score=
getPoseExtraScores( current_pose,
"shift_score", start_shift_score );
1452 if(has_shift_score==
false) utility_exit_with_message(
"current_pose (" + tag +
") missing shift_score!");
1454 if(quick_alignment_) align_to_quick_alignment_pose(current_pose, tag);
1456 Real best_shift_score=start_shift_score;
1459 for(
Size other_pose_ID = 1 ; other_pose_ID <= silent_struct_output_list_.size(); other_pose_ID ++ ) {
1461 std::string other_tag=tag_output_list_[ other_pose_ID ];
1468 if(quick_alignment_==
false)
align_poses(other_pose, other_tag, current_pose, tag, working_best_alignment, align_only_over_base_atoms_);
1471 bool old_suite_cluster=Is_old_individual_suite_cluster(current_pose, other_pose, rmsd_res_list, full_to_sub, Is_prepend_map, suite_cluster_radius_ );
1475 if(Is_full_length_pose){
1476 if(optimize_memory_usage_) utility_exit_with_message(
"Both full_length_loop_rmsd_clustering_ and optimize_memory_usage_ equal true");
1479 loop_rmsd=
rmsd_over_residue_list(current_pose, other_pose, rmsd_res_list, full_to_sub, Is_prepend_map,
false ,
false );
1482 bool old_loop_cluster=(loop_rmsd < loop_cluster_radius_ );
1484 if(old_suite_cluster==
true && old_loop_cluster==
true){
1485 if(verbose_) std::cout << tag <<
" is a neighbor of " << other_tag << std::endl;
1490 Real other_shift_score( 0.0 );
1491 bool has_shift_score=
getPoseExtraScores( other_pose,
"shift_score", other_shift_score );
1492 if(has_shift_score==
false) utility_exit_with_message(
"other_pose (" + other_tag +
") missing shift_score");
1494 if(other_shift_score<best_shift_score){
1495 best_shift_score=other_shift_score;
1496 best_shift_tag=other_tag;
1500 float const new_score=start_score-start_shift_score+best_shift_score;
1509 new_silent_struct->add_energy(
"score", new_score );
1510 new_silent_struct->add_energy(
"shift_score", best_shift_score );
1511 new_silent_struct->add_energy(
"self_shift_score", start_shift_score );
1512 new_silent_struct->add_string_value(
"src_shift_tag", best_shift_tag);
1514 silent_file_data.write_silent_struct( *new_silent_struct, silent_file,
false );
1518 std::cout <<
"silent_struct_output_list_.size()= " << silent_struct_output_list_.size() << std::endl;
1519 std::cout <<
"Total get_best_neighboring_shift_RMSD_and_output_silent_file time : " <<
static_cast<Real>( clock() - time_start ) / CLOCKS_PER_SEC << std::endl;
1521 Output_title_text(
"EXIT StepWiseRNA_Clusterer::get_best_neighboring_shift_RMSD_and_output_silent_file()");
1529 StepWiseRNA_Clusterer::create_tags_map(){
1536 current_tags_map_.clear();
1537 parent_tags_map_.clear();
1541 while( input_->has_another_pose() ) {
1545 std::string const tag = silent_struct->decoy_tag();
1547 if(ignore_FARFAR_no_auto_bulge_tag_){
1549 if(current_tags_map_.count(tag)!=0) utility_exit_with_message(tag +
" already exist in current_tags_map_!");
1551 current_tags_map_[tag]=
true;
1556 if(ignore_FARFAR_no_auto_bulge_parent_tag_){
1558 if(silent_struct->has_parent_remark(
"PARENT_TAG")==
false){
1559 std::cout <<
"silent_struct (" << tag <<
") missing PARENT_TAG!" << std::endl;
1560 silent_struct->print_parent_remarks(std::cout);
1561 utility_exit_with_message(
"silent_struct (" + tag +
") missing PARENT_TAG!");
1564 std::string const parent_tag=silent_struct->get_parent_remark(
"PARENT_TAG");
1566 if(parent_tags_map_.count(parent_tag)!=0) utility_exit_with_message(parent_tag +
" already exist in parent_tags_map_!");
1568 parent_tags_map_[parent_tag]=
true;
1589 std::string const NO_AUTO_BULGE_STR =
"_NO_AUTO_BULGE";
1590 std::string const WITH_AUTO_BULGE_STR=
"_WITH_AUTO_BULGE";
1592 std::string const tag = silent_struct->decoy_tag();
1594 if(ignore_FARFAR_no_auto_bulge_tag_){
1596 if(current_tags_map_.size()==0) utility_exit_with_message(
"current_tags_map_ is empty!");
1598 size_t found_curr_tag;
1599 found_curr_tag=tag.find(NO_AUTO_BULGE_STR);
1601 if(found_curr_tag!=std::string::npos){
1605 WITH_AUTO_BULGE_curr_tag.replace( found_curr_tag, 14, WITH_AUTO_BULGE_STR );
1607 if(current_tags_map_.count(WITH_AUTO_BULGE_curr_tag)>0){
1609 std::cout <<
"Ignoring NO_AUTO_BULGE pose: " << tag <<
" since WITH_BULGE_curr_tag: " << WITH_AUTO_BULGE_curr_tag <<
" exist!" << std::endl;
1622 if(ignore_FARFAR_no_auto_bulge_parent_tag_){
1624 if(parent_tags_map_.size()==0) utility_exit_with_message(
"parent_tags_map_ is empty!");
1626 if(silent_struct->has_parent_remark(
"PARENT_TAG")==
false) utility_exit_with_message(
"silent_struct (" + tag +
" missing PARENT_TAG!");
1628 std::string const parent_tag=silent_struct->get_parent_remark(
"PARENT_TAG");
1630 size_t found_parent_tag;
1631 found_parent_tag=parent_tag.find(NO_AUTO_BULGE_STR);
1633 if(found_parent_tag!=std::string::npos){
1635 std::string WITH_AUTO_BULGE_parent_tag=parent_tag;
1637 WITH_AUTO_BULGE_parent_tag.replace( found_parent_tag, 14, WITH_AUTO_BULGE_STR );
1639 if(parent_tags_map_.count(WITH_AUTO_BULGE_parent_tag)>0){
1641 std::cout <<
"Ignoring NO_AUTO_BULGE pose: " << tag <<
" with parent_tag: " << parent_tag;
1642 std::cout <<
", since WITH_AUTO_BULGE_parent_tag " << WITH_AUTO_BULGE_parent_tag <<
" exist!" << std::endl;
1658 job_parameters_=job_parameters;
1663 StepWiseRNA_Clusterer::set_job_parameters_exist(
bool const job_parameters_exist){
1665 job_parameters_exist_=job_parameters_exist;
1671 StepWiseRNA_Clusterer::get_act_alignment_res()
const {
1672 utility::vector1< core::Size > const & alignment_res= (optimize_memory_usage_) ? sliced_pose_job_params_.sliced_pose_best_alignment: job_parameters_->working_best_alignment() ;
1673 return alignment_res;
1677 StepWiseRNA_Clusterer::get_act_rmsd_res_list()
const {
1678 utility::vector1 < core::Size > const & rmsd_res_list = (optimize_memory_usage_) ? sliced_pose_job_params_.sliced_pose_rmsd_res_list : job_parameters_->rmsd_res_list();
1679 return rmsd_res_list;
1682 std::map< core::Size, core::Size >
const &
1683 StepWiseRNA_Clusterer::get_act_full_to_sub()
const {
1684 std::map< core::Size, core::Size >
const & full_to_sub =(optimize_memory_usage_) ? sliced_pose_job_params_.sliced_pose_full_to_sub : job_parameters_->const_full_to_sub();
1688 std::map< core::Size, bool >
const &
1689 StepWiseRNA_Clusterer::get_act_Is_prepend_map()
const {
1690 std::map< core::Size, bool >
const & Is_prepend_map = (optimize_memory_usage_) ? sliced_pose_job_params_.sliced_pose_Is_prepend_map: job_parameters_->Is_prepend_map();
1691 return Is_prepend_map ;
1704 Size const nres=(job_parameters->working_sequence()).
size();
1707 std::map< core::Size, bool >
const & Is_prepend_map = job_parameters->Is_prepend_map();
1708 std::map< core::Size, core::Size >
const & sub_to_full( job_parameters->const_sub_to_full() );
1713 Size sliced_seq_num=1;
1714 for(
Size seq_num=1; seq_num<=nres; seq_num++){
1715 bool keep_res=
false;
1718 std::cout <<
"seq_num " << seq_num <<
" is in working_best_alignment res "<< std::endl;
1724 std::cout <<
"seq_num " << seq_num <<
" is in working_rmsd_res_list "<< std::endl;
1728 if(keep_res==
false && (seq_num+1)<=nres &&
Contain_seq_num(seq_num+1, working_rmsd_res_list) ){
1729 std::cout <<
"seq_num " << seq_num <<
" is in working_rmsd_res_list-1 "<< std::endl;
1733 if(keep_res==
false && (seq_num-1)>=1 &&
Contain_seq_num(seq_num-1, working_rmsd_res_list) ){
1734 std::cout <<
"seq_num " << seq_num <<
" is in working_rmsd_res_list+1 "<< std::endl;
1739 Is_sliced_res_.push_back(keep_res);
1742 working_to_sliced_res_map_.push_back(sliced_seq_num);
1743 sliced_to_working_res_map_.push_back(seq_num);
1746 working_to_sliced_res_map_.push_back(0);
1751 std::cout <<
"------------Before slice to After slice seq_num------------" << std::endl;
1752 for(
Size seq_num=1; seq_num<=working_to_sliced_res_map_.size(); seq_num++){
1753 std::cout << seq_num <<
"----> " << working_to_sliced_res_map_[seq_num] << std::endl;
1755 if(
Contain_seq_num(seq_num, working_best_alignment) ) sliced_pose_best_alignment.push_back(working_to_sliced_res_map_[seq_num]) ;
1756 if(
Contain_seq_num(seq_num, working_rmsd_res_list) ) sliced_pose_rmsd_res_list.push_back(working_to_sliced_res_map_[seq_num]) ;
1758 std::cout <<
"-----------------------------------------------------------" << std::endl;
1760 std::cout <<
"------------After slice to Before slice seq_num------------" << std::endl;
1761 for(
Size seq_num=1; seq_num<=sliced_to_working_res_map_.size(); seq_num++){
1762 std::cout << seq_num <<
"----> " << sliced_to_working_res_map_[seq_num] << std::endl;
1763 sliced_pose_full_to_sub[seq_num]=seq_num;
1765 Size const working_seq_num=sliced_to_working_res_map_[seq_num];
1766 Size const full_seq_num= sub_to_full.find( working_seq_num )->second;
1767 bool const Is_prepend= Is_prepend_map.find( full_seq_num )->second;
1768 sliced_pose_Is_prepend_map[seq_num] =(Is_prepend);
1771 std::cout <<
"-----------------------------------------------------------" << std::endl;
1774 bool in_delete_range=
false;
1779 for(
Size seq_num=1; seq_num<=Is_sliced_res_.size()+1; seq_num++){
1782 if(in_delete_range==
false ){
1784 if(seq_num== (Is_sliced_res_.size()+1) )
continue;
1786 if( Is_sliced_res_[seq_num]==
false){
1787 range_begin=seq_num;
1788 in_delete_range=
true;
1792 if( seq_num==(Is_sliced_res_.size()+1) || Is_sliced_res_[seq_num]==
true ){
1793 range_end=seq_num-1;
1794 in_delete_range=
false;
1796 delete_res_range_list_.push_back( std::make_pair(range_begin, range_end) );
1808 Output_is_prepend_map(
"sliced_pose_Is_prepend_map= " , sliced_pose_Is_prepend_map, working_to_sliced_res_map_.size(), 50);
1819 using namespace core::conformation;
1820 using namespace core::pose;
1821 using namespace ObjexxFCL;
1823 if(Is_setup_==
false){
1824 utility_exit_with_message(
"Is_setup_==false" );
1830 utility_exit_with_message(
"Is_sliced_res.size() ( " + string_of(Is_sliced_res_.size() ) +
") != working_pose.total_residue() ( " + string_of( working_pose.
total_residue() )+
")" );
1840 for(
Size n=delete_res_range_list_.size(); n>=1; n--){
1841 sliced_pose.conformation().delete_residue_range_slow( delete_res_range_list_[n].first, delete_res_range_list_[n].second );
1844 if(sliced_pose.total_residue()!=sliced_to_working_res_map_.size()){
1845 utility_exit_with_message(
"working_pose.total_res() ( " + string_of(working_pose.
total_residue()) +
") != sliced_to_working.size() ( " + string_of( sliced_to_working_res_map_.size() )+
")" );