Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CrossPeakInfo.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 FragmentSampler.cc
11 /// @brief ab-initio fragment assembly protocol for proteins
12 /// @detailed
13 /// Contains currently: Classic Abinitio
14 ///
15 ///
16 /// @author Oliver Lange
17 
18 // Unit Headers
20 
21 // Package Headers
23 
24 // Project Headers
25 //#include <core/chemical/AA.hh>
26 
27 // Utility headers
28 // AUTO-REMOVED #include <ObjexxFCL/format.hh>
29 // AUTO-REMOVED #include <ObjexxFCL/string.functions.hh>
30 
31 // AUTO-REMOVED #include <utility/string_util.hh>
32 // #include <utility/excn/Exceptions.hh>
33 // #include <utility/vector1.fwd.hh>
34 // #include <utility/pointer/ReferenceCount.hh>
35 // #include <numeric/numeric.functions.hh>
36 // #include <basic/prof.hh>
37 #include <basic/Tracer.hh>
38 // #include <basic/options/option.hh>
39 // #include <basic/options/keys/abinitio.OptionKeys.gen.hh>
40 // #include <basic/options/keys/run.OptionKeys.gen.hh>
41 //#include <basic/options/keys/templates.OptionKeys.gen.hh>
42 
43 //// C++ headers
44 // AUTO-REMOVED #include <iostream>
45 #include <cstdlib>
46 #include <string>
47 
48 #include <utility/vector1.hh>
49 // Third-party Headers
50 #include <boost/functional/hash.hpp>
51 
52 
53 
54 static basic::Tracer tr("protocols.noesy_assign.crosspeaks");
55 
56 using core::Real;
57 using namespace core;
58 using namespace basic;
59 //using namespace basic::options;
60 //using namespace basic::options::OptionKeys;
61 
62 namespace protocols {
63 namespace noesy_assign {
64 
65 /// @details Auto-generated virtual destructor
66 CrossPeakInfo::~CrossPeakInfo() {}
67 
68 void CrossPeakInfo::show( std::ostream& os ) const {
69  os << "CROSSPEAK: "
70  << proton_atom_name_ << " " << label_atom_type_ << " "
71  << "TOL: " << proton_tolerance_ << " " << label_tolerance_
72  << " from file " << filename_;
73  os << "PROTON: ";
74  fold_proton_resonance_.show( os );
75  os << "LABEL: ";
76  fold_label_resonance_.show( os );
77  os << "MAX_NOE_DIST: " << max_noe_distance_;
78 }
79 
80 void CrossPeakInfo::set_filename( std::string filename ) {
81  filename_ = filename;
82  exp_hash_ = boost::hash_value( filename );
83 }
84 
85 
86 
87 std::ostream& operator<< ( std::ostream& os, CrossPeakInfo const& cpi ) {
88  cpi.show( os );
89  return os;
90 }
91 
92 
93 std::string CrossPeakInfo::label_atom_name( std::string const& proton_name, core::chemical::AA aa ) const {
94  using namespace core::chemical; //for AA
95  if ( label_atom_type_ == "N" or label_atom_type_ == "NC" ) {
96  if ( aa == aa_arg ) {
97  if ( proton_name == "HE" ) return "NE";
98  if ( proton_name.substr(0,2) == "HH" ) return "N"+proton_name.substr(1,2); //HH11 HH12 HH21 HH22
99  }
100  if ( aa == aa_lys ) {
101  if ( proton_name.substr(0,2) == "HZ" ) return "NZ";
102  }
103  if ( aa == aa_gln ) {
104  if ( proton_name.substr(0,3) == "HE2" ) return "NE2"; //HE21, HE22
105  }
106  if ( aa == aa_asn ) {
107  if ( proton_name.substr(0,3) == "HD2" ) return "ND2"; //HD21, HD22
108  }
109  if ( aa == aa_trp ) {
110  if ( proton_name == "HE1" ) return "NE1";
111  }
112  if ( proton_name == "H" ) return "N";
113  } // atom type is "N"
114 
115  std::string name;
116  if ( label_atom_type_ == "C" or label_atom_type_ == "NC" ) {
117  if ( proton_name[ 0 ] == 'Q' && proton_name[ 1 ] == 'Q' ) { //QQX
118  name = "C" + proton_name.substr(2,1);
119  return name;
120  }
121  if ( proton_name[ 0 ] == 'Q' ) { //Qxx
122  name = proton_name;
123  name[ 0 ] ='C';
124  return name;
125  } if ( proton_name.substr(1,2) == "HB" ) {
126  return "CB";
127  } if ( proton_name.substr(1,2) == "HA" ) {
128  return "CA";
129  }
130  if ( aa == aa_trp ) {
131  if ( proton_name == "HH2" ) return "CH2";
132  if ( proton_name == "HZ2" ) return "CZ2";
133  if ( proton_name == "HZ3" ) return "CZ3";
134  if ( proton_name == "HE3" ) return "CE3";
135  if ( proton_name == "HD1" ) return "CD1";
136  }
137  if ( aa == aa_phe || aa == aa_tyr ) {
138  if ( proton_name == "HZ" ) return "CZ";
139  if ( proton_name.substr(0,2) == "HD" || proton_name.substr(0,2) == "HE" ) return "C"+proton_name.substr(1,2);
140  }
141 
142  if ( proton_name.substr(0,2) == "HA" ) return "CA";
143  if ( proton_name.substr(0,2) == "HB" ) return "CB";
144  if ( aa != aa_asn ) { //don't make HD21 -> CD substition for ASN
145  Size len=proton_name.size()-2;
146  if ( proton_name.substr(0,2) == "HG" || proton_name.substr(0,2)=="HD" ) return "C"+proton_name.substr(1,len < 1 ? 1 : len );
147  }
148 
149 
150  }
151  throw EXCN_UnknownAtomname("proton_name " + proton_name + " not recognized for " + label_atom_type_ + " label" );
152  return "no_atom";
153 }
154 
155 }
156 }