Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TranslatorSet.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/chemical/ChemicalManager.cc
11 /// @brief Chemical manager class
12 /// @author Oliver Lange (olange@u.washington.edu)
13 
15 
16 // Package headers
18 
19 // Project headers
21 // AUTO-REMOVED #include <core/conformation/Conformation.hh>
23 #include <core/pose/Pose.hh>
26 // AUTO-REMOVED #include <core/scoring/ScoreFunction.hh>
27 
28 #include <basic/Tracer.hh>
29 
30 //Auto Headers
32 #include <core/kinematics/Jump.hh>
33 
34 using basic::T;
35 using basic::Error;
36 using basic::Warning;
37 
38 namespace core {
39 namespace coarse {
40 
41 static basic::Tracer TR("core.coarse.TranslatorSet");
42 
43 using namespace chemical;
44 
46  const RuleSet &rules,
47  ResidueTypeSetCAP residue_set,
48  ResidueTypeSetAP coarse_set)
49 : residue_set_(residue_set),
50  coarse_residue_set_(coarse_set)
51 {
52  using namespace std;
53  TR.Error << "constructing TranslatorSet..." << "\n";
54  for ( ResidueTypeSet::const_residue_iterator it=residue_set_->all_residues_begin(),
55  eit=residue_set_->all_residues_end();
56  it!=eit;
57  ++it )
58  {
59  const ResidueType& res = *(it->second);
60  T("coarse.setup") << "in loop " << res.name() << " " << res.name3() << " aa: " << res.aa() << "\n";
61  if ( coarse_residue_set_->has_name( res.name() ) ) {
62  TranslatorOP cmap_ptr =
63  new Translator( rules,ResidueTypeCOP( res ),
64  ResidueTypeAP( const_cast<ResidueType&> (coarse_residue_set_->name_map( res.name() )) )
65  ); //the non-const object is only needed in the construction of Translator (fix_geometry)
66  //, a CAP is stored for later...
67  cmap_ptr->pretty_print(cout);
68  coarse_maps_.insert(TranslatorMap::value_type(it->first,cmap_ptr));
69  } else {
70  Warning() << res.name() << " not found in coarse_residue set... ignored..." << "\n";
71  }
72  }
73 }
74 
75 void
76 TranslatorSet::pretty_print( std::ostream &os ) const
77 {
78  for ( const_iterator it=begin(), eit=end(); it!=eit; ++it ) {
79  it->second->pretty_print(os);
80  os << std::endl;
81  }
82 }
83 
84 TranslatorCOP const&
86 {
87  chemical::ResidueTypeCOPs types=residue_set_->aa_map(aa);
88  if (types.size() > 1) {
89  Warning() << "WARNING: coarse/Translator.cc: using the first residue in the set with AA "
90  << aa << "\n" << "do not know if that is the best choice. Might be good to add " <<
91  "knowledge about the 'default' residue_type to the residueset " << "\n";
92  };
93  return (coarse_maps_[types.front()->name()]);
94 }
95 
96 void
97  TranslatorSet::coarsify( pose::Pose &pose_out, pose::Pose const &pose_in ) const
98 {
99  pose_out.clear();
100  for (uint seqpos = 1;seqpos<=pose_in.total_residue();seqpos++) {
101  pose_out.append_residue_by_bond( *coarsify(pose_in.residue(seqpos)) );
102  };
103  pose_out.fold_tree( kinematics::FoldTree( pose_out.total_residue() ) );
104 }
105 
106 
108  assert( has(fine_rsd.name()) ); // silly check
109  return coarse_maps_[fine_rsd.name()]->coarsify(fine_rsd);
110 }
111 
113  return ( coarse_maps_.find(name) != coarse_maps_.end() );
114 }
115 
116 
117 
118 }
119 }