Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
rna_database.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 
13 
14 // libRosetta headers
15 #include <core/types.hh>
16 #include <core/chemical/AA.hh>
17 #include <core/conformation/Residue.hh>
18 #include <core/chemical/ChemicalManager.hh>
19 #include <core/io/silent/SilentFileData.hh>
20 #include <core/io/silent/BinarySilentStruct.hh>
21 #include <core/scoring/Energies.hh>
22 #include <core/scoring/ScoreFunction.hh>
23 #include <core/scoring/ScoreFunctionFactory.hh>
24 #include <core/chemical/rna/util.hh>
25 #include <core/scoring/rna/RNA_ScoringInfo.hh>
26 #include <core/scoring/constraints/ConstraintSet.fwd.hh>
27 #include <basic/options/option.hh>
29 #include <protocols/viewer/viewers.hh>
30 #include <protocols/stepwise/modeler/util.hh>
31 #include <protocols/stepwise/setup/util.hh>
32 #include <core/pose/Pose.hh>
33 #include <core/pose/util.hh>
34 #include <core/pose/rna/util.hh>
35 #include <core/pose/rna/RNA_BasePairClassifier.hh>
36 #include <core/pose/PDBInfo.hh>
37 #include <core/init/init.hh>
38 
39 #include <core/io/pdb/pose_io.hh>
40 
41 #include <utility/vector1.hh>
43 #include <utility/io/ozstream.hh>
45 
46 #include <numeric/conversions.hh>
47 
49 #include <ObjexxFCL/format.hh>
50 
51 //RNA stuff.
52 #include <protocols/farna/util.hh>
53 #include <protocols/farna/libraries/BasePairStepLibrary.hh>
54 
55 
56 // C++ headers
57 #include <fstream>
58 #include <iostream>
59 #include <string>
60 
61 
62 // option key includes
63 
64 #include <basic/options/keys/out.OptionKeys.gen.hh>
65 #include <basic/options/keys/in.OptionKeys.gen.hh>
66 #include <basic/options/keys/rna.OptionKeys.gen.hh>
67 
68 #include <core/import_pose/import_pose.hh>
69 #include <core/kinematics/Jump.hh>
70 #include <numeric/xyz.functions.hh>
71 #include <ObjexxFCL/format.hh>
72 
73 //Auto Headers
74 #include <core/scoring/EnergyGraph.hh>
75 
77 using namespace ObjexxFCL::format;
78 using namespace core;
79 using namespace core::pose::rna;
80 using namespace protocols;
81 using namespace basic::options::OptionKeys;
82 using utility::vector1;
83 using io::pdb::dump_pdb;
84 using protocols::farna::libraries::MAX_BULGE_LENGTH;
85 
87 
88 //Definition of new OptionKeys
89 // these will be available in the top-level OptionKey namespace:
90 // i.e., OPT_KEY( Type, key ) --> OptionKey::key
91 // to have them in a namespace use OPT_1GRP_KEY( Type, grp, key ) --> OptionKey::grp::key
92 OPT_KEY( IntegerVector, exclude_res )
93 OPT_KEY( Boolean, general_bps )
94 OPT_KEY( Boolean, use_lores_base_pair_classification )
95 
96 ///////////////////////////////////////////////////////////////////////////////
97 void
99 
100  using namespace basic::options;
101  using namespace basic::options::OptionKeys;
102  using namespace core::chemical;
103 
104  ResidueTypeSetCOP rsd_set;
105  rsd_set = core::chemical::ChemicalManager::get_instance()->residue_type_set( FA_STANDARD );
106 
108  std::string outfile = option[ basic::options::OptionKeys::rna::farna::vall_torsions ]();
109  utility::vector1< core::Size > const exclude_res_list = option[exclude_res]();
110 
111  if ( option[ out::file::o ].user() ) outfile = option[ out::file::o ](); // old syntax -- should deprecate.
112 
113  utility::io::ozstream torsions_out( outfile );
114 
115  for ( Size n = 1; n <= infiles.size(); n++ ) {
117  core::import_pose::pose_from_pdb( pose, *rsd_set, infiles[n] );
118  /////////////////////////////////////////
119  protocols::farna::make_phosphate_nomenclature_matches_mini( pose );
120  /////////////////////////////////////////
121 
122  protocols::farna::create_rna_vall_torsions( pose, torsions_out, exclude_res_list );
123 
124  std::cout << "***********************************************************" << std::endl;
125  std::cout << "Put torsions from PDB file " << infiles[n] << " into " << outfile << std::endl;
126  std::cout << "***********************************************************" << std::endl;
127 
128  }
129 
130 
131 }
132 
133 ////////////////////////////////////////////////////////////////////////////////////
134 bool
136  Vector const & atom_j, Vector const dir_vector,
137  char & edge_i, char & orientation )
138 {
139  static Real const CONTACT_CUTOFF2( 3.0 * 3.0 );
140 
141  scoring::rna::RNA_ScoringInfo & rna_scoring_info( scoring::rna::nonconst_rna_scoring_info_from_pose( pose ) );
142  scoring::rna::RNA_CentroidInfo & rna_centroid_info( rna_scoring_info.rna_centroid_info() );
143  utility::vector1< Vector > const & base_centroids( rna_centroid_info.base_centroids() );
144  utility::vector1< kinematics::Stub > const & base_stubs( rna_centroid_info.base_stubs() );
145 
146  //Figure out jump.
147  conformation::Residue const & rsd_i( pose.residue( i ) );
148 
149  bool found_contact( false );
150  for ( Size ii=rsd_i.first_sidechain_atom()+1 ; ii<= rsd_i.nheavyatoms(); ++ii ) {
151  // if ( rsd_i.atom_name( ii ) == " O2'" ) continue;
152  Real const dist2( (rsd_i.xyz( ii ) - atom_j ).length_squared() ) ;
153  if ( dist2 < CONTACT_CUTOFF2 ) {
154  // std::cout << dist2 << " " << i << " " << rsd_i.atom_name( ii ) << std::endl;
155  found_contact = true;
156  break;
157  }
158  }
159 
160  if ( !found_contact ) return false;
161 
162  Vector const & centroid_i( base_centroids[i] );
163  kinematics::Stub const & stub_i( base_stubs[i] );
164  Matrix const & M_i( stub_i.M );
165  Vector const & x_i = M_i.col_x();
166  Vector const & y_i = M_i.col_y();
167  Vector const & z_i = M_i.col_z();
168 
169  Vector d_ij = atom_j - centroid_i;
170  Real const dist_x = dot_product( d_ij, x_i );
171  Real const dist_y = dot_product( d_ij, y_i );
172  // Real const dist_z = dot_product( d_ij, z_i );
173  // Real const rho2 = dist_x*dist_x + dist_y*dist_y;
174 
175  Real const zeta = numeric::conversions::degrees( std::atan2( dist_y, dist_x) );
176  if ( std::abs(zeta) < 60.0 ) edge_i = 'W'; //Watson-Crick edge
177  else if ( zeta > +60.0 ) edge_i = 'H'; // Hoogsteen edge
178  else edge_i = 'S'; // Sugar edge
179 
180  orientation = dot( dir_vector, z_i ) > 0 ? 'A' : 'P';
181 
182  return true;
183 }
184 
185 /////////////////////////////////////////////////////////////////////////////////
186 void
188  utility::io::ozstream & dataout ){
189 
190  char edge_i, orientation;
191 
192  conformation::Residue const & rsd_i( pose.residue( i ) );
193  conformation::Residue const & rsd_j( pose.residue( j ) );
194 
195  std::string const atom_name = " O2'";
196  Vector const atom_vector = rsd_j.xyz( atom_name );
197  Vector const dir_vector = rsd_j.xyz( " O2'" ) - rsd_j.xyz( " C2'" );
198  if ( !check_for_contacts( pose, i, atom_vector, dir_vector, edge_i, orientation) ) return;
199 
200  char const edge_j = '2';
201 
202  kinematics::Stub const stub1( rsd_i.xyz( rsd_i.chi_atoms(1)[4] ),
203  rsd_i.xyz( rsd_i.chi_atoms(1)[3] ),
204  rsd_i.xyz( rsd_i.chi_atoms(1)[2] ) );
205 
206  kinematics::Stub const stub2( rsd_j.xyz( atom_name ),
207  rsd_j.xyz( " C2'" ),
208  rsd_j.xyz( " C3'" ) );
209 
210  dataout << "PAIR " <<
211  I(5, i) << ' ' << edge_i << ' ' <<
212  I(5, j) << ' ' << edge_j << " " <<
213  orientation << " " <<
214  pose.residue(i).name1() << ' ' << pose.residue(j).name1() << " " <<
215  rsd_i.atom_name( rsd_i.chi_atoms(1)[4] ) << " " <<
216  atom_name << " " <<
217  kinematics::Jump( stub1, stub2) <<
218  std::endl;
219 
220 }
221 
222 
223 /////////////////////////////////////////////////////////////////////////////////
224 void
226  utility::io::ozstream & dataout ){
227 
228  char edge_i, orientation;
229 
230  conformation::Residue const & rsd_i( pose.residue( i ) );
231  conformation::Residue const & rsd_j( pose.residue( j ) );
232  conformation::Residue const & prev_rsd( pose.residue( j-1 ) );
233 
234 
235  Vector dir_vector = cross( rsd_j.xyz( " OP1" ) - rsd_j.xyz( " P " ),
236  rsd_j.xyz( " OP2" ) - rsd_j.xyz( " P " ) );
237 
238  std::string atom_name = " OP2";
239  Vector atom_vector = rsd_j.xyz( atom_name );
240  if ( !check_for_contacts( pose, i, atom_vector, dir_vector, edge_i, orientation) ) {
241  atom_name = " OP1";
242  atom_vector = rsd_j.xyz( atom_name );
243  if ( !check_for_contacts( pose, i, atom_vector, dir_vector, edge_i, orientation) ) return;
244  }
245 
246 
247  char const edge_j = 'P';
248 
249  kinematics::Stub const stub1( rsd_i.xyz( rsd_i.chi_atoms(1)[4] ),
250  rsd_i.xyz( rsd_i.chi_atoms(1)[3] ),
251  rsd_i.xyz( rsd_i.chi_atoms(1)[2] ) );
252 
253  kinematics::Stub const stub2_fwd( rsd_j.xyz( atom_name ),
254  rsd_j.xyz( " P " ),
255  prev_rsd.xyz( " O3'" ) );
256 
257  kinematics::Stub const stub2_back( rsd_j.xyz( atom_name ),
258  rsd_j.xyz( " P " ),
259  rsd_j.xyz( " O5'" ) );
260 
261  dataout << "PAIR " <<
262  I(5, i) << ' ' << edge_i << ' ' <<
263  I(5, j) << ' ' << edge_j << " " <<
264  orientation << " " <<
265  pose.residue(i).name1() << ' ' << pose.residue(j).name1() << " " <<
266  rsd_i.atom_name( rsd_i.chi_atoms(1)[4] ) << " " <<
267  atom_name << " " <<
268  kinematics::Jump( stub1, stub2_fwd ) <<
269  kinematics::Jump( stub1, stub2_back ) <<
270  std::endl;
271 
272 }
273 
274 //////////////////////////////////////////////////////////////////////////////////////
275 // JUMP extractor.
276 void
278 
279  using namespace chemical;
280  using namespace core::scoring;
281  using namespace core::scoring::rna;
282  using namespace basic::options;
283  using namespace basic::options::OptionKeys;
284  using namespace protocols::farna;
285 
286  utility::vector1< core::Size > const exclude_res_list = option[exclude_res]();
287 
288  ResidueTypeSetCOP rsd_set;
289  rsd_set = core::chemical::ChemicalManager::get_instance()->residue_type_set( FA_STANDARD );
290 
291  std::string infile = option[ in::file::s ][1];
292  std::string outfile = option[ out::file::o ];
293 
295  core::import_pose::pose_from_pdb( pose, *rsd_set, infile );
296  make_phosphate_nomenclature_matches_mini( pose );
297 
298  // core::pose::rna::figure_out_reasonable_rna_fold_tree( pose );
299 
300  // Fill base pairing information... these are
301  // all functions used in scoring... see RNA_BaseBaseEnergy.cc
302  ScoreFunctionOP lores_scorefxn = ScoreFunctionFactory::create_score_function( RNA_LORES_WTS );
303  (*lores_scorefxn)( pose );
304  lores_scorefxn->show( std::cout, pose );
305 
306  RNA_ScoringInfo const & rna_scoring_info( rna_scoring_info_from_pose( pose ) );
307  RNA_FilteredBaseBaseInfo const & rna_filtered_base_base_info( rna_scoring_info.rna_filtered_base_base_info() );
308  EnergyBasePairList scored_base_pair_list( rna_filtered_base_base_info.scored_base_pair_list() );
309 
310  utility::io::ozstream dataout( outfile );
311 
312  for ( EnergyBasePairList::const_iterator it = scored_base_pair_list.begin();
313  it != scored_base_pair_list.end(); ++it ) {
314 
315  BasePair const base_pair = it->second;
316 
317  int const i = base_pair.res1();
318  int const k = base_pair.edge1();
319 
320  int const j = base_pair.res2();
321  int const m = base_pair.edge2();
322 
323  if ( is_num_in_list(i, exclude_res_list) || is_num_in_list(j, exclude_res_list) ) {
324  continue;
325  }
326 
327  char const orientation = ( base_pair.orientation() == 1) ? 'A' : 'P';
328 
329  char const edge_i = core::chemical::rna::get_edge_from_num( k );
330  char const edge_j = core::chemical::rna::get_edge_from_num( m );
331 
332  //Figure out jump.
333  conformation::Residue const & rsd_i( pose.residue( i ) );
334  conformation::Residue const & rsd_j( pose.residue( j ) );
335  kinematics::Stub const stub_i( rsd_i.xyz( rsd_i.chi_atoms(1)[4] ),
336  rsd_i.xyz( rsd_i.chi_atoms(1)[3] ),
337  rsd_i.xyz( rsd_i.chi_atoms(1)[2] ) );
338  kinematics::Stub const stub_j( rsd_j.xyz( rsd_j.chi_atoms(1)[4] ),
339  rsd_j.xyz( rsd_j.chi_atoms(1)[3] ),
340  rsd_j.xyz( rsd_j.chi_atoms(1)[2] ) );
341 
342  dataout << "PAIR " <<
343  I(5, i) << ' ' << edge_i << ' ' <<
344  I(5, j) << ' ' << edge_j << " " <<
345  orientation << " " <<
346  pose.residue(i).name1() << ' ' << pose.residue(j).name1() << " " <<
347  rsd_i.atom_name( rsd_i.chi_atoms(1)[4] ) << " " <<
348  rsd_j.atom_name( rsd_j.chi_atoms(1)[4] ) << " " <<
349  kinematics::Jump( stub_i, stub_j) <<
350  std::endl;
351 
352  }
353 
354  //How about 2' and Phosphate jumps?
355  // Look at each base.
356  core::scoring::EnergyGraph const & energy_graph( pose.energies().energy_graph() );
357  for ( Size i = 1; i <= pose.total_residue(); i++ ) {
358 
359  // Neighboring residues making base-phosphate or base-2'OH contacts?
360  for ( graph::Graph::EdgeListConstIter
361  iru = energy_graph.get_node(i)->const_edge_list_begin(),
362  irue = energy_graph.get_node(i)->const_edge_list_end();
363  iru != irue; ++iru ) {
364  EnergyEdge const * edge( static_cast< EnergyEdge const *> ( *iru ) );
365  Size const j( edge->get_other_ind(i) );
366 
367  if ( is_num_in_list(i, exclude_res_list) || is_num_in_list(j, exclude_res_list) ) {
368  continue;
369  }
370 
371  // EnergyGraph const & energy_graph( pose.energies().energy_graph() );
372 
374 
375  if ( j > 1 ) check_for_contacts_and_output_jump_phosphate( pose, i, j, dataout );
376 
377  }
378  }
379 
380 
381  dataout.close();
382 
383  std::cout << "***********************************************************" << std::endl;
384  std::cout << "Put jumps from PDB file " << infile << " into " << outfile << std::endl;
385  std::cout << "***********************************************************" << std::endl;
386 
387 }
388 
389 ///////////////////////////////////////////////////////////////
390 std::string
391 get_bps_seq( utility::vector1< Size > const & base_pair_res, std::string const & sequence ){
392  runtime_assert( base_pair_res.size() == 4 );
393 
394  std::string bps_seq;
395  bps_seq += sequence[ base_pair_res[1]-1 ];
396  bps_seq += sequence[ base_pair_res[2]-1 ];
397 
398  bps_seq += "_";
399 
400  bps_seq += sequence[ base_pair_res[3]-1 ];
401  int seq_sep = int( base_pair_res[ 4 ] ) - int( base_pair_res[ 3 ] );
402  if ( seq_sep > 0 && seq_sep <= (MAX_BULGE_LENGTH+1) ) {
403  for ( Size i = base_pair_res[3]+1; i < base_pair_res[4]; i++ ) bps_seq += 'n'; // bulge
404  } else {
405  bps_seq += "x"; // greater than 3 nts, or possibly different chain
406  }
407  bps_seq += sequence[ base_pair_res[4]-1 ];
408 
409  return bps_seq;
410 }
411 
412 ///////////////////////////////////////////////////////////
413 std::string
414 get_bps_tag( utility::vector1< Size > const & base_pair_res, std::string const & infile, pose::Pose const & pose ){
415 
416  using namespace ObjexxFCL::format;
417 
418  pose::PDBInfoCOP pdb_info = pose.pdb_info();
419 
420  std::stringstream pdb_tag_stream;
421  pdb_tag_stream << infile;
422  for ( Size n = 1; n <= base_pair_res.size(); n++ ) {
423  pdb_tag_stream << "_";
424  pdb_tag_stream << pdb_info->chain( base_pair_res[1] ) << pdb_info->number( base_pair_res[n] );
425  }
426 
427  return pdb_tag_stream.str();
428 }
429 
430 
431 
432 ///////////////////////////////////////////////////////////
433 std::string
434 get_bps_sub_dir( int const seq_sep ){
435  if ( seq_sep == 1 ) {
436  return "standard/";
437  } else if ( seq_sep >= 2 && seq_sep <= (MAX_BULGE_LENGTH+1) ) {
438  return "bulge_"+ObjexxFCL::format::I( 1, seq_sep - 1 )+"nt/";
439  } else {
440  return "long_distance/";
441  }
442 }
443 
444 
445 ///////////////////////////////////////////////////////////
446 std::string
447 get_bps_sub_dir( utility::vector1< Size > const & base_pair_res ){
448  int seq_sep = int( base_pair_res[ 4 ] ) - int( base_pair_res[ 3 ] );
449  return get_bps_sub_dir( seq_sep );
450 }
451 
452 ///////////////////////////////////////////////////////////////
453 void
455  utility::vector1< int > base_pair_res,
456  std::string const & intag,
457  bool const use_sub_directories = true )
458 {
459  using namespace core::io::silent;
460  static SilentFileData silent_file_data;
461 
462  pose::Pose bps_pose;
463  core::pose::pdbslice( bps_pose, pose, base_pair_res );
464 
465  std::string bps_seq = get_bps_seq( base_pair_res, pose.sequence() );
466  std::string bps_tag = get_bps_tag( base_pair_res, intag, pose );
467 
468  std::cout << "Found base pair step! " << bps_seq << " " << bps_tag << std::endl;
469 
470  std::string bps_sub_dir;
471  if ( use_sub_directories ) {
472  bps_sub_dir = get_bps_sub_dir( base_pair_res );
473  if ( !utility::file::file_exists( bps_sub_dir ) ) utility::file::create_directory_recursive( bps_sub_dir );
474  }
475  std::string const silent_file = bps_sub_dir + bps_seq + ".out";
476  BinarySilentStruct s( bps_pose, bps_tag );
477  silent_file_data.write_silent_struct( s, silent_file, false /* score_only */ );
478 }
479 
480 ///////////////////////////////////////////////////////////////
481 void
483  std::string const & intag )
484 {
485  utility::vector1< int > const base_pair_res = utility::tools::make_vector1( i, i+1, j-1, j);
486  write_base_pair_step_to_silent_struct( pose, base_pair_res, intag, false /* use_sub_directories */ );
487 }
488 
489 ///////////////////////////////////////////////////////////////
490 // Following just gets Watson-Crick and G*U pairs
491 void
493  std::string const & intag )
494 {
495  std::map< Size, Size > partner;
496  protocols::farna::figure_out_base_pair_partner( pose, partner, false );
497 
498  for ( std::map< Size, Size >::const_iterator it = partner.begin();
499  it != partner.end(); ++it ) {
500 
501  Size const i = it->first;
502  Size const j = it->second;
503 
504  if ( i < pose.total_residue() &&
505  partner.find( i+1 ) != partner.end() && j > 1 && partner[ i+1 ] == j-1 &&
506  !pose.fold_tree().is_cutpoint(i) && !pose.fold_tree().is_cutpoint(j-1) ) {
507 
508  write_base_pair_step_to_silent_struct( pose, i, j, intag );
509 
510  }
511  }
512 
513 }
514 
515 ///////////////////////////////////////////////////////////////
516 // Following outputs all base pair steps (including neighboring non-canonicals)
517 void
519  std::string const & intag )
520 {
521 
523  if ( basic::options::option[ use_lores_base_pair_classification ]() ) {
524  base_pair_list= protocols::farna::classify_base_pairs_lores( pose );
525  } else {
526  base_pair_list= classify_base_pairs( pose );
527  }
528 
529  std::map< std::pair< Size, Size >, bool > partnered;
530  for ( Size n = 1; n <= base_pair_list.size(); n++ ) {
531 
532  BasePair const base_pair = base_pair_list[ n ];
533 
534  Size const i = base_pair.res1();
535  Size const j = base_pair.res2();
536 
537  runtime_assert( pose.residue( i ).is_RNA() );
538  runtime_assert( pose.residue( j ).is_RNA() );
539 
540  partnered[ std::make_pair( i, j ) ] = true;
541  partnered[ std::make_pair( j, i ) ] = true;
542  }
543 
544  for ( Size i = 1; i < pose.total_residue(); i++ ) {
545  for ( Size j = 1; j <= pose.total_residue(); j++ ) {
546 
547  if ( partnered[ std::make_pair( i, j ) ] ) {
548 
549  vector1< bool > outputted_bps( pose.total_residue(), false );
550 
551  // Looking for i+1 to also base pair to something.
552  // base-pair-step, and then bulges: single, double, triple
553  for ( int n = 0; n <= MAX_BULGE_LENGTH; n++ ) {
554 
555  if ( int(j) > (n+1) && std::abs( int(i) - int(j) ) > (int(n)+1) &&
556  partnered[ std::make_pair( i+1, j-n-1 ) ] &&
557  !pose.fold_tree().is_cutpoint( i ) ) {
558 
559  bool found_cut( false );
560  for ( int q = 1; q <= n+1; q++ ) {
561  if ( pose.fold_tree().is_cutpoint( j-q ) ) {
562  found_cut = true;
563  }
564  }
565  if ( found_cut ) continue;
566 
567  write_base_pair_step_to_silent_struct( pose, utility::tools::make_vector1( i, i+1, j-n-1, j), intag, true /*create subdir*/ );
568 
569  outputted_bps[ j-n-1 ] = true;
570 
571  }
572  }
573 
574 
575  // scan for adjacent base pair that has one partner distant in sequence; may even involve totally different chain!
576  for ( Size k = 1; k <= pose.total_residue(); k++ ) {
577  if ( outputted_bps[ k ] ) continue;
578  if ( partnered[ std::make_pair( i+1, k ) ] ) {
579  write_base_pair_step_to_silent_struct( pose, utility::tools::make_vector1( i, i+1, k, j), intag, true /*create subdir*/ );
580  }
581  }
582 
583  }
584 
585  }
586  }
587 
588 }
589 
590 
591 ///////////////////////////////////////////////////////////////
592 void
594 
595  using namespace chemical;
596  using namespace core::scoring;
597  using namespace core::scoring::rna;
598  using namespace basic::options;
599  using namespace basic::options::OptionKeys;
600  using namespace protocols::farna;
601  using namespace protocols::stepwise;
602 
603  utility::vector1< core::Size > const exclude_res_list = option[exclude_res]();
604 
605  ResidueTypeSetCOP rsd_set;
606  rsd_set = core::chemical::ChemicalManager::get_instance()->residue_type_set( FA_STANDARD );
607 
608  utility::vector1< std::string > const infiles = setup::load_s_and_l();
609 
610  for ( Size n = 1; n <= infiles.size(); n++ ) {
611  std::string const & infile = infiles[ n ];
612 
613  std::string intag = infile;
614  Size pos( intag.find( ".pdb" ) );
615  intag.replace( pos, 4, "" );
616 
618  core::import_pose::pose_from_pdb( pose, *rsd_set, std::string( option[ in::path::pdb ](1) ) + infile );
619  core::pose::rna::figure_out_reasonable_rna_fold_tree( pose );
620  std::string const sequence = pose.sequence();
621 
622  if ( option[ general_bps ]() ) {
623  output_general_base_pair_steps( pose, intag );
624  } else {
625  output_canonical_base_pair_steps( pose, intag );
626  }
627 
628  std::cout << "***********************************************************" << std::endl;
629  std::cout << "Put base pair steps from " << infile << " into .out files" << std::endl;
630  std::cout << "***********************************************************" << std::endl;
631 
632  }
633 
634 
635 }
636 
637 
638 ///////////////////////////////////////////////////////////////
639 void*
640 my_main( void* )
641 {
642  using namespace basic::options;
643  using namespace basic::options::OptionKeys::rna::farna;
644  using namespace basic::options::OptionKeys::rna::farna::db;
645 
646  if ( option[ jump_database ] ) {
648  } else if ( option[ vall_torsions ].user() ) {
650  } else if ( option[ bps_database ]() ) {
652  } else {
653  std::cout << std::endl;
654  std::cout << "Please specify: " << std::endl;
655  std::cout << " -vall_torsions for generating torsions library " << std::endl;
656  std::cout << " -jump_database for generating database of rigid-body orientations " << std::endl;
657  std::cout << " -bps_database for generating database of Watson-Crick base pair steps " << std::endl;
658  std::cout << std::endl;
659  }
660 
661  exit( 0 );
662 }
663 
664 
665 ///////////////////////////////////////////////////////////////////////////////
666 int
667 main( int argc, char * argv [] )
668 {
669  try {
670  using namespace basic::options;
671  utility::vector1< Size > blank_size_vector;
672 
673 
674  std::cout << std::endl << "Basic usage: " << argv[0] << " -s <pdb1> [... <more pdbs>] -vall_torsions [name of output torsions file to create] " << std::endl;
675  std::cout << " " << argv[0] << " -s <pdb1> [... <more pdbs>] -jump_database [name of rigid-body orientation database to create] " << std::endl;
676  std::cout << std::endl << " Type -help for full slate of options." << std::endl << std::endl;
677 
678  NEW_OPT( exclude_res, "Residues excluded for database creation (works for one file only)", blank_size_vector );
679  NEW_OPT( general_bps, "For bps_database, output base pair steps involving noncanonicals", false );
680  NEW_OPT( use_lores_base_pair_classification, "Use loose base-pair classifier (same as used in FARNA)", false );
681  option.add_relevant( basic::options::OptionKeys::rna::farna::vall_torsions );
682  option.add_relevant( basic::options::OptionKeys::rna::farna::db::jump_database );
683  option.add_relevant( basic::options::OptionKeys::rna::farna::db::bps_database );
684 
685  ////////////////////////////////////////////////////////////////////////////
686  // setup
687  ////////////////////////////////////////////////////////////////////////////
688  core::init::init(argc, argv);
689 
690 
691  ////////////////////////////////////////////////////////////////////////////
692  // end of setup
693  ////////////////////////////////////////////////////////////////////////////
694 
695  protocols::viewer::viewer_main( my_main );
696  } catch ( utility::excn::EXCN_Base const & e ) {
697  std::cout << "caught exception " << e.msg() << std::endl;
698  return -1;
699  }
700 }
virtual std::string const msg() const
Definition: EXCN_Base.hh:70
utility::keys::KeyLookup< KeyType >::const_iterator const_iterator
Key collection iterators.
Vector col_y() const
Column y.
Definition: xyzMatrix.hh:1306
def partner
Definition: PDBInfo.py:64
bool check_for_contacts(pose::Pose &pose, Size const i, Vector const &atom_j, Vector const dir_vector, char &edge_i, char &orientation)
BooleanOptionKey const user("options:user")
Definition: OptionKeys.hh:40
void create_rna_vall_torsions_test()
Definition: rna_database.cc:98
core::pose::Pose Pose
Definition: supercharge.cc:101
void check_for_contacts_and_output_jump_phosphate(pose::Pose &pose, Size const i, Size const j, utility::io::ozstream &dataout)
Platform independent operations on files (except I/O)
#define runtime_assert(_Expression)
Assert that the condition holds. Evaluated for both debug and release builds.
Definition: exit.hh:63
Conversions between degrees and radians.
std::string get_bps_tag(utility::vector1< Size > const &base_pair_res, std::string const &infile, pose::Pose const &pose)
common derived classes for thrown exceptions
std::string get_bps_sub_dir(int const seq_sep)
void output_general_base_pair_steps(pose::Pose const &pose, std::string const &intag)
xyzVector< Real > Vector
void check_for_contacts_and_output_jump_o2prime(pose::Pose &pose, Size const i, Size const j, utility::io::ozstream &dataout)
Vector col_x() const
Column x.
Definition: xyzMatrix.hh:1287
T abs(T const &x)
std::abs( x ) == | x |
Definition: Fmath.hh:295
std::vector with 1-based indexing
Definition: vector1.fwd.hh:44
numeric::xyzMatrix< Real > Matrix
Definition: rna_database.cc:86
void create_base_pair_step_database_test()
T degrees(T const &radians)
Degrees of radians.
Definition: conversions.hh:80
FArray1D< T > cross(FArray1< T > const &a, FArray1< T > const &b)
Cross Product of Two 3-Tuple Vectors.
Definition: FArray1D.hh:877
bool create_directory_recursive(std::string const &dir_path)
Create a directory and its parent directories if they doesn't already exist.
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
#define OPT_KEY(type, key)
T dot_product(CArray< T > const &a, CArray< T > const &b)
Dot product.
utility::options::OptionCollection option
OptionCollection global.
Definition: option.cc:45
Output file stream wrapper for uncompressed and compressed files.
double Real
Definition: types.hh:39
void create_bp_jump_database_test()
#define NEW_OPT(akey, help, adef)
Vector col_z() const
Column z.
Definition: xyzMatrix.hh:1325
ocstream cout(std::cout)
Wrapper around std::cout.
Definition: ocstream.hh:287
BooleanOptionKey const exit("options:exit")
Definition: OptionKeys.hh:51
vector1: std::vector with 1-based indexing
xyzMatrix: Fast 3x3 xyz matrix template
bool file_exists(std::string const &path)
Does File Exist?
void output_canonical_base_pair_steps(pose::Pose &pose, std::string const &intag)
std::string get_bps_seq(utility::vector1< Size > const &base_pair_res, std::string const &sequence)
ozstream: Output file stream wrapper for uncompressed and compressed files
Definition: ozstream.hh:53
void write_base_pair_step_to_silent_struct(pose::Pose const &pose, utility::vector1< int > base_pair_res, std::string const &intag, bool const use_sub_directories=true)
xyzVector and xyzMatrix functions
T dot(CArray< T > const &a, CArray< T > const &b)
Dot product.
void init()
set global 'init_was_called' to true
Definition: init.cc:26
Program options global and initialization function.
std::string I(int const w, T const &t)
Integer Format.
Definition: format.hh:758
void * my_main(void *)
platform::Size Size
Definition: random.fwd.hh:30
utility::vector1< T > make_vector1(const T i0)
Definition: make_vector1.hh:24
int const silent
Named verbosity levels.
rule< Scanner, option_closure::context_t > option
Definition: Tag.cc:378