Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DnaInterfaceFinder.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 /// @brief
11 /// @author ashworth
12 
14 
15 #include <protocols/dna/util.hh>
16 
18 #include <core/pose/Pose.hh>
19 
20 #include <utility/exit.hh> // runtime_assert
21 
22 #include <utility/vector1.hh>
23 
24 
25 namespace protocols {
26 namespace dna {
27 
28 using namespace core;
29 using namespace conformation;
30 using utility::vector1;
31 
32 void
34 {
35  // Does both protein and DNA
36  vector1< Size > protein_positions, dna_positions;
37  for ( Size index(1), end( pose.total_residue() ); index <= end; ++index ) {
38  if ( pose.residue_type( index ).is_protein() ) protein_positions.push_back( index );
39  else if ( pose.residue_type( index ).is_DNA() ) dna_positions.push_back( index );
40  }
41  determine_protein_interface( pose, protein_positions, dna_positions );
42  determine_dna_interface( pose, protein_positions, dna_positions );
43 }
44 
45 void
47 {
48  // all protein positions against all DNA positions
49  // this is the slowest possible (intended) usage of DnaInterfaceFinder
50  vector1< Size > protein_positions, dna_positions;
51  for ( Size index(1), end( pose.total_residue() ); index <= end; ++index ) {
52  if ( pose.residue_type( index ).is_protein() ) protein_positions.push_back( index );
53  else if ( pose.residue_type( index ).is_DNA() ) dna_positions.push_back( index );
54  }
55  determine_protein_interface( pose, protein_positions, dna_positions );
56 }
57 
58 void
60  pose::Pose const & pose,
61  vector1< Size > const & protein_positions,
62  vector1< Size > const & dna_positions
63 )
64 {
65  determine_protein_interface( pose, protein_positions, dna_positions );
66  determine_dna_interface( pose, protein_positions, dna_positions );
67 }
68 
69 void
71  pose::Pose const & pose,
72  vector1< Size > const & protein_positions,
73  vector1< Size > const & dna_positions
74 )
75 {
76  for ( vector1< Size >::const_iterator p_index( protein_positions.begin() ),
77  end( protein_positions.end() ); p_index != end; ++p_index ) {
78  runtime_assert( pose.residue_type( *p_index ).is_protein() );
79 
80  Residue const & pres( pose.residue( *p_index ) );
81  protein_neighbors_[ *p_index ] = DnaNeighbor();
82  DnaNeighbor & neighbor( protein_neighbors_[ *p_index ] );
83 
84  Real shortest_arg_dis2(10000);
85  for ( vector1< Size >::const_iterator dna_index( dna_positions.begin() ),
86  end( dna_positions.end() ); dna_index != end && !neighbor.contact(); ++dna_index ) {
87  runtime_assert( pose.residue_type( *dna_index ).is_DNA() );
88 
89  Residue const & dres( pose.residue( *dna_index ) );
90  neighbor.close( close_to_dna( pres, dres, close_threshold_, base_only_ ) );
91  if ( neighbor.close() ) {
92  if ( z_axis_dist( pres, dres ) < z_cutoff_ ) {
93  Real dis2(
94  argrot_dna_dis2( pose, *p_index, pres, dres, contact_threshold_, base_only_ )
95  );
96  if ( dis2 < shortest_arg_dis2 ) shortest_arg_dis2 = dis2;
97  if ( shortest_arg_dis2 < contact_threshold_ ) neighbor.contact(true);
98  }
99  }
100  }
101  }
102  initialized_ = true;
103 }
104 
105 void
107  pose::Pose const & pose,
108  vector1< Size > const & protein_positions,
109  vector1< Size > const & dna_positions
110 )
111 {
112  for ( vector1< Size >::const_iterator d_index( dna_positions.begin() ),
113  end( dna_positions.end() ); d_index != end; ++d_index ) {
114  runtime_assert( pose.residue_type( *d_index ).is_DNA() );
115 
116  Residue const & dres( pose.residue( *d_index ) );
117  dna_neighbors_[ *d_index ] = DnaNeighbor();
118  DnaNeighbor & neighbor( dna_neighbors_[ *d_index ] );
119 
120  Real shortest_arg_dis2(10000);
121  for ( vector1< Size >::const_iterator p_index( protein_positions.begin() ),
122  end( protein_positions.end() ); p_index != end && !neighbor.contact(); ++p_index ) {
123  runtime_assert( pose.residue_type( *p_index ).is_protein() );
124 
125  Residue const & pres( pose.residue( *p_index ) );
126  neighbor.close( close_to_dna( pres, dres, close_threshold_, base_only_ ) );
127  if ( neighbor.close() ) {
128  if ( z_axis_dist( pres, dres ) < z_cutoff_ ) {
129  Real dis2(
130  argrot_dna_dis2( pose, *p_index, pres, dres, contact_threshold_, base_only_ )
131  );
132  if ( dis2 < shortest_arg_dis2 ) shortest_arg_dis2 = dis2;
133  if ( shortest_arg_dis2 < contact_threshold_ ) neighbor.contact(true);
134  }
135  }
136  }
137  }
138  initialized_ = true;
139 }
140 
141 DnaNeighbors const &
143 {
144  runtime_assert( initialized() );
145  return protein_neighbors_;
146 }
147 
148 DnaNeighbors const &
150 {
151  runtime_assert( initialized() );
152  return dna_neighbors_;
153 }
154 
155 } // namespace dna
156 } // namespace protocols