Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StepWiseProteinFilterer.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 StepWiseProteinFilterer
11 /// @brief Not particularly fancy, just filters a list of poses.
12 /// @detailed
13 /// @author Rhiju Das
14 
15 
16 //////////////////////////////////
18 
19 //////////////////////////////////
20 #include <core/types.hh>
21 #include <core/pose/Pose.hh>
22 #include <core/scoring/Energies.hh>
25 
26 #include <list>
27 
28 //Auto Headers
29 #include <utility/vector1.hh>
30 
31 using namespace core;
32 using core::Real;
33 
34 namespace protocols {
35 namespace swa {
36 namespace protein {
37 
38 
39  //////////////////////////////////////////////////////////////////////////
40  //constructor!
41  StepWiseProteinFilterer::StepWiseProteinFilterer():
42  final_number_( 400 )
43  {
44  }
45 
46  //////////////////////////////////////////////////////////////////////////
47  //destructor
49  {}
50 
51  //////////////////////////////////////////////////////////////////////////
52  void
53  StepWiseProteinFilterer::filter( PoseList & pose_list, PoseList & filter_pose_list ) const
54  {
55 
56  using namespace core::scoring;
57  using namespace core::pose;
58 
59  static ScoreFunctionOP fa_scorefxn = core::scoring::getScoreFunction();
60 
61  typedef std::list < std::pair< Real, std::string > > ScoreList;
62  ScoreList score_list;
63 
64  for ( PoseList::iterator iter = pose_list.begin(); iter != pose_list.end(); iter++ ) {
65  PoseOP & pose_op( iter->second );
66  Pose & pose( *pose_op );
67  Real score = (*fa_scorefxn)( pose );
68 
69  /////////////////////////////////////////////////////////////////////////////
70  /////////////////////////////////////////////////////////////////////////////
71  score -= pose.energies().total_energies()[ fa_rep ]; /*downweight fa_rep */
72  /////////////////////////////////////////////////////////////////////////////
73  /////////////////////////////////////////////////////////////////////////////
74 
75  std::string const & tag( iter->first );
76 
77  score_list.push_back( std::make_pair( score, tag ) );
78  }
79 
80  // std::cout << "LIST OF POSES " << pose_list.size() << " " << score_list.size() << std::endl;
81 
82  score_list.sort();
83 
84  Size count( 0 );
85  for ( ScoreList::const_iterator iter=score_list.begin(); iter != score_list.end(); iter++ ) {
86  count++;
87  if ( count > final_number_ ) break;
88  std::string const & tag = iter->second;
89  filter_pose_list[ tag ] = pose_list[ tag ];
90  }
91 
92  }
93 
94 }
95 }
96 }