Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SeparateDnaFromNonDna.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 /// @author ashworth
11 
12 // Unit headers
15 
18 #include <core/pose/PDBInfo.hh>
19 // note: Pose.hh includes Conformation.hh, FoldTree.hh, Jump.hh, and ResidueType.hh
20 #include <core/pose/Pose.hh>
21 #include <basic/Tracer.hh>
22 
23 #include <utility/vector0.hh>
24 #include <utility/vector1.hh>
25 
26 
27 namespace protocols {
28 namespace dna {
29 
30 using utility::vector1;
31 using namespace core;
32 using namespace chemical;
33 using namespace kinematics;
34 using namespace conformation;
35 
36 static basic::Tracer TR( "protocols.dna.SeparateDnaFromNonDna", basic::t_info );
37 
40 {
42 }
43 
46  return new SeparateDnaFromNonDna;
47 }
48 
51 {
52  return "SeparateDnaFromNonDna";
53 }
54 
56  : Mover( SeparateDnaFromNonDnaCreator::mover_name() ),
57  translation_( 1000, 0, 0 )
58 {}
59 
61  : Mover( SeparateDnaFromNonDnaCreator::mover_name() ),
62  translation_( x, y, z )
63 {}
64 
66  : Mover( SeparateDnaFromNonDnaCreator::mover_name() ),
67  translation_( xyz )
68 {}
69 
71  //utility::pointer::ReferenceCount(),
72  Mover( other ),
73  translation_( other.translation() )
74 {}
75 
77 
78 /// @brief set up an appropriate fold tree for a non-DNA/DNA interface, and simply pull apart non-DNA and DNA
79 /// @details addition fold-tree considerations will have to be made if there are any 'non-DNA' chains that should stick to the DNA instead of to the non-DNA group
80 void
82 {
83  TR << "old fold tree:\n" << pose.fold_tree() << std::endl;
84 
85  // construct a new fold tree that links non-DNA chains together, then DNA chains together, then links non-DNA group to DNA group by a single jump
86  FoldTree fold_tree( pose.total_residue() );
87 
88  // collect non-DNA and DNA chain indices
89  vector1< Size > non_DNA_chain_indices, DNA_chain_indices;
90  Conformation const & conf( pose.conformation() );
91  for ( Size chain_index(1); chain_index <= conf.num_chains(); ++chain_index ) {
92  if ( pose.residue_type( conf.chain_begin( chain_index ) ).is_DNA() ) {
93  DNA_chain_indices.push_back( chain_index );
94  TR << "chain " << chain_index << " is a DNA chain" << '\n';
95  } else {
96  non_DNA_chain_indices.push_back( chain_index );
97  TR << "chain " << chain_index << " is a non-DNA chain" << '\n';
98  }
99  // manually add continuous segment edges
100  // NO! FoldTree will attempt to do this on its own, and this will create duplications that will cause assertion/runtime failures
101 // fold_tree.add_edge( conf.chain_begin( chain_index ), conf.chain_end( chain_index ), Edge::PEPTIDE );
102  }
103 
104  // connect non-DNA chains
105  Size const first_nonDNA_chain( non_DNA_chain_indices.front() );
106  Size const nonDNA_anchor_index( conf.chain_begin( first_nonDNA_chain ) );
107  for ( vector1< Size >::const_iterator chain_iter( non_DNA_chain_indices.begin()+1 );
108  chain_iter != non_DNA_chain_indices.end(); ++chain_iter ) {
109  Size const chain_begin( conf.chain_begin( *chain_iter ) );
110 
111  TR << "linking non-DNA chains " << first_nonDNA_chain << " and " << *chain_iter
112  << " residues " << nonDNA_anchor_index << " (";
113  if ( pose.pdb_info() ) {
114  TR << pose.pdb_info()->number( nonDNA_anchor_index ) << ") and "
115  << chain_begin << " (" << pose.pdb_info()->number( chain_begin );
116  } else {
117  TR << nonDNA_anchor_index << ") and " << chain_begin << " (" << chain_begin;
118  }
119  TR << ") with a jump" << '\n';
120 
121  fold_tree.new_jump( nonDNA_anchor_index, chain_begin, chain_begin-1 );
122 
123  }
124 
125  // connect DNA chains
126  Size const first_DNA_chain( DNA_chain_indices.front() );
127  Size const DNA_anchor_index( conf.chain_begin( first_DNA_chain ) );
128  for ( vector1< Size >::const_iterator chain_iter( DNA_chain_indices.begin()+1 );
129  chain_iter != DNA_chain_indices.end(); ++chain_iter ) {
130  Size const chain_begin( conf.chain_begin( *chain_iter ) );
131 
132  TR << "linking DNA chains " << first_DNA_chain << " and " << *chain_iter << " residues " << DNA_anchor_index << " (";
133  if ( pose.pdb_info() ) {
134  TR << pose.pdb_info()->number( DNA_anchor_index ) << ") and "
135  << chain_begin << " (" << pose.pdb_info()->number( chain_begin );
136  } else {
137  TR << DNA_anchor_index << ") and " << chain_begin << " (" << chain_begin;
138  }
139  TR << ") with a jump" << '\n';
140 
141  fold_tree.new_jump( DNA_anchor_index, chain_begin, chain_begin-1 );
142  }
143 
144  // connect non-DNA to DNA with a single jump
145  TR << "linking non-DNA chain group to DNA chain group by jump between non-DNA chain "
146  << first_nonDNA_chain << " and DNA chain " << first_DNA_chain << " residues "
147  << nonDNA_anchor_index << " (";
148  if ( pose.pdb_info() ) {
149  TR << pose.pdb_info()->number( nonDNA_anchor_index ) << ") and "
150  << DNA_anchor_index << " (" << pose.pdb_info()->number( DNA_anchor_index );
151  } else {
152  TR << nonDNA_anchor_index << ") and " << DNA_anchor_index << " (" << DNA_anchor_index;
153  }
154  TR << ")" << '\n';
155 
156  // make sure that this jump goes in the 'forward' direction, in case the DNA chains came first
157  Size const jump_start( std::min( nonDNA_anchor_index, DNA_anchor_index ) ),
158  jump_end( std::max( nonDNA_anchor_index, DNA_anchor_index ) );
159  fold_tree.new_jump( jump_start, jump_end, jump_end-1 );
160 
161  // set the new fold tree
162  pose.fold_tree( fold_tree );
163  TR << "new fold tree:\n" << pose.fold_tree() << std::endl;
164 
165  // lengthen the final jump to isolate non-DNA from DNA
166  Size const prot_DNA_jump_index( pose.num_jump() );
167  Jump prot_DNA_jump( pose.jump( prot_DNA_jump_index ) );
168  prot_DNA_jump.set_translation( translation_ );
169  TR << std::fixed << std::setprecision(0);
170  TR << "separating non-DNA chains from DNA chains by translation ("
171  << translation_.x() << "," << translation_.y() << "," << translation_.z() << ")" << '\n';
172  pose.set_jump( prot_DNA_jump_index, prot_DNA_jump );
173  TR.flush();
174 }
175 
179 }
180 
181 ///@brief parse XML (specifically in the context of the parser/scripting scheme)
183  TagPtr const,
184  moves::DataMap &,
186  moves::Movers_map const &,
187  Pose const &
188 )
189 {}
190 
191 ///@brief required in the context of the parser/scripting scheme
194 {
195  return new SeparateDnaFromNonDna;
196 }
197 
198 ///@brief required in the context of the parser/scripting scheme
201 {
202  return new SeparateDnaFromNonDna( *this );
203 }
204 
205 } // dna
206 } // protocols