Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NonSequentialNeighborsFilter.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 protocols/simple_filters/NonSequentialNeighborsFilter.cc
11 /// @brief
12 /// @author Gabi Pszolla & Sarel Fleishman
13 
14 
15 //Unit Headers
18 #include <utility/tag/Tag.hh>
20 #include <numeric/xyzVector.hh>
21 //Project Headers
22 #include <basic/Tracer.hh>
24 #include <core/pose/Pose.hh>
25 namespace protocols{
26 namespace simple_filters {
27 
28 static basic::Tracer TR( "protocols.simple_filters.NonSequentialNeighborsFilter" );
29 
32 
34 NonSequentialNeighborsFilterCreator::keyname() const { return "NonSequentialNeighbors"; }
35 
36 //default ctor
38 protocols::filters::Filter( "NonSequentialNeighbors" ),
39 distance_threshold_( 8.0 ),
40 neighbor_cutoff_( 10 ),
41 bound_( false ),
42 resnum_( 0 ),
43 jump_( 1 )
44 {
45 }
46 
48 
49 void
51 {
52  distance_threshold( tag->getOption< core::Real >( "distance_threshold", 8.0 ) );
53  neighbor_cutoff( tag->getOption< core::Size >( "neighbor_cutoff", 10 ));
54  bound( tag->getOption< bool >( "bound", false ) );
55  resnum( tag->getOption< core::Size >( "resnum", 0 ) );
56  jump( tag->getOption< core::Size >( "jump", 1 ) );
57 
58  TR<<"jump: "<<jump()<<" distance_threshold: "<<distance_threshold()<<" neighbor_cutoff: "<<neighbor_cutoff()<<" bound: "<<bound()<<" resnum: "<<resnum()<<std::endl;
59 }
60 
61 bool
63  compute( pose );
64  return( true );
65 }
66 
67 void
68 NonSequentialNeighborsFilter::report( std::ostream &, core::pose::Pose const & pose ) const {
69  compute( pose );
70 }
71 
74  return( compute( pose ) );
75 }
76 
79  core::Size count_neighbors = 0;
80  core::Size const target_chain( pose.chain( resi ) );
81  for( core::Size resj = pose.conformation().chain_begin( target_chain ); resj <= pose.conformation().chain_end( target_chain ); ++resj ){
82  if( resj >= resi - neighbor_cutoff() && resj <= resi + neighbor_cutoff() )
83  continue;
84  core::Real const distance( pose.residue( resi ).xyz( pose.residue( resi ).nbr_atom() ).distance( pose.residue( resj ).xyz( pose.residue( resj ).nbr_atom() ) ) );
85  if( distance <= distance_threshold() )
86  count_neighbors++;
87  }
88  return( count_neighbors );
89 }
90 
93  core::pose::Pose const & pose
94 ) const {
95  core::pose::Pose copy_pose( pose );
96 
97  if( !bound() ){
98  protocols::rigid::RigidBodyTransMover rbtm( copy_pose, jump() );
99  rbtm.step_size( 10000.0 );
100  rbtm.apply( copy_pose );
101  TR.Debug<<"Unbound complex"<<std::endl;
102  }
103  if( resnum() == 0 ){// working on entire protein
104  for( core::Size resi = 1; resi <= pose.total_residue(); ++resi ){
105  core::Size const count_neighbors( residue_neighbors( copy_pose, resi ) );
106  TR.Debug<<"neighbors of residue "<<resi<<": "<<count_neighbors<<std::endl;
107  }// for resi
108  return 1.0; // dummy return
109  }// fi resnum==0
110  core::Size const count_neighbors( residue_neighbors( copy_pose, resnum() ) );
111  TR.Debug<<"neighbors of residue "<<resnum()<<": "<<count_neighbors<<std::endl;
112  return( count_neighbors );
113 }
114 
115 }
116 }