Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
rna_cluster.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 Rhiju Das
13 
14 // libRosetta headers
15 #include <core/types.hh>
16 #include <core/sequence/util.hh>
17 #include <basic/options/option.hh>
19 #include <protocols/viewer/viewers.hh>
20 #include <core/init/init.hh>
21 #include <utility/vector1.hh>
23 #include <core/chemical/ChemicalManager.fwd.hh>
24 
25 //RNA stuff -- move this?
26 #include <protocols/stepwise/modeler/align/StepWiseLegacyClustererSilentBased.hh>
27 
28 // C++ headers
29 #include <iostream>
30 #include <string>
31 
32 
33 // option key includes
34 #include <basic/options/option.hh>
35 #include <basic/options/keys/out.OptionKeys.gen.hh>
36 #include <basic/options/keys/in.OptionKeys.gen.hh>
37 #include <basic/options/keys/cluster.OptionKeys.gen.hh>
38 
39 //Auto Headers
40 #include <core/chemical/ResidueType.hh>
42 
43 using namespace protocols;
44 using namespace core;
45 using utility::vector1;
46 
47 
48 //Definition of new OptionKeys
49 // these will be available in the top-level OptionKey namespace:
50 // i.e., OPT_KEY( Type, key ) --> OptionKey::key
51 // to have them in a namespace use OPT_1GRP_KEY( Type, grp, key ) --> OptionKey::grp::key
52 
53 ///////////////////////////////////////////////////////////////////////////////
54 ///////////////////////////////////////////////////////////////
55 void
57 
58  using namespace basic::options;
59  using namespace basic::options::OptionKeys;
60  using namespace basic::options::OptionKeys::cluster;
61 
62 
63  if ( ! option[ in::file::silent ].user() ) utility_exit_with_message( "The rna_cluster executable requires silent input [with -in:file:silent], and models need to be scored. The clustering algorithm starts with the lowest scoring models and works its way up." );
64 
65  utility::vector1< std::string > const silent_files_in( option[ in::file::silent ]() );
66  protocols::stepwise::modeler::align::StepWiseLegacyClustererSilentBased stepwise_clusterer( silent_files_in );
67 
68  Size max_decoys( 400 );
69  if ( option[ out::nstruct].user() ) max_decoys = option[ out::nstruct ];
70  stepwise_clusterer.set_max_decoys( max_decoys );
71 
72 
73  Real cluster_radius ( 2.0 );
74  if ( option[ OptionKeys::cluster::radius ].user() ) cluster_radius = option[ OptionKeys::cluster::radius ]();
75  stepwise_clusterer.set_cluster_radius( cluster_radius );
76 
77  stepwise_clusterer.set_cluster_by_all_atom_rmsd( true );
78  stepwise_clusterer.set_score_diff_cut( option[ score_diff_cut ] );
79  stepwise_clusterer.set_rename_tags( true /*option[ rename_tags ]*/ );
80  stepwise_clusterer.set_rsd_type_set( core::chemical::FA_STANDARD );
81  stepwise_clusterer.set_auto_tune( option[ auto_tune ] );
82 
83  stepwise_clusterer.cluster();
84 
85  std::string const silent_file_out( option[ out::file::silent ]() );
86  stepwise_clusterer.output_silent_file( silent_file_out );
87 
88  std::cout << "Maximum number of models: " << max_decoys << ". [use -nstruct to set higher]" << std::endl;
89  std::cout << "Used all-heavy-atom clustering radius of " << cluster_radius << " Angstroms. [use -cluster:radius to change.]" << std::endl;
90 
91 }
92 
93 
94 ///////////////////////////////////////////////////////////////
95 void*
96 my_main( void* )
97 {
98  cluster_test();
99  exit( 0 );
100 }
101 
102 
103 ///////////////////////////////////////////////////////////////////////////////
104 int
105 main( int argc, char * argv [] )
106 {
107  try {
108  using namespace basic::options;
109  using namespace basic::options::OptionKeys;
110 
111  std::cout << std::endl << "Basic usage: " << argv[0] << " -in:file:silent <input silent file> -out:file:silent <output silent file> -cluster:radius <RMSD threshold in Angstroms>" << std::endl;
112  std::cout << std::endl << " Type -help for full slate of options." << std::endl << std::endl;
113 
114  option.add_relevant( in::file::silent );
115  option.add_relevant( out::file::silent );
116  option.add_relevant( out::nstruct );
117  option.add_relevant( cluster::radius );
118  option.add_relevant( cluster::score_diff_cut );
119  option.add_relevant( cluster::auto_tune );
120 
121 
122  ////////////////////////////////////////////////////////////////////////////
123  // setup
124  ////////////////////////////////////////////////////////////////////////////
125  core::init::init(argc, argv);
126 
127 
128  ////////////////////////////////////////////////////////////////////////////
129  // end of setup
130  ////////////////////////////////////////////////////////////////////////////
131 
132  protocols::viewer::viewer_main( my_main );
133  } catch ( utility::excn::EXCN_Base const & e ) {
134  std::cout << "caught exception " << e.msg() << std::endl;
135  return -1;
136  }
137 }
#define utility_exit_with_message(m)
Exit with file + line + message.
Definition: exit.hh:47
virtual std::string const msg() const
Definition: EXCN_Base.hh:70
BooleanOptionKey const user("options:user")
Definition: OptionKeys.hh:40
common derived classes for thrown exceptions
int main(int argc, char *argv[])
Definition: rna_cluster.cc:105
std::vector with 1-based indexing
Definition: vector1.fwd.hh:44
basic::options::IntegerOptionKey const nstruct("nstruct")
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
double Real
Definition: types.hh:39
void cluster_test()
Definition: rna_cluster.cc:56
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
void init()
set global 'init_was_called' to true
Definition: init.cc:26
Program options global and initialization function.
platform::Size Size
Definition: random.fwd.hh:30
int const silent
Named verbosity levels.
rule< Scanner, option_closure::context_t > option
Definition: Tag.cc:378
void * my_main(void *)
Definition: rna_cluster.cc:96