Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
loopfinder.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 /// @detailed
13 /// @author Oliver Lange
14 /// @author Mike Tyka
15 ///
16 
17 
18 // Unit Headers
19 // AUTO-REMOVED #include <protocols/loops/util.hh>
20 
21 // Package Headers
22 #include <protocols/loops/Loops.hh>
23 
24 // Project Headers
27 #include <core/id/AtomID.hh>
28 #include <core/pose/Pose.hh>
30 
31 #ifdef WIN32
32 #include <core/fragment/FragID.hh>
33 #endif
34 
35 // Utility headers
36 #include <basic/Tracer.hh>
37 #include <utility/vector1.hh>
38 
39 //Auto using namespaces
40 namespace ObjexxFCL { namespace fmt { } } using namespace ObjexxFCL::fmt; // AUTO USING NS
41 
42 
43 static basic::Tracer TR("protocols.loops.util");
44 static basic::Tracer tr("protocols.loops" );
45 
46 namespace protocols {
47 namespace loops {
48 using namespace core;
49 using namespace pose;
50 using namespace kinematics;
51 
52 
53 void
55  // this function will not find terminal loops
56  // get dssp info
57  core::Size lastres = pose.total_residue();
58  core::scoring::dssp::Dssp dssp( pose );
59  dssp.insert_ss_into_pose( pose );
60 
63  for( core::Size ii = 1; ii < pose.total_residue(); ++ii ){
64  if( pose.secstruct(ii) == 'L' && pose.secstruct(ii+1) == 'L' ) {
65  ind_loops.push_back(ii);
66  }
67  if( pose.residue(ii).chain() != pose.residue(ii+1).chain() ) { // separate loops spanning multiple chains
68  all_loops.push_back(ind_loops);
69  ind_loops.clear();
70  continue; // make sure we skip all further conditionals so that we don't double-add the loop
71  }
72  if( pose.secstruct(ii) == 'L' && pose.secstruct(ii+1) != 'L' ) {
73  ind_loops.push_back(ii);
74  all_loops.push_back(ind_loops);
75  ind_loops.clear();
76  }
77 
78  }
79 
80  if( pose.secstruct( lastres ) == 'L' ){
81  ind_loops.push_back( lastres );
82  all_loops.push_back(ind_loops);
83 
84  ind_loops.clear();
85  }
86 
87 
88  for( core::Size ii = 1; ii <= all_loops.size(); ++ii ){
89  core::Size const lastlooppos = all_loops[ii].size();
90  core::Size const chain_firstpos = pose.residue( all_loops[ii][1] ).chain();
91  core::Size const chain_lastpos = pose.residue( all_loops[ii][lastlooppos] ).chain();
92  runtime_assert( chain_firstpos == chain_lastpos ); // This should have been caught in the previous loop indexing.
93  core::Size const chain_begin = pose.conformation().chain_begin( chain_firstpos );
94  core::Size const chain_end = pose.conformation().chain_end( chain_firstpos );
95 
96  // dont include terminal loops
97  if ( all_loops[ii][1] == 1 || all_loops[ii][lastlooppos] == lastres ) { continue; }
98  if ( all_loops[ii][1] == chain_begin || all_loops[ii][lastlooppos] == chain_end ) { continue; } // skip chain begin/end for multimers
99  else{
100 
101  // make sure loop is at least 3 residues long
102  if( all_loops[ii][lastlooppos] - all_loops[ii][1] < 3 ){
103  TR << "increasing loop from" << all_loops[ii][1] << " " << all_loops[ii][lastlooppos] << std::endl;
104  TR << "increasing loop to " << all_loops[ii][1]-1 << " " << all_loops[ii][lastlooppos]+1 << std::endl;
105  // this may seem sloopy but it catches the case where loop size is 1 and other cases as well
106  core::Size cut_point = (all_loops[ii][lastlooppos]+1 - all_loops[ii][1]-1)/2 + all_loops[ii][1]-1;
107  TR << "cut_point" <<cut_point << std::endl;
108  loops.add_loop( all_loops[ii][1]-1, all_loops[ii][lastlooppos]+1, cut_point, 0, false );
109  } else {
110  core::Size cut_point = (all_loops[ii][lastlooppos] - all_loops[ii][1])/2 + all_loops[ii][1];
111  loops.add_loop( all_loops[ii][1], all_loops[ii][lastlooppos], cut_point, 0, false );
112  TR << "cut_point" <<cut_point << std::endl;
113  }
114 
115  }
116 
117  }
118 
119 }
120 
121 
122 } // loops
123 } // protocols