Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Rules.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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file
12 /// @author Oliver Lange
13 
14 
15 
16 #include "core/coarse/Rules.hh"
17 #ifdef WIN32
18 #include "core/pose/Pose.hh"
20 #endif
21 #include "utility/assert.hh"
22 
23 //Auto Headers
25 
26 
27 
28 
29 using namespace core;
30 using namespace coarse;
31 using namespace conformation;
32 using namespace chemical;
33 using namespace std;
34 
35 
36 const std::string Rule::FULL_ATOM = "FULL_ATOM";
37 const std::string Rule::REST_SIDECHAIN = "REST_SC";
38 const std::string Rule::REST_ALL = "REST";
39 
40 
41 void Rule::pretty_print(std::ostream &os) {
42  os << "Rule for " << my_AA_ << " : "<< endl; // should use name3(my_AA) if it becomes available
43  for (ConstBeadIterator it=begin(), eit=end(); it!=eit; ++it) {
44  os << "coarse atom " << it->first <<" { ";
45  for (ConstTokenIterator tit=it->second.begin(), etit=it->second.end(); tit!=etit; ++tit) {
46  os << *tit << ", ";
47  };
48  os << " }" << endl;
49  };
50 }
51 
52 RuleSet::RuleSet(std::string ASSERT_ONLY(tag) ) {
53  //depending on tag we could have different rulesets or load them from file...
54  // now we have only the soup-of-the-day
55  assert( tag == "coarse_two_bead" );
56  create_rules();
57 }
58 
60  const int n_restype = aa_tyr;
61 
62  /* first of all add Cbeta to bead 1 for all aminoacids apart from aa_gly */
63  for (int iaa=aa_ala; iaa<=n_restype;++iaa) {
64  AA aa=static_cast<AA>(iaa);
65  Rule * pcr = new Rule(aa);
66  RuleOP cr(pcr);
67  rules_[aa]=cr;
68  if (aa!=aa_gly) {
69  rules_[aa]->add_to_bead("B1") << "CB";
70  }
71  };
72  /*hydrogens are added automatically...atoms which are not available will be ignored */
73  /* add other atoms to bead1 manually -- there are not many */
74  rules_[aa_ile]->add_to_bead("B1") << "CG2";
75  rules_[aa_arg]->add_to_bead("B1") << "CG" << "CD";
76  rules_[aa_glu]->add_to_bead("B1") << "CG";
77  rules_[aa_gln]->add_to_bead("B1") << "CG";
78  rules_[aa_lys]->add_to_bead("B1") << "CG";
79  rules_[aa_pro]->add_to_bead("B1") << "CG" << "CD";
80  rules_[aa_met]->add_to_bead("B1") << "CG";
81  for (int iaa=aa_ala;iaa<=n_restype;iaa++) {
82  AA aa=static_cast<AA>(iaa);
83  //add everything that hasn't been bound to bead1
84  if (aa!=aa_gly && aa!=aa_ala && aa!=aa_pro) {
85  rules_[aa]->add_to_bead("B2") << Rule::REST_SIDECHAIN;
86  }
87  rules_[aa]->add_to_bead(Rule::FULL_ATOM) << Rule::REST_ALL;
88  };
89 
90 }
91 
92 bool RuleSet::has(chemical::AA aa) const {
93  return rules_.find(aa)!=rules_.end();
94 }
95 
96 void RuleSet::pretty_print (ostream &os) {
97  typedef RuleMap::iterator MIT;
98  for (MIT it=rules_.begin(),eit=rules_.end(); it!=eit; ++it) {
99  it->second->pretty_print(os);
100  os << endl;
101  };
102 }
103 
104 
105