Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
chainbreak_util.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 core/scoring/methods/chainbreak_util.cc
11 /// @brief Utility functions for scoring chainbreaks.
12 /// @author James Thompson
13 
14 #include <core/types.hh>
15 #include <core/pose/Pose.hh>
19 // AUTO-REMOVED #include <core/id/AtomID.hh>
20 #include <boost/unordered/unordered_set.hpp>
21 
22 #include <basic/options/option.hh>
23 #include <basic/options/keys/OptionKeys.hh>
24 #include <basic/options/keys/score.OptionKeys.gen.hh>
25 
26 #include <utility/vector1.hh>
27 
28 
29 namespace core {
30 namespace scoring {
31 namespace methods {
32 
34  core::Size residue,
35  core::pose::Pose const & pose
36 ) {
37  using namespace basic::options;
38  using namespace basic::options::OptionKeys;
39 
40  const bool is_cutpoint_in_tree_lower = pose.fold_tree().is_cutpoint(residue);
41  //const bool is_cutpoint_in_tree_upper = pose.fold_tree().is_cutpoint(residue - 1);
42  const bool use_pose_cutpoint_variants = option[OptionKeys::score::score_pose_cutpoint_variants]();
43  const bool has_lower_variant_type = pose.residue(residue).has_variant_type(chemical::CUTPOINT_LOWER);
44  return (has_lower_variant_type && (is_cutpoint_in_tree_lower || use_pose_cutpoint_variants));
45 }
46 
48  core::Size residue,
49  core::pose::Pose const & pose
50 ) {
51  using namespace basic::options;
52  using namespace basic::options::OptionKeys;
53  const bool is_cutpoint_in_tree_upper = pose.fold_tree().is_cutpoint(residue - 1);
54  const bool use_pose_cutpoint_variants = option[OptionKeys::score::score_pose_cutpoint_variants]();
55  const bool has_upper_variant_type = pose.residue(residue).has_variant_type(chemical::CUTPOINT_UPPER);
56  if (residue <= 1) return false;
57  return (has_upper_variant_type && (is_cutpoint_in_tree_upper || use_pose_cutpoint_variants));
58 }
59 
61  const core::pose::Pose& pose,
63  utility::vector1<int>* cutpoints
64 ) {
65  using core::Size;
66  using boost::unordered_set;
67  using namespace basic::options;
68  using namespace basic::options::OptionKeys;
69 
70  assert(cutpoints);
71  unordered_set<int> unique_cutpoints;
72 
73  for ( Size ii = 1; ii <= pose.total_residue(); ++ii ) {
74  if ( is_lower_cutpoint(ii,pose) ) unique_cutpoints.insert(ii);
75  }
76 
77  // Update output parameter
78  std::copy(unique_cutpoints.begin(),
79  unique_cutpoints.end(),
80  std::back_inserter(*cutpoints));
81 
82  std::sort(cutpoints->begin(), cutpoints->end());
83 }
84 
85 } // namespace methods
86 } // namespace scoring
87 } // namespace core