Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Interface.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/pack/task/ResfileReader.cc
11 /// @brief implementation of resfile reader and its command classes
12 /// @author Gordon Lemmon (glemmon@gmail.com)
13 ///
14 // Unit Headers
16 #include <core/types.hh>
17 
18 // Boost Headers
19 #include <boost/foreach.hpp>
20 
21 #define foreach BOOST_FOREACH
22 
23 
24 namespace protocols {
25 namespace ligand_docking {
26 namespace ligand_options {
27 
29  core::Size num,
30  InterfaceInfo info
31 ) : utility::vector1<InterfaceInfo>(num, info)
32 {}
33 
35  core::Size const chain_begin,
36  core::Size const chain_end,
37  core::Size const window
38 ){
39  for(core::Size i=chain_begin; i<=chain_end; ++i){
40  if( (*this)[i].type == InterfaceInfo::is_interface){
41  for(core::Size j = 1; j <= window; ++j){
42  if(
43  i>j // otherwise the next line fails since we use unsigned ints
44  && i-j >= chain_begin // bounds check
45  && (*this)[i-j].type == InterfaceInfo::non_interface
46  ){
47  (*this)[i-j].type = InterfaceInfo::near_interface;
48  (*this)[i-j].chain=(*this)[i].chain;
49  (*this)[i-j].chain_id=(*this)[i].chain_id;
50  }
51  if(
52  i+j <= chain_end //bounds check
53  && (*this)[i+j].type == InterfaceInfo::non_interface
54  ){
55  (*this)[i+j].type = InterfaceInfo::near_interface;
56  (*this)[i+j].chain=(*this)[i].chain;
57  (*this)[i+j].chain_id=(*this)[i].chain_id;
58  }
59  }
60  }
61  }
62 }
63 
65  return (*this)[chain_begin].type == InterfaceInfo::non_interface?
66  find_start_of_next_interface_region(chain_begin, chain_end): chain_begin;
67 }
68 
70  core::Size start_from,
71  core::Size const chain_end
72 )const{
73  assert( (*this)[start_from].type == InterfaceInfo::non_interface);
74 
75  for(++start_from; start_from <= chain_end; ++start_from){
76  if((*this)[start_from].type != InterfaceInfo::non_interface) {
77  return start_from;
78  }
79  }
80  return 0;
81 }
82 
84  core::Size start_from,
85  core::Size const chain_end
86 )const{
87  assert( (*this)[start_from].type != InterfaceInfo::non_interface );
88  for(++start_from ;start_from<= chain_end; ++start_from){
89  if((*this)[start_from].type == InterfaceInfo::non_interface){
90  return start_from-1;
91  }
92  }
93  return chain_end;
94 
95 }
96 
99  utility::vector1<core::Size> interface_residues;
100 
101  for(core::Size position=1; position<= this->size(); ++position){
102  if(this->at(position).type == InterfaceInfo::is_interface){
103  interface_residues.push_back(position);
104  }
105  }
106  return interface_residues;
107 }
108 
111  utility::vector1<core::Size> interface_residues;
112 
113  for(core::Size position=1; position<= this->size(); ++position){
114  if(this->at(position).type == InterfaceInfo::near_interface){
115  interface_residues.push_back(position);
116  }
117  }
118  return interface_residues;
119 }
120 
122  std::stringstream python_stream;
123 
124  python_stream<<"interface residues: ";
125  foreach(core::Size res_id, get_interface_residues()){
126  python_stream<< res_id << '+';
127  }
128  python_stream<< std::endl;
129  python_stream<<"near interface residues: ";
130 
132  utility::vector1<core::Size>::const_iterator j= near_residues.begin();
133  for(; j != near_residues.end(); ++j){
134  python_stream<< *j << '+';
135  }
136  python_stream<< std::endl;
137 
138 
139 
140  return python_stream.str();
141 }
142 
143 std::ostream & operator<<(std::ostream& output, Interface const & interface){
144  output<<interface.get_python_string();
145  return output;
146 }
147 
148 } //namespace ligand_options
149 } //namespace ligand_docking
150 } //namespace protocols