Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Ab_TemplateInfo.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 protocls/antibody2/Ab_TemplateInfo.cc
11 /// @brief grafts a cdr onto the template of an antibody framework
12 /// @detailed
13 /// @author Jianqing Xu (xubest@gmail.com)
14 
15 
16 
18 #include <basic/Tracer.hh>
20 // ObjexxFCL Headers
21 #include <ObjexxFCL/FArray1D.hh>
22 #include <ObjexxFCL/format.hh>
23 #include <fstream>
24 #include <core/pose/PDBInfo.fwd.hh>
25 #include <core/pose/PDBInfo.hh>
26 
27 static basic::Tracer TR("antibody2.Ab_TemplateInfo");
28 
29 namespace protocols{
30 namespace antibody2{
31 using namespace core;
32 
33 
34 
35 /// default constructor
37  set_default( false/*camelid*/ );
38 }
39 
40 
41 /// constructor with arguments 1
42 Ab_TemplateInfo::Ab_TemplateInfo(bool load_L1, bool load_L2, bool load_L3,
43  bool load_H1, bool load_H2, bool load_H3)
44 {
45  load_templates_from_pdbs(load_L1, load_L2, load_L3,
46  load_H1, load_H2, load_H3, false/*camelid*/ );
47 }
48 
49 
50 /// constructor with arguments 1
51 Ab_TemplateInfo::Ab_TemplateInfo(bool load_L1, bool load_L2, bool load_L3,
52  bool load_H1, bool load_H2, bool load_H3, bool camelid)
53 {
54  load_templates_from_pdbs(load_L1, load_L2, load_L3,
55  load_H1, load_H2, load_H3, camelid );
56 }
57 
58 
59 
60 
61 
62 
63 
64 
65 void
66 Ab_TemplateInfo::load_templates_from_pdbs(bool load_L1, bool load_L2, bool load_L3,
67  bool load_H1, bool load_H2, bool load_H3, bool camelid)
68 {
69  set_default(camelid);
70 
71  load_L1_ = load_L1;
72  load_L2_ = load_L2;
73  load_L3_ = load_L3;
74  load_H1_ = load_H1;
75  load_H2_ = load_H2;
76  load_H3_ = load_H3;
77 
78 
79  if( camelid && (load_L1_||load_L2_||load_L3_) ){
80  utility_exit_with_message("This is Camelid antibody, No Light Chain !!!");
81  }
82 
83 
84  if(!camelid_){
85  if(load_L1_){
86  import_pose::pose_from_pdb( L1_t_pose_, "./L1.pdb" );
87  templates_poses_.insert( std::pair<std::string, core::pose::Pose> ("L1", L1_t_pose_) );
88  }
89  if(load_L2_){
90  import_pose::pose_from_pdb( L2_t_pose_, "./L2.pdb" );
91  templates_poses_.insert( std::pair<std::string, core::pose::Pose> ("L2", L2_t_pose_) );
92  }
93  if(load_L3_){
94  import_pose::pose_from_pdb( L3_t_pose_, "./L3.pdb" );
95  templates_poses_.insert( std::pair<std::string, core::pose::Pose> ("L3", L3_t_pose_) );
96  }
97  }
98 
99 
100  if(load_H1_){
101  import_pose::pose_from_pdb( H1_t_pose_, "./H1.pdb" );
102  templates_poses_.insert( std::pair<std::string, core::pose::Pose> ("H1", H1_t_pose_) );
103  }
104  if(load_H2_){
105  import_pose::pose_from_pdb( H2_t_pose_, "./H2.pdb" );
106  templates_poses_.insert( std::pair<std::string, core::pose::Pose> ("H2", H2_t_pose_) );
107  }
108  if(load_H3_){
109  import_pose::pose_from_pdb( H3_t_pose_, "./H3.pdb" );
110  templates_poses_.insert( std::pair<std::string, core::pose::Pose> ("H3", H3_t_pose_) );
111  }
112 
113 
114 }
115 
116 
117 
118 void
120 {
121  camelid_ = camelid;
122 
123  load_L1_ = true;
124  load_L2_ = true;
125  load_L3_ = true;
126 
127  load_H1_ = true;
128  load_H2_ = true;
129  load_H3_ = true;
130 }
131 
132 
133 
134 
136 
137  TemplatePoseMap::iterator iter = templates_poses_.begin();
138  iter = templates_poses_.find(cdr_name);
139  if ( iter == templates_poses_.end() ) {utility_exit_with_message("Cannot find pose to return!");}
140  return iter->second;
141 }
142 
143 
144 
146  std::ifstream inf;
147  inf.open("query.matches");
148  if(!inf.is_open()) {utility_exit_with_message("Cannot open 'query.matches' file!!");}
149 
150  std::string temp,tttt;
151  inf>>temp>>temp>>temp>>temp>>tttt>>temp>>temp;
152  LightHeavy_t_name_ = tttt;
153 
154  inf>>temp>>temp>>temp>>temp>>tttt>>temp>>temp;
155 
156  inf>>temp>>temp>>temp>>temp>>tttt>>temp>>temp;
157  L1_t_name_ = tttt;
158  inf>>temp>>temp>>temp>>temp>>tttt>>temp>>temp;
159  L2_t_name_ = tttt;
160  inf>>temp>>temp>>temp>>temp>>tttt>>temp>>temp;
161  L3_t_name_ = tttt;
162 
163  inf>>temp>>temp>>temp>>temp>>tttt>>temp>>temp;
164  H1_t_name_ = tttt;
165  inf>>temp>>temp>>temp>>temp>>tttt>>temp>>temp;
166  H2_t_name_ = tttt;
167  inf>>temp>>temp>>temp>>temp>>tttt>>temp>>temp;
168  H3_t_name_ = tttt;
169 }
170 
171 
172 
173 
174 
175 
176 /// @details Show the complete setup of the Ab_TemplateInfo
177 void
178 Ab_TemplateInfo::show( std::ostream & out ) {
179  // if ( !flags_and_objects_are_in_sync_ ){
180  // sync_objects_with_flags();
181  // }
182  out << *this;
183 }
184 
185 std::ostream & operator<<(std::ostream& out, const Ab_TemplateInfo & ab_t_info )
186 {
187  using namespace ObjexxFCL::fmt;
188  // All output will be 80 characters - 80 is a nice number, don't you think?
189  std::string line_marker = "///";
190  out << "////////////////////////////////////////////////////////////////////////////////" << std::endl;
191  out << line_marker << A( 47, "Rosetta Antibody Template Info" ) << space( 27 ) << line_marker << std::endl;
192  out << line_marker << space( 74 ) << line_marker << std::endl;
193 
194  if(ab_t_info.load_L1_){
195  out << line_marker << " L1 template: "<<std::endl;
196  out << line_marker << " template_name: "<<ab_t_info.L1_t_name_<<std::endl;
197  out << line_marker << ab_t_info.L1_t_pose_ << std::endl;
198  }
199 
200  if(ab_t_info.load_L2_){
201  out << line_marker << " L2 template: "<<std::endl;
202  out << line_marker << " template_name: "<<ab_t_info.L2_t_name_<<std::endl;
203  out << line_marker << ab_t_info.L2_t_pose_<<std::endl;
204  }
205 
206  if(ab_t_info.load_L3_){
207  out << line_marker << " L3 template: "<<std::endl;
208  out << line_marker << " template_name: "<<ab_t_info.L3_t_name_<<std::endl;
209  out << line_marker << ab_t_info.L3_t_pose_<<std::endl;
210  }
211 
212  if(ab_t_info.load_H1_){
213  out << line_marker << " H1 template: "<<std::endl;
214  out << line_marker << " template_name: "<<ab_t_info.H1_t_name_<<std::endl;
215  out << line_marker << ab_t_info.H1_t_pose_<<std::endl;
216  }
217 
218  if(ab_t_info.load_H2_){
219  out << line_marker << " H2 template: "<<std::endl;
220  out << line_marker << " template_name: "<<ab_t_info.H2_t_name_<<std::endl;
221  out << line_marker << ab_t_info.H2_t_pose_<<std::endl;
222  }
223 
224  if(ab_t_info.load_H3_){
225  out << line_marker << " H3 template: "<<std::endl;
226  out << line_marker << " template_name: "<<ab_t_info.H3_t_name_<<std::endl;
227  out << line_marker << ab_t_info.H3_t_pose_<<std::endl;
228  }
229 
230  // Close the box I have drawn
231  out << "////////////////////////////////////////////////////////////////////////////////" << std::endl;
232  return out;
233  }
234 
235 
236 
237 
238 
239 
240 } //namespace antibody2
241 } //namespace protocols