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/scoring/ScoreFunction.hh>
20 #include <core/scoring/ScoreFunctionFactory.hh>
21 #include <core/scoring/constraints/ConstraintSet.fwd.hh>
22 #include <core/scoring/methods/EnergyMethodOptions.hh>
23 #include <core/pack/task/PackerTask.hh>
24 #include <core/pack/task/rna/RNA_ResidueLevelTask.hh>
25 #include <core/pack/task/TaskFactory.hh>
26 #include <core/pack/task/ResfileReader.hh>
27 #include <core/pack/pack_rotamers.hh>
30 #include <protocols/viewer/viewers.hh>
31 #include <core/pose/Pose.hh>
32 #include <core/init/init.hh>
34 #include <core/io/pdb/pose_io.hh>
44 #include <protocols/farna/util.hh>
55 #include <basic/options/keys/out.OptionKeys.gen.hh>
56 #include <basic/options/keys/score.OptionKeys.gen.hh>
57 #include <basic/options/keys/in.OptionKeys.gen.hh>
58 #include <basic/options/keys/packing.OptionKeys.gen.hh>
61 #include <platform/types.hh>
62 #include <core/import_pose/import_pose.hh>
63 #include <core/kinematics/Jump.hh>
71 namespace ObjexxFCL { }
using namespace ObjexxFCL;
77 using namespace protocols;
78 using namespace basic::options::OptionKeys;
80 using io::pdb::dump_pdb;
86 OPT_KEY( Boolean, disable_o2prime_rotamers )
87 OPT_KEY( Boolean, disable_include_current )
89 OPT_KEY( Boolean, ss_ds_ts_assign )
101 Size const nres = pose.total_residue();
103 protocols::farna::check_base_pair( pose, struct_type );
106 for (
Size n = 1; n <= pose_list.size(); n++ ) {
107 for (
Size i = 1; i <=
nres; i++ ) {
108 if ( (pose_list[n])->residue(i).aa() == pose.residue(i).aa() ) {
109 recovery( i ) += 1.0;
114 recovery /= pose_list.
size();
116 Size num_ss( 0 ), num_ds( 0 ), num_ts( 0 );
117 Real frac_ss( 0.0 ), frac_ds( 0.0 ), frac_ts( 0.0 ), frac_overall( 0.0 );
118 for (
Size i = 1; i <=
nres; i++ ) {
119 frac_overall += recovery(i);
120 switch ( struct_type(i) ) {
123 frac_ss += recovery(i);
127 frac_ds += recovery(i);
131 frac_ts += recovery(i);
136 if ( num_ss > 0.0 ) frac_ss /= num_ss;
137 if ( num_ds > 0.0 ) frac_ds /= num_ds;
138 if ( num_ts > 0.0 ) frac_ts /= num_ts;
139 if ( nres > 0.0 ) frac_overall /=
nres;
141 std::map <Size, char > struct_symbol;
142 struct_symbol[ 0 ] =
'S';
143 struct_symbol[ 1 ] =
'D';
144 struct_symbol[ 2 ] =
'T';
148 for (
Size i = 1; i <=
nres; i++ ) {
149 out << pose.residue(i).name1() <<
I(3,i) <<
" " <<
F(8,3,recovery(i)) <<
" " << struct_symbol[ struct_type(i) ] << std::endl;
153 out <<
"SINGLE_STRANDED " <<
I(3,num_ss) <<
" " <<
F(9,4,frac_ss) << std::endl;
154 out <<
"DOUBLE_STRANDED " <<
I(3,num_ds) <<
" " <<
F(9,4,frac_ds) << std::endl;
155 out <<
"TERTIARY_STRUCT " <<
I(3,num_ts) <<
" " <<
F(9,4,frac_ts) << std::endl;
156 out <<
"OVERALL " <<
I(3,nres) <<
" " <<
F(9,4,frac_overall) << std::endl;
160 std::cout <<
"Wrote stats to: " << sequence_recovery_file << std::endl;
171 using namespace basic::options::OptionKeys;
172 using namespace core::chemical;
173 using namespace core::scoring;
175 ResidueTypeSetCOP rsd_set;
176 rsd_set = core::chemical::ChemicalManager::get_instance()->residue_type_set( FA_STANDARD );
180 core::import_pose::pose_from_pdb(
pose, *rsd_set, pdb_file );
181 protocols::farna::ensure_phosphate_nomenclature_matches_mini(
pose );
183 dump_pdb(
pose,
"start.pdb");
186 pack::task::PackerTaskOP
task( pack::task::TaskFactory::create_packer_task(
pose ));
187 task->initialize_from_command_line();
190 pack::task::parse_resfile(
pose, *task);
193 task->nonconst_residue_task(
ii ).allow_aa( na_rad );
194 task->nonconst_residue_task(
ii ).allow_aa( na_ura );
195 task->nonconst_residue_task(
ii ).allow_aa( na_rgu );
196 task->nonconst_residue_task(
ii ).allow_aa( na_rcy );
197 assert( task->design_residue(
ii) );
204 task->nonconst_residue_task(
ii ).and_extrachi_cutoff( 0 );
206 if (
option[ disable_o2prime_rotamers ]() ) task->nonconst_residue_task(
ii).sample_proton_chi(
false );
208 if (
option[ sample_chi ]() ) task->nonconst_residue_task(
ii).nonconst_rna_task().set_sample_rna_chi(
true );
221 ScoreFunctionOP
scorefxn = get_score_function();
224 methods::EnergyMethodOptions
options(
scorefxn->energy_method_options() );
225 options.exclude_DNA_DNA(
false );
230 pose.dump_pdb(
"start.pdb" );
238 std::string
outfile( pdb_file );
239 Size pos( pdb_file.find(
".pdb" ) );
240 outfile.replace(
pos, 4,
".pack.txt" );
241 protocols::farna::export_packer_results( results, pose_list,
scorefxn, outfile,
option[
dump ] );
243 std::string sequence_recovery_file( pdb_file );
244 sequence_recovery_file.replace(
pos, 4,
".sequence_recovery.txt" );
250 pose = *( pose_list[1] );
261 using namespace basic::options::OptionKeys;
262 using namespace core::chemical;
263 using namespace core::scoring;
265 ResidueTypeSetCOP rsd_set;
266 rsd_set = core::chemical::ChemicalManager::get_instance()->residue_type_set( FA_STANDARD );
271 for (
Size n = 1; n <= pdb_files.size(); n++ ) {
272 std::string
const & pdb_file = pdb_files[ n ] ;
273 core::import_pose::pose_from_pdb( *pose_op, *rsd_set, pdb_file );
274 protocols::farna::ensure_phosphate_nomenclature_matches_mini( *pose_op );
276 std::string sequence_recovery_file( pdb_file );
277 Size pos( pdb_file.find(
".pdb" ) );
278 sequence_recovery_file.replace(
pos, 4,
".ss_ds_ts.txt" );
281 pose_list.push_back( pose_op );
293 using namespace basic::options::OptionKeys;
295 if (
option[ ss_ds_ts_assign ] ) {
306 main(
int argc,
char * argv [] )
311 std::cout << std::endl <<
"Basic usage: " << argv[0] <<
" -s <pdb file> [ -resfile <resfile>] " << std::endl;
312 std::cout << std::endl <<
" Type -help for full slate of options." << std::endl << std::endl;
315 NEW_OPT( disable_o2prime_rotamers,
"In designing, don't sample 2'-OH",
false);
316 NEW_OPT( disable_include_current,
"In designing, don't include current",
false);
317 NEW_OPT( sample_chi,
"In designing RNA, chi torsion sample",
false);
318 NEW_OPT( ss_ds_ts_assign,
"Figure out assignment of residues to single-stranded, double-stranded, tertiary contact categories",
false);
332 protocols::viewer::viewer_main(
my_main );
334 std::cout <<
"caught exception " << e.
msg() << std::endl;
virtual std::string const msg() const
void rna_sequence_recovery_metrics(pose::Pose const &reference_pose, utility::vector1< pose::PoseOP > const &pose_list, std::string const &sequence_recovery_file)
vector0: std::vector with assert-checked bounds
BooleanOptionKey const user("options:user")
common derived classes for thrown exceptions
void ss_ds_ts_assign_test()
std::vector with 1-based indexing
basic::options::IntegerOptionKey const nstruct("nstruct")
rule< Scanner, options_closure::context_t > options
#define OPT_KEY(type, key)
utility::options::OptionCollection option
OptionCollection global.
Output file stream wrapper for uncompressed and compressed files.
void close()
Close the ofstream and reset the state.
#define NEW_OPT(akey, help, adef)
ocstream cout(std::cout)
Wrapper around std::cout.
BooleanOptionKey const exit("options:exit")
vector1: std::vector with 1-based indexing
ozstream: Output file stream wrapper for uncompressed and compressed files
void init()
set global 'init_was_called' to true
Program options global and initialization function.
rule< Scanner, option_closure::context_t > option
size_type size() const
Active Array Size.
FArray1D: Fortran-Compatible 1D Array.