Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DiversifyCrmsdSelector.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/frag_picker/CompositeFragmentSelector.cc
11 /// @brief provides a selector that picks fragments diferent enough from the fragments that have been already picked
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
15 
16 // package headers
19 #include <core/pose/Pose.hh>
20 
21 #include <core/id/NamedAtomID.hh>
22 //#include <core/io/pdb/pose_io.hh>
23 #include <numeric/model_quality/rms.hh>
24 #include <basic/Tracer.hh>
25 
26 #include <utility/vector1.hh>
27 
28 namespace protocols {
29 namespace frag_picker {
30 
31 using namespace core;
32 
33 static basic::Tracer trDiversifyCrmsdSelector(
34  "protocols.frag_picker.DiversifyCrmsdSelector");
35 
37 
38  pose::PoseOP pose = src->get_chunk()->get_pose();
39  Size len = src->get_length();
40  Size offset = src->get_first_index_in_vall() - 1;
41 
42  for (core::Size i = 1; i <= len; i++) {
43  id::NamedAtomID idCA("CA", i+offset);
44  PointPosition const& xyz = pose->xyz(idCA);
45  for (core::Size d = 1; d <= 3; ++d) {
46  dst(d, i) = xyz[d - 1];
47  }
48  }
49 }
50 
51 
52 /// @brief Selects desired number of fragments from a given set of candidates
54  ScoredCandidatesVector1 const& in,
56 {
57 
58  if(in.size()==0) return;
59 
60  Size len = in[1].first->get_length();
61 
62  if ((Size) fi_.size2() < len) {
63  fj_.redimension(3, len, 0.0);
64  fi_.redimension(3, len, 0.0);
65  }
66 
67  out.push_back( in[1] );
68  for(Size i=2;i<=in.size();i++) {
69  if(out.size() >= frags_per_pos() ) break;
70  bool is_ok = true;
71  copy_coordinates(in[i].first,fi_);
72  for(Size j=1;j<=out.size();j++) {
73  copy_coordinates(out[j].first,fj_);
74  Real rms = numeric::model_quality::rms_wrapper(len,fi_,fj_);
75  if(rms<cutoff_) {
76  is_ok = false;
77  trDiversifyCrmsdSelector.Trace<<"Crmsd is "<<rms<<" fragment "<< *in[i].first<<" denied"<<std::endl;;
78  break;
79  }
80  }
81  if(is_ok) {
82  out.push_back( in[i] );
83  trDiversifyCrmsdSelector.Trace<<"Fragment "<< *in[i].first<<" passed"<<std::endl;;
84  }
85  }
86  trDiversifyCrmsdSelector<<out.size()<<" fragments passed through DiversifyCrmsdSelector at query position "
87  << in[1].first->get_first_index_in_query()<<std::endl;
88 }
89 
90 } // frag_picker
91 } // protocols