Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SiteConstraintResidues.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 src/core/scoring/constraints/SiteConstraintResidues.cc
11 /// @brief This class is an AmbiguousConstraint in which the set is comprised of AtomPairConstraints
12 /// @brief of an atom of interest in one chain versus the CA of of another sets of residues
13 /// @author Lei Shi (shilei@uw.edu)
14 
16 // AUTO-REMOVED #include <core/scoring/constraints/XYZ_Func.hh>
20 
21 #include <core/id/AtomID.hh>
23 #include <core/pose/Pose.hh>
24 #include <core/pose/util.hh>
25 
26 #include <basic/Tracer.hh>
27 
28 #include <utility/vector1.hh>
29 
30 //Auto Headers
32 
33 static basic::Tracer TR("core.scoring.constraints.SiteConstraintResidues");
34 
35 namespace core {
36 namespace scoring {
37 namespace constraints {
38 
39 ////////////////////////////////////////////////////////////////////////////////////////////////////
40 /// @brief Constructor
43 {}
44 ////////////////////////////////////////////////////////////////////////////////////////////////////
45 /// @brief Constructor
47 AmbiguousConstraint( cst_in )
48 {}
49 
50 void
51 SiteConstraintResidues::show( std::ostream& out) const
52 {
53  /// APL -- you cannot show the active constraint in the absence of a Pose.
54  //out << "AmbiguousConstraint Active constraint:" << std::endl;
55  //active_constraint()->show(out);
56  out << "SiteConstraintResidues is an AmbiguousConstraint containing the following " << member_constraints().size() << " constraints: " << std::endl;
57  for( ConstraintCOPs::const_iterator cst_it = member_constraints().begin(); cst_it != member_constraints().end(); cst_it++){
58  (*cst_it)->show(out);
59  }
60 
61  out << " ...all member constraints of this SiteConstraintResidues shown." << std::endl;
62 }
63 
64 
65 void
67  std::istream & data,
68  core::pose::Pose const & pose,
69  FuncFactory const & func_factory
70 ) {
71  TR.Debug << "read_site_cst" << std::endl;
72  std::string tempres;
73  Size res1;
74  std::string name;
75  Size res2;
76  Size res3;
77  std::string func_type;
79  data >> res1 >> name >> res2 >> res3 >> func_type;
80  TR.Info << "read: " << res1 << " "<< name << " constrain to residues " << res2 << ":" << res3 << " func: " << func_type << std::endl;
81  FuncOP aFunc = func_factory.new_func( func_type );
82  aFunc->read_data( data );
83 
84  if ( TR.Debug.visible() ) {
85  aFunc->show_definition( TR.Debug ); TR.Debug<<std::endl;
86  }
87  setup_csts( res1, name, res2,res3, pose, aFunc );
88 
89  if ( data.good() ) {
90  //chu skip the rest of line since this is a single line defintion.
91  while( data.good() && (data.get() != '\n') ) {}
92  if ( !data.good() ) data.setstate( std::ios_base::eofbit );
93  }
94 
95  if ( TR.Debug.visible() ) {
96  aFunc->show_definition( TR.Debug );
97  TR.Debug << std::endl;
98  }
99 
100 } // read_def
101 
102 void
104  Size res1,
105  std::string name,
106  Size res2,
107  Size res3,
108  core::pose::Pose const & pose,
109  FuncOP const & func
110 ) {
111  id::AtomID target_atom( pose.residue_type( res1 ).atom_index( name ), res1 );
112  //Size target_chain = pose.chain( res );
113  for (Size j = res2 ; j < res3 ; ++j ) {
114  id::AtomID atom2( pose.residue_type( j ).atom_index( "CA" ), j );
115  runtime_assert( target_atom.valid() && atom2.valid() );
116  add_individual_constraint( new AtomPairConstraint( target_atom, atom2, func ) );
117  }
118 
119 } // setup_csts
120 
121 } // constraints
122 } // scoring
123 } // core