Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
setup.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
11 /// @brief
12 /// @author
13 
17 
19 #include <core/chemical/AA.hh>
21 #include <core/pose/Pose.hh>
23 #include <basic/datacache/BasicDataCache.hh>
24 #include <basic/Tracer.hh>
25 
26 #include <utility/vector1.hh>
27 
28 
29 
30 namespace core {
31 namespace scoring {
32 namespace dna {
33 
34 static basic::Tracer TR("core.scoring.dna.setup");
35 
36 void
38  pose::Pose & pose
39 )
40 {
41  //using core::pose::datacache::CacheableDataType::BASE_PARTNER;
43  find_basepairs( pose, partner );
45 }
46 
47 void
49  pose::Pose const & pose,
50  //utility::vector1< std::pair< int, int > > & pairs,
51  utility::vector1< Size > & partner
52 )
53 {
55  using namespace chemical;
56 
57  Real const max_d( 4.0 );
58  Size const nres( pose.total_residue() );
59 
60  //pairs.clear();
61  partner.clear();
62  partner.resize( nres, 0 );
63 
64  std::map< AA, AA > base_partner;
65  base_partner[ na_ade ] = na_thy;
66  base_partner[ na_thy ] = na_ade;
67  base_partner[ na_gua ] = na_cyt;
68  base_partner[ na_cyt ] = na_gua;
69 
70  std::map< AA, std::string > hbond_atom;
71  hbond_atom[ na_ade ] = "N1";
72  hbond_atom[ na_thy ] = "N3";
73  hbond_atom[ na_gua ] = "N1";
74  hbond_atom[ na_cyt ] = "N3";
75 
76  for ( Size i=1; i<= nres; ++i ) {
77  Residue const & i_rsd( pose.residue(i) );
78  AA const & i_aa( i_rsd.aa() );
79  if ( i_rsd.is_DNA() ) {
80  // hbond atom, base y-axis
81  Vector const & i_xyz( i_rsd.xyz( hbond_atom[ i_aa ] ) );
82  Vector const i_axis( get_y_axis( i_rsd, 1 /*strand*/ ) );
83 
84  Real best(1000.0);
85  for ( Size j=1; j<= nres; ++j ) {
86  if ( j==i ) continue;
87  Residue const & j_rsd( pose.residue( j ) );
88  AA const & j_aa( j_rsd.aa() );
89  if ( j_aa == base_partner[ i_aa ] ) {
90  Vector const & j_xyz( j_rsd.xyz( hbond_atom[ j_aa ] ) );
91  Real d( i_xyz.distance( j_xyz ) );
92  if ( d<max_d ) {
93  Vector const j_axis( get_y_axis( j_rsd, 2 /*strand*/ ) );
94  Vector const u( ( i_xyz - j_xyz ).normalized() );
95  Real const dot1( dot( i_axis, j_axis ) );
96  Real const dot2( dot( i_axis, u ) );
97  Real const dot3( dot( j_axis, u ) );
98  d -= dot1+dot2+dot3;
99  if ( d<best && dot1 > 0.75 && dot2 > 0.75 && dot3 > 0.75 ) {
100  best = d;
101  partner[i] = j;
102  }
103  }
104  }
105  }
106  }
107  }
108 
109  for ( Size i=1; i<= nres; ++i ) {
110  if ( !partner[i] ) continue;
111 
112  if ( partner[ partner[i] ] != i ) {
113  partner[i] = 0;
114  continue;
115  }
116 
117  if ( i < partner[i] ) {
118  //pairs.push_back( std::make_pair( i, partner[i] ) );
119  TR(basic::t_debug) << "found basepair: " << i << ' ' << partner[i] << std::endl;
120  }
121  }
122 }
123 
124 
125 
126 
127 
128 } // namespace dna
129 }} // scoring core