50 #include <utility/io/izstream.hh>
63 #if defined(WIN32) || defined(__CYGWIN__)
97 #include <basic/datacache/BasicDataCache.hh>
108 #include <basic/MetricValue.hh>
109 #include <basic/options/option.hh>
110 #include <basic/options/keys/abinitio.OptionKeys.gen.hh>
111 #include <basic/options/keys/constraints.OptionKeys.gen.hh>
113 #include <basic/options/keys/filters.OptionKeys.gen.hh>
114 #include <basic/options/keys/frags.OptionKeys.gen.hh>
115 #include <basic/options/keys/in.OptionKeys.gen.hh>
116 #include <basic/options/keys/jumps.OptionKeys.gen.hh>
117 #include <basic/options/keys/loopfcst.OptionKeys.gen.hh>
118 #include <basic/options/keys/loops.OptionKeys.gen.hh>
119 #include <basic/options/keys/out.OptionKeys.gen.hh>
120 #include <basic/options/keys/run.OptionKeys.gen.hh>
121 #include <basic/options/keys/templates.OptionKeys.gen.hh>
122 #include <basic/options/keys/relax.OptionKeys.gen.hh>
123 #include <basic/options/keys/score.OptionKeys.gen.hh>
171 #include <numeric/random/random.hh>
174 #include <utility/string_util.hh>
175 #include <utility/vector1.hh>
176 #include <basic/Tracer.hh>
177 #include <utility/io/util.hh>
178 #include <utility/exit.hh>
200 #include <utility/vector0.hh>
201 #include <ObjexxFCL/format.hh>
204 namespace ObjexxFCL { }
using namespace ObjexxFCL;
205 namespace ObjexxFCL {
namespace fmt { } }
using namespace ObjexxFCL::fmt;
207 static basic::Tracer
tr(
"protocols.abinitio.AbrelaxApplication");
208 static numeric::random::RandomGenerator
RG(423464);
213 using namespace basic::options;
214 using namespace basic::options::OptionKeys;
217 option.add_relevant( in::file::native );
218 option.add_relevant( in::file::silent );
219 option.add_relevant( in::file::frag3 );
220 option.add_relevant( in::file::frag9 );
221 option.add_relevant( in::file::fasta );
222 option.add_relevant( in::file::native_exclude_res );
224 option.add_relevant( out::file::silent );
225 option.add_relevant( out::nstruct );
227 option.add_relevant( run::proc_id );
228 option.add_relevant( run::nproc );
229 option.add_relevant( run::condor );
231 option.add_relevant( OptionKeys::abinitio::fastrelax );
232 option.add_relevant( OptionKeys::abinitio::relax );
233 option.add_relevant( OptionKeys::abinitio::multifastrelax );
234 option.add_relevant( OptionKeys::abinitio::relax_with_jumps );
235 option.add_relevant( OptionKeys::abinitio::use_filters );
236 option.add_relevant( OptionKeys::abinitio::detect_disulfide_before_relax );
238 option.add_relevant( OptionKeys::abinitio::number_3mer_frags );
239 option.add_relevant( OptionKeys::abinitio::number_9mer_frags );
240 option.add_relevant( OptionKeys::abinitio::process_store );
241 option.add_relevant( OptionKeys::abinitio::fix_residues_to_native );
242 option.add_relevant( OptionKeys::abinitio::return_full_atom );
243 option.add_relevant( OptionKeys::abinitio::rerun );
244 option.add_relevant( OptionKeys::abinitio::jdist_rerun );
247 option.add_relevant( OptionKeys::abinitio::start_native );
248 option.add_relevant( OptionKeys::abinitio::perturb );
249 option.add_relevant( OptionKeys::abinitio::close_loops );
252 option.add_relevant( OptionKeys::abinitio::rmsd_residues );
253 option.add_relevant( OptionKeys::abinitio::bGDT );
254 option.add_relevant( OptionKeys::run::no_prof_info_in_silentout );
257 option.add_relevant( OptionKeys::abinitio::steal_3mers );
258 option.add_relevant( OptionKeys::abinitio::steal_9mers );
259 option.add_relevant( OptionKeys::abinitio::dump_frags );
260 option.add_relevant( OptionKeys::abinitio::no_write_failures );
262 option.add_relevant( loopfcst::use_general_protocol );
263 option.add_relevant( loopfcst::coord_cst_weight );
264 option.add_relevant( loopfcst::coord_cst_all_atom );
265 option.add_relevant( loopfcst::coord_cst_weight_array );
266 option.add_relevant( loopfcst::dump_coord_cst_weight_array );
268 option.add_relevant( OptionKeys::in::file::pca );
269 option.add_relevant( OptionKeys::out::sf );
272 option.add_relevant( jumps::fix_jumps );
273 option.add_relevant( jumps::jump_lib );
274 option.add_relevant( jumps::fix_chainbreak );
275 option.add_relevant( jumps::pairing_file );
276 option.add_relevant( jumps::sheets );
277 option.add_relevant( jumps::random_sheets );
278 option.add_relevant( jumps::evaluate );
279 option.add_relevant( jumps::extra_frags_for_ss );
280 option.add_relevant( jumps::loop_definition_from_file );
281 option.add_relevant( jumps::no_chainbreak_in_relax );
282 option.add_relevant( jumps::residue_pair_jump_file );
283 option.add_relevant( jumps::topology_file );
286 option.add_relevant( OptionKeys::loops::loop_file );
287 option.add_relevant( OptionKeys::loops::alternative_closure_protocol );
288 option.add_relevant( OptionKeys::loops::short_frag_cycles );
289 option.add_relevant( OptionKeys::loops::scored_frag_cycles );
290 option.add_relevant( OptionKeys::loops::debug_loop_closure );
291 option.add_relevant( OptionKeys::loops::non_ideal_loop_closing );
292 option.add_relevant( OptionKeys::loops::chainbreak_max_accept );
293 option.add_relevant( OptionKeys::loops::extended );
296 option.add_relevant( constraints::cst_file );
297 option.add_relevant( constraints::forest_file );
298 option.add_relevant( constraints::compute_total_dist_cst );
299 option.add_relevant( constraints::no_linearize_bounded );
300 option.add_relevant( constraints::dump_cst_set );
301 option.add_relevant( constraints::no_cst_in_relax );
302 option.add_relevant( constraints::evaluate_max_seq_sep );
303 option.add_relevant( constraints::cull_with_native );
304 option.add_relevant( constraints::named );
305 option.add_relevant( constraints::epr_distance );
306 option.add_relevant( constraints::viol );
307 option.add_relevant( constraints::viol_level );
308 option.add_relevant( constraints::viol_type );
311 option.add_relevant( templates::config );
312 option.add_relevant( templates::pairings );
315 option.add_relevant( templates::min_nr_large_frags );
316 option.add_relevant( templates::min_nr_small_frags );
318 option.add_relevant( templates::nr_large_copies );
319 option.add_relevant( templates::nr_small_copies );
320 option.add_relevant( templates::vary_frag_size );
321 option.add_relevant( templates::fix_aligned_residues );
322 option.add_relevant( templates::fix_margin );
323 option.add_relevant( templates::fix_frag_file );
324 option.add_relevant( templates::no_pick_fragments );
325 option.add_relevant( templates::pick_multiple_sizes );
326 option.add_relevant( templates::strand_constraint );
327 option.add_relevant( frags::nr_large_copies );
328 option.add_relevant( frags::annotate );
329 option.add_relevant( in::file::tags );
342 std::cerr <<
"Registered extra options." << std::endl; std::cerr.flush();
346 namespace protocols {
350 using namespace core;
351 using namespace protocols;
352 using namespace fragment;
353 using namespace abinitio;
354 using namespace jumping;
355 using namespace evaluation;
356 using namespace basic::options;
374 using namespace core::scoring::constraints;
398 AbrelaxApplication::AbrelaxApplication() :
399 silent_score_file_( NULL ),
400 native_pose_( NULL ),
406 fragset_large_( NULL ),
407 fragset_small_top25_( NULL ),
408 fragset_small_( NULL ),
410 abrelax_checkpoints_(
"Abrelax" )
418 silent_score_file_( src.silent_score_file_ ),
419 native_pose_( src.native_pose_ ),
420 loops_in_( src.loops_in_ ),
422 bRelax_( src.bRelax_ ),
423 sequence_( src.sequence_ ),
424 cstset_( src.cstset_ ),
425 membrane_jumps_( src.membrane_jumps_ ),
426 jump_def_ ( src.jump_def_ ),
427 ss_def_( src.ss_def_ ),
428 templates_( src.templates_ ),
429 fragset_large_( src.fragset_large_ ),
430 fragset_small_top25_( src.fragset_small_top25_ ),
431 fragset_small_( src.fragset_small_ ),
432 fragset_templates_( src.fragset_templates_ ),
433 evaluator_( src.evaluator_ ),
434 abrelax_checkpoints_( src.abrelax_checkpoints_ )
446 using namespace basic::options::OptionKeys;
448 if ( option[ constraints::no_linearize_bounded ] ) {
449 tr.Info <<
"use fully harmonic potential for BOUNDED " << std::endl;
452 if ( option[ constraints::named ] ) {
453 tr.Info <<
"use named constraints in AtomPairConstraint to avoid problems with cutpoint-variants " << std::endl;
462 if ( option[ in::file::native ].user() ) {
468 #ifdef BOINC_GRAPHICS
470 boinc::Boinc::set_graphics_native_pose( *
native_pose_ );
479 if ( option[ in::file::fasta ].user() ) {
481 tr.Info <<
"read fasta sequence: " <<
sequence_.size() <<
" residues\n" <<
sequence_ << std::endl;
484 tr.Info <<
"take sequence from native : " <<
sequence_ << std::endl;
485 }
else if ( !option[ OptionKeys::abinitio::rerun ]() && !option[ OptionKeys::abinitio::jdist_rerun ]() ) {
486 utility_exit_with_message(
487 "Error: can't read sequence! Use -in::file::fasta sequence.fasta or -in::file::native native.pdb!"
508 if ( option[ OptionKeys::in::file::pca ].user() ) {
510 pca_->read_eigvec_file( option[ OptionKeys::in::file::pca ](), *
native_pose_, 2 );
523 using namespace basic::options::OptionKeys;
524 if ( option[ OptionKeys::loops::debug_loop_closure ]() ) pose.
dump_pdb(tag+
"_pre_closure.pdb");
526 bool success(
false );
543 movemap->set_bb(
true );
550 if ( option[ OptionKeys::loops::alternative_closure_protocol ]() ) {
557 closure_protocol->scored_frag_cycle_ratio( option[ OptionKeys::loops::scored_frag_cycles ]() );
558 closure_protocol->short_frag_cycle_ratio( option[ OptionKeys::loops::short_frag_cycles ]() );
561 closure_protocol->set_evaluation(
evaluator_ );
563 closure_protocol->keep_fragments();
566 bool bIdeal( !option[ OptionKeys::loops::non_ideal_loop_closing ]() );
567 closure_protocol->set_bIdealLoopClosing( bIdeal );
576 if ( option[ OptionKeys::loops::debug_loop_closure ]() ) pose.
dump_pdb(tag+
"_post_closure.pdb");
581 if ( success && option[ OptionKeys::loops::idealize_after_loop_close ]() ) {
583 idealizer.
fast(
false );
585 idealizer.
apply( pose );
589 if ( !bIdeal ) option[ basic::options::OptionKeys::out::file::silent_struct_type ].def(
"binary");
610 using namespace basic::options::OptionKeys;
614 if ( option[ OptionKeys::abinitio::clear_pose_cache ]() ) {
615 tr.Debug <<
"\n******************************************************** \n"
616 <<
" CLEAR POSE CACHE \n"
617 <<
"***********************************************************" << std::endl;
625 if ( option[ jumps::evaluate ]() ) {
626 if ( !
native_pose_ ) utility_exit_with_message(
" to evaluate jumps you need to specify a native structure ");
632 eval_jumps.
apply( pose, tag, pss );
639 using namespace basic::options::OptionKeys;
640 if ( option[ constraints::forest_file ].user() ) {
641 tr.Info <<
"read ConstraintForest... : " << std::endl;
642 utility_exit_with_message(
"ConstraintForest needs to be revived!" );
648 using namespace core::scoring::constraints;
649 using namespace basic::options::OptionKeys;
653 if ( option[ constraints::cst_file ].user() ) {
662 if ( option[ templates::strand_constraint ] ) {
666 }
else if ( option[ jumps::topology_file ].user() ) {
667 utility::io::izstream is( option[ jumps::topology_file ] );
671 tr.Info << *ps << std::endl;
674 utility_exit_with_message(
" did not find topology_file: " +
std::string( option[ jumps::topology_file ]() ) );
677 utility_exit_with_message(
" strand_constraint nees a topology info: either via templates or -topology_file ");
679 cstset_->add_constraints( my_strand_cst );
686 if ( option[ constraints::dump_cst_set ].user() ) {
687 tr.Info <<
"dump strand constraints to file..." << std::endl;
688 utility::io::ozstream dump_cst(
"STRAND_CST_DUMP" );
689 test_pose.
constraint_set()->show_definition( dump_cst, test_pose );
694 cst_score( test_pose );
695 tr.Info <<
" native pose yields this score for the StrandConstraints: " << cst_score( test_pose ) << std::endl;
696 cst_score.
show(
tr, test_pose );
702 if ( option[ constraints::cull_with_native ].user() &&
native_pose_ ) {
703 tr.Warning <<
"************************************************************************************\n"
704 <<
"********************* CULL CONSTRAINTS WITH NATIVE STRUCTURE *********************\n"
705 <<
"************************************************************************************\n" << std::endl;
708 filtered, *
native_pose_, option[ constraints::cull_with_native ]() );
710 cstset_->add_constraints( filtered );
715 if ( option[ constraints::dump_cst_set ].user() ) {
716 tr.Info <<
"dump constraints to file..." << std::endl;
717 utility::io::ozstream dump_cst( option[ constraints::dump_cst_set ]() );
718 cstset_->show_definition( dump_cst, pose );
721 if ( option[ constraints::evaluate_max_seq_sep ].user() ) {
722 Size const neval ( option[ constraints::evaluate_max_seq_sep ]().
size() );
723 for (
Size i = 1; i<= neval; i++ ) {
724 Size const seq_sep( option[ constraints::evaluate_max_seq_sep ]()[ i ] );
740 :
ClassicAbinitio( brute_move_large, brute_move_large, brute_move_large, 1 ) {};
746 prepare_stage1( pose );
747 do_stage1_cycles( pose );
751 using namespace basic::options::OptionKeys;
752 if ( option[ templates::fix_frag_file ].user() ) {
753 FrameList fix_frames;
755 Size const frame_id ( static_cast< int >(
RG.uniform() * fix_frames.size() ) + 1 );
756 FrameOP frame( fix_frames[ frame_id ] );
757 Size const frag_id ( static_cast< int >(
RG.uniform() * frame->nr_frags() ) + 1 );
758 frame->apply( frag_id, pose );
760 std::ofstream out(
"big_frags.log", std::ios_base::out | std::ios_base::app );
761 out << tag <<
" " << RJ(10,frame->start()) << RJ( 10, frame->stop() ) << RJ( 10, frag_id ) << std::endl;
763 movemap->set_bb(
true );
764 Size const npadding( option[ OptionKeys::templates::fix_margin ] );
765 for (
Size pos = frame->start() + npadding; pos<=frame->end() - npadding; ++pos ) {
766 movemap->set_bb( pos,
false );
777 using namespace core;
778 using namespace io::silent;
779 using namespace pose;
780 using namespace basic::options::OptionKeys;
783 if ( option[ out::file::silent ].user() ) {
788 if ( option[ in::file::silent ].user() ) {
791 sfd.
read_file( *(option [ in::file::silent ]().begin()) );
798 if ( option[ in::file::tags ].user() == 0 || std::find( option[ in::file::tags ]().begin(), option[ in::file::tags ]().
end(), tag ) != option[ in::file::tags ]().
end() ) {
799 if ( option[ in::file::fullatom ].user() ) {
801 option[ in::file::fullatom ] ?
803 *(chemical::ChemicalManager::get_instance()->residue_type_set(
chemical::CENTROID ) ));
805 it->fill_pose( pose );
811 if ( sfd.
size() < 10 || option[ constraints::viol ]() ) {
812 tr.Info << tag <<
" " << std::endl;
814 if ( (ct++ % 50) == 0 ) {
824 if ( option[ OptionKeys::abinitio::close_loops ] ) {
829 basic::MetricValue<core::Size> mr;
830 pose.
metric(
"clashes",
"total",mr);
831 tr.Info <<
"Total clashes " << mr.value() << std::endl;
834 if( !passes_filters ) {
835 tag =
"F_"+tag.substr(2);
838 SilentStructOP ss = io::silent::SilentStructFactory::get_instance()->get_silent_struct_out();
841 if ( outsfd ) outsfd->add_structure( ss );
844 if ( option[ OptionKeys::abinitio::close_loops ] ) {
853 SilentStructOP ss = io::silent::SilentStructFactory::get_instance()->get_silent_struct_out();
859 if ( option[ OptionKeys::abinitio::close_loops ] ) {
869 if ( outsfd ) outsfd->add_structure( ss );
870 if ( option[ OptionKeys::abinitio::close_loops ] )
evaluator_->pop_back();
877 if ( outsfd ) outsfd->write_all( option[ out::file::silent ]() );
886 using namespace core;
887 using namespace io::silent;
888 using namespace pose;
889 using namespace basic::options::OptionKeys;
896 bRelax_ = option[ OptionKeys::abinitio::relax ]() ||
897 option[ OptionKeys::abinitio::fastrelax ]();
901 if ( !option[ OptionKeys::run::no_prof_info_in_silentout ] ) {
915 sfd.read_file( *(option [ in::file::silent ]().begin()) );
916 input_tags = sfd.tags();
918 int const nstruct = std::max( 1, option [ out::nstruct ]() );
923 for ( TagList::const_iterator it = input_tags.begin(), eit = input_tags.end(); it!=eit; ++it ) {
924 BasicJobOP job =
new BasicJob( *it,
"rerun", nstruct);
925 input_jobs.push_back( job );
929 PlainSilentFileJobDistributor jobdist( input_jobs );
930 if ( option[ run::proc_id ].user() ) {
931 int const procid ( option[ run::proc_id ] + ( option[ run::condor ] ? 1 : 0 ) );
932 if ( procid > option[ run::nproc ] ) {
933 utility_exit_with_message(
"procid to large " + ObjexxFCL::string_of( procid ) +
" run only " + ObjexxFCL::string_of( option[ run::nproc ] ) +
" processes");
935 jobdist.set_proc_id( procid, option[ run::nproc ] );
940 bool bEndrun =
false;
943 while ( jobdist.next_job(curr_job, curr_nstruct) && !bEndrun ) {
944 if ( run_time ) run_time->reset();
945 tr.Info <<
"Starting " << jobdist.get_current_output_tag() <<
" ..." << std::endl;
946 tr.Info <<
"read " << curr_job->input_tag() <<
"..." << std::endl;
949 sfd.get_structure( curr_job->input_tag() ).fill_pose( pose );
954 if ( basic::options::option[ basic::options::OptionKeys::in::fix_disulf ].user() ) {
964 tr.Info <<
"relax is active... add stupid extra score terms " << std::endl;
968 std::string tag = jobdist.get_current_output_tag();
969 if( option[ OptionKeys::loops::random_grow_loops_by ].user() ){
971 tr.Info <<
"Enlarged loops: " << std::endl;
988 if ( option[ jumps::no_chainbreak_in_relax ] ) {
994 tr.Info << tag <<
" " << std::endl;
998 std::string silent_file = option[ basic::options::OptionKeys::out::file::silent ]() +
"_" +
"before_loops";
1001 process_decoy( pose, pose.
is_fullatom() ? *fullatom_scorefxn : *centroid_scorefxn, jobdist.get_current_output_tag(), *pss );
1005 bool loop_closure_failed(
false );
1006 if ( option[ OptionKeys::abinitio::close_loops ] ) {
1008 loop_closure_failed = !
close_loops( pose, centroid_scorefxn, tag );
1014 bool bCanRelax = passes_filters && ( !loop_closure_failed || option[ OptionKeys::abinitio::relax_with_jumps ]() );
1017 Pose const centroid_pose ( pose );
1023 tr.Info <<
"relax is active... add stupid extra score terms " << std::endl;
1025 relax( pose, fullatom_scorefxn, jobdist.get_current_output_tag() );
1028 (*fullatom_scorefxn)( pose );
1029 if ( option[ basic::options::OptionKeys::abinitio::fastrelax ]() ) {
1038 std::string output_tag = jobdist.get_current_output_tag();
1039 if ( !passes_filters && loop_closure_failed ) {
1040 output_tag =
"X_"+output_tag.substr(2);
1041 }
else if( loop_closure_failed ) {
1042 output_tag =
"C_"+output_tag.substr(2);
1043 }
else if( !passes_filters ) {
1044 output_tag =
"F_"+output_tag.substr(2);
1047 SilentStructOP pss = io::silent::SilentStructFactory::get_instance()->get_silent_struct_out();
1055 jobdist.dump_silent( curr_nstruct, *pss );
1058 if ( option[ OptionKeys::abinitio::close_loops ] ) {
1073 tr.Info <<
" *** use native structure as starting template -- NEEDS TO BE IDEALIZED !!! *** \n";
1080 tr.Info <<
" *** use native structure as starting template -- NEEDS TO BE IDEALIZED !!! *** \n";
1084 Size protein_len = 0;
1085 for (
Size i = 1; i <= seg_len; ++i ) {
1090 seg_len = protein_len;
1094 FragData frag(
new BBTorsionSRFD, seg_len );
1097 frag.steal( desired_pose, long_frame );
1100 frag.apply( extended_pose, long_frame );
1110 *( chemical::ChemicalManager::get_instance()->residue_type_set(
chemical::CENTROID ))
1114 if ( basic::options::option[ basic::options::OptionKeys::in::fix_disulf ].user() ) {
1117 ds_file.
disulfides( disulfides, extended_pose);
1124 extended_pose.
set_phi( pos, -150 );
1125 extended_pose.
set_psi( pos, 150);
1129 #ifdef BOINC_GRAPHICS
1131 protocols::boinc::Boinc::attach_graphics_current_pose_observer( extended_pose );
1140 using namespace basic::options;
1141 using namespace basic::options::OptionKeys;
1144 if (option[ in::file::fragA ].user()) {
1145 frag_large_file = option[ in::file::fragA ]();
1147 frag_large_file = option[ in::file::frag9 ]();
1150 if (option[ in::file::fragB ].user()) {
1151 frag_small_file = option[ in::file::fragB ]();
1153 frag_small_file = option[ in::file::frag3 ]();
1157 option[ OptionKeys::abinitio::number_9mer_frags ](),
1158 option[ OptionKeys::frags::nr_large_copies ](),
1159 option[ OptionKeys::frags::annotate ]()
1160 ).read_data( frag_large_file );
1162 if(option[OptionKeys::abinitio::membrane]) {
1164 option[ OptionKeys::abinitio::number_9mer_frags ],
1166 option[ OptionKeys::frags::annotate ]
1167 ).read_data( frag_small_file );
1170 option[ OptionKeys::abinitio::number_3mer_frags ],
1172 option[ OptionKeys::frags::annotate ]
1173 ).read_data( frag_small_file );
1175 if (
templates_ && !option[ templates::no_pick_fragments ]() ) {
1176 if ( option[ templates::vary_frag_size ] ) {
1179 tr.Info <<
" merge template frags with standard library " << std::endl;
1183 option[ templates::min_nr_large_frags ],
1188 tr.Info <<
"pick large fragments as 9mers " << std::endl;
1189 if ( option[ templates::min_nr_large_frags ].user() ) {
1190 Size const min_nr_frags( option[ templates::min_nr_large_frags ] );
1191 Size const nr_large_copies( option[ templates::nr_large_copies ] );
1194 new FragData(
new BBTorsionSRFD,
fragset_large_->max_frag_length() ),
1199 tr.Info << nr <<
" " <<
fragset_large_->max_frag_length() <<
"mer fragments picked from homolog structures" << std::endl;
1201 if ( option[ templates::pick_multiple_sizes ] ) {
1204 new FragData(
new BBTorsionSRFD, 18 )
1206 tr.Info << nr <<
" 18mer fragments picked from homolog structures" << std::endl;
1209 new FragData(
new BBTorsionSRFD, 24 )
1211 tr.Info << nr <<
" 27mer fragments picked from homolog structures" << std::endl;
1215 if ( option[ templates::min_nr_small_frags ].user() ) {
1216 Size const min_nr_frags( option[ templates::min_nr_small_frags ] );
1217 Size const nr_small_copies( option[ templates::nr_small_copies ] );
1220 new FragData(
new BBTorsionSRFD,
fragset_small_->max_frag_length() ),
1226 tr.Info << nr2 <<
" " <<
fragset_small_->max_frag_length() <<
"mer fragments picked from homolog structures" << std::endl;
1230 if (
native_pose_ && ( option[ OptionKeys::abinitio::steal_3mers ]() || option[ OptionKeys::abinitio::steal_9mers ]() )) {
1231 tr.Info <<
" stealing fragments from native pose: ATTENTION: native pose has to be IDEALIZED!!! " << std::endl;
1233 new FragData(
new BBTorsionSRFD,
fragset_large_->max_frag_length() ) );
1235 new FragData(
new BBTorsionSRFD,
fragset_small_->max_frag_length() ) );
1236 }
else if ( ( option[ OptionKeys::abinitio::steal_3mers ]() || option[ OptionKeys::abinitio::steal_9mers ]() ) && !
native_pose_ && !
templates_ ) {
1237 tr.Warning <<
"cannot steal fragments without native pose or homologue structures " << std::endl;
1240 if ( option[ OptionKeys::abinitio::dump_frags ]() ) {
1241 utility::io::ozstream dump_frag_small(
"fragset_small.dump" );
1243 (*it)->show( dump_frag_small );
1245 utility::io::ozstream dump_frag_large(
"fragset_large.dump" );
1247 (*it)->show( dump_frag_large );
1255 using namespace basic::options;
1256 using namespace basic::options::OptionKeys;
1258 bool const bTemplates( option[ templates::config ].user() );
1259 if ( !bTemplates ) {
1260 if ( option[ templates::pairings ].user() )
1261 tr.Warning <<
"option templates:pairings ignored... specify templates:config!" << std::endl;
1272 utility_exit_with_message(
"ERRORS occured during template setup. check BAD_SEQUENCES file!");
1280 using namespace basic::options;
1281 using namespace basic::options::OptionKeys;
1284 bool bDoubleDef =
false;
1288 if ( option [ jumps::extra_frags_for_ss ].user() ) {
1289 FragSetOP ss_frags = FragmentIO().read_data( option[ jumps::extra_frags_for_ss ]() );
1292 if ( option[ jumps::loop_definition_from_file ].user() ) {
1294 ss_def_->read_from_file( option[ jumps::loop_definition_from_file ]() );
1297 if ( option[ jumps::fix_jumps ].user() ) {
1299 ptr->read_file( option[ jumps::fix_jumps ]() );
1302 if (
native_pose_ && !current_jumps.has_orientation_and_pleating() ) {
1303 tr.Warning <<
"abinitio:CHEAT JumpingFoldConstraints takes orienation and pleating from native structure !!!" << std::endl;
1304 current_jumps.steal_orientation_and_pleating( *
native_pose_ );
1305 ptr->set_jump_sample( current_jumps );
1309 if ( option[ jumps::jump_lib ].user() ) {
1312 ptr->read_file( option[ jumps::jump_lib ] );
1315 if ( option[ jumps::sheets ].user() || option[ jumps::random_sheets ].user() ) {
1324 if ( option[ jumps::pairing_file ].user() )
1329 if ( option[ jumps::sheets ].user() ) {
1330 sheets = option[ jumps::sheets ]();
1334 sheets = option[ jumps::random_sheets ]();
1339 if ( option[ jumps::topology_file ].user() ) {
1340 utility::io::izstream is( option[ jumps::topology_file ] );
1342 utility_exit_with_message(
" did not find topology_file: " +
std::string( option[ jumps::topology_file ]() ) );
1347 utility_exit_with_message(
" error reading file: " +
std::string( option[ jumps::topology_file ]() ) );
1349 tr.Info << *ps << std::endl;
1354 if ( option[ templates::pairings ] ) {
1356 if ( option[ jumps::fix_jumps ].user() ) {
1357 tr.Info <<
"use fixed jumps but take jump-geometries from template! " << std::endl;
1364 if ( option[ constraints::forest_file ].user() ) utility_exit_with_message(
"can't use constraint-forest pairings with template pairings yet");
1367 if ( option[ jumps::residue_pair_jump_file ].user() ) {
1370 ptr->read_file( option[ jumps::residue_pair_jump_file ]() );
1375 utility_exit_with_message(
"you can only define one jump mode: choose one of -fix_jumps / -jump_lib / -sheets / -pairings");
1401 using namespace basic::options;
1402 using namespace basic::options::OptionKeys;
1413 replonly.
apply( extended_pose );
1416 if ( option[ OptionKeys::abinitio::start_native ]() ) {
1418 }
else if ( option[ in::file::s ].user() ) {
1426 if ( option[ basic::options::OptionKeys::in::fix_disulf ].user() ) {
1429 ds_file.
disulfides(disulfides, extended_pose);
1434 bRelax_ = option[ OptionKeys::abinitio::relax ]() ||
1435 option[ OptionKeys::abinitio::fastrelax ]() ||
1436 option[ OptionKeys::abinitio::multifastrelax ]();
1448 if( option[OptionKeys::abinitio::membrane].user() ) {
1449 if(option[in::file::spanfile].user())
1451 std::string spanfile(option[OptionKeys::in::file::spanfile]());
1452 std::cout <<
"Reading spanfile " << spanfile <<
"\n";
1456 std::cout <<
"1.TEMPLATE SIZE: " <<
membrane_jumps_->template_size() <<
"\n";
1457 std::cout <<
"1.PAIRING SIZE: " <<
membrane_jumps_->pairings_size() <<
"\n";
1458 if(option[ jumps::pairing_file ].user() && option[ jumps::jump_lib].user())
1460 membrane_jumps_->init(option[ jumps::jump_lib ], option[ jumps::pairing_file ]);
1462 std::cout <<
"2.TEMPLATE SIZE: " <<
membrane_jumps_->template_size() <<
"\n";
1463 std::cout <<
"2.PAIRING SIZE: " <<
membrane_jumps_->pairings_size() <<
"\n";
1475 if ( option[ OptionKeys::abinitio::fix_residues_to_native ].user() ) {
1476 utility::vector1< int> const& fix_start_ends( option[ OptionKeys::abinitio::fix_residues_to_native ]() );
1477 for (
Size i=1; i + 1 <= fix_start_ends.size(); i+=2 ) {
1479 Size const end( fix_start_ends[ i + 1 ]);
1480 if ( !(end >= start) ) utility_exit_with_message(
"end < start in abinitio:fix_residues_to_native");
1483 FragData frag(
new BBTorsionSRFD, end-start+1 );
1489 frag.apply( extended_pose, long_frame );
1491 for (
Size pos = start; pos <=
end; pos++ ) {
1492 movemap->set_bb( pos,
false);
1497 if ( option[ OptionKeys::loopfcst::use_general_protocol ] ) {
1499 if ( option[ OptionKeys::loops::loop_file ].user() ) {
1504 if ( option[ OptionKeys::loops::input_pdb ].user() ) {
1505 if ( option[ in::file::fullatom ]() ) {
1508 if ( !extended_pose.
is_fullatom() ) utility_exit_with_message(
" this full-atom pose should be a full-atom pose, no? ");
1513 if ( extended_pose.
is_fullatom() ) utility_exit_with_message(
" this centroid pose should not be a full-atom pose, no? ");
1516 if( option[ OptionKeys::loops::random_grow_loops_by ].user() ){
1518 tr.Info <<
"Enlarged loops: " << std::endl;
1530 sampler->start_from_centroid(),
1531 sampler->return_centroid()
1534 sampler->set_show_viol_level( option[ constraints::viol_level ] );
1535 sampler->init( res_switch.start_pose() );
1537 if ( option[ OptionKeys::abinitio::close_loops ]() ) {
1540 if ( option[ OptionKeys::loops::alternative_closure_protocol ]() ) {
1545 if ( option[ OptionKeys::loops::fa_closure_protocol ]() ) {
1550 prot->set_fullatom_pose( extended_pose );
1555 closure_protocol->scored_frag_cycle_ratio( option[ OptionKeys::loops::scored_frag_cycles ]() );
1556 closure_protocol->short_frag_cycle_ratio( option[ OptionKeys::loops::short_frag_cycles ]() );
1558 bool const bIdeal( !option[ OptionKeys::loops::non_ideal_loop_closing ]() );
1559 closure_protocol->set_bIdealLoopClosing( bIdeal );
1560 closure_protocol->set_chainbreak_max( option[ OptionKeys::loops::chainbreak_max_accept ]() );
1561 if ( !bIdeal ) option[ basic::options::OptionKeys::out::file::silent_struct_type ].def(
"binary");
1563 closure_protocol->keep_fragments();
1566 sampler->closure_protocol( closure_protocol );
1570 if ( option[ OptionKeys::loops::extended_loop_file ].user() ) {
1575 sampler->bSkipStage1_ =
true;
1577 stage1_sampler->init( res_switch.start_pose() );
1578 stage1_sampler->bSkipStage3_ =
true;
1579 stage1_sampler->bSkipStage4_ =
true;
1580 stage1_sampler->closure_protocol( NULL );
1589 option[ loopfcst::coord_cst_weight ],
1590 option[ loopfcst::coord_cst_all_atom ]
1598 option[ loopfcst::coord_cst_weight ],
1599 option[ loopfcst::coord_cst_all_atom ]
1603 controller->set_input_pose_is_fa( extended_pose.
is_fullatom() );
1604 prot_ptr = controller;
1607 if ( option[ loopfcst::coord_cst_weight_array ].user() ) {
1608 utility::io::izstream file( option[ loopfcst::coord_cst_weight_array ]() );
1609 if ( !file.good() ) {
1610 utility_exit_with_message(
"ERROR:: Unable to open coord_cst_weight_array file: ");
1613 read_vector( file, weights );
1614 controller->set_coord_cst_weight_array( weights );
1617 if ( option[ loopfcst::dump_coord_cst_weight_array ].user() ) {
1618 controller->set_dump_weights_file( option[ loopfcst::dump_coord_cst_weight_array ] );
1624 if ( option[ basic::options::OptionKeys::abinitio::membrane ]() ) {
1625 tr.Info <<
"run MembraneAbinitio.... " << std::endl;
1627 tr.Info <<
"After new MembraneAbinitio.... " << std::endl;
1630 tr.Info <<
"run JumpingFoldConstraints....." << std::endl;
1636 pp->set_show_viol_level( option[ constraints::viol_level ] );
1639 if ( extended_pose.
constraint_set()->has_residue_pair_constraints() ) {
1641 tr.Info <<
"run FoldConstraints....." << std::endl;
1644 pp->set_show_viol_level( option[ constraints::viol_level ] );
1648 tr.Info <<
"run ClassicAbinitio....." << std::endl;
1655 Protocol& abinitio_protocol( *prot_ptr );
1658 abinitio_protocol.
init( extended_pose );
1659 if ( option[ OptionKeys::loopfcst::use_general_protocol ] ) {
1668 using namespace protocols::filters;
1671 if ( !basic::options::option[ basic::options::OptionKeys::abinitio::use_filters ]() )
return true;
1672 if ( option[ basic::options::OptionKeys::filters::disable_all_filters ]() )
return true;
1679 if ( !option[ basic::options::OptionKeys::filters::disable_rg_filter ]() && !rg_filter.apply( pose) )
return false;
1680 if ( !option[ basic::options::OptionKeys::filters::disable_co_filter ]() && !co_filter.apply( pose) )
return false;
1681 if ( !option[ basic::options::OptionKeys::filters::disable_sheet_filter ]() && !sh_filter.apply( pose) )
return false;
1683 if( ( option[basic::options::OptionKeys::filters::set_pddf_filter ].user() ) &&
1684 ( option[basic::options::OptionKeys::score::saxs::ref_pddf ].user() ) ) {
1687 bool flag = pddf_filter->apply(pose);
1689 if( ! flag )
return false;
1692 if( ( option[basic::options::OptionKeys::filters::set_saxs_filter ].user() ) &&
1696 bool flag = saxs_filter->apply(pose);
1698 if( ! flag )
return false;
1701 tr.Info <<
" passed all filters " << std::endl;
1711 if ( option[ basic::options::OptionKeys::abinitio::membrane ]() ) {
1713 }
else if ( option[ OptionKeys::abinitio::stage4_patch ].user() ) {
1719 if (
jump_def_ && !option[ OptionKeys::jumps::no_chainbreak_in_relax ] ) {
1728 if ( option[ OptionKeys::loopfcst::coord_cst_weight ].user() ) {
1740 Protocol& abinitio_protocol( *prot_ptr );
1742 using namespace basic::options;
1743 using namespace basic::options::OptionKeys;
1744 using namespace core::scoring::constraints;
1750 int const nstruct = std::max( 1, option [ out::nstruct ]() );
1755 if ( option[ in::file::tags ].user() ) {
1759 utility::io::izstream tag_file( option[ in::file::tagfile ]() );
1761 std::copy( std::istream_iterator< std::string >( tag_file ), std::istream_iterator< std::string >(),
1762 std::back_inserter( input_tags ) );
1765 for ( TagList::const_iterator it = input_tags.begin(), eit = input_tags.end(); it!=eit; ++it ) {
1766 BasicJobOP job =
new BasicJob( *it,
"resample", nstruct);
1767 tr.Debug <<
"create resample job" << *it << std::endl;
1768 input_jobs.push_back( job );
1771 BasicJobOP job =
new BasicJob(
"" ,
"abinitio_relax", nstruct);
1772 input_jobs.push_back( job );
1775 PlainSilentFileJobDistributor jobdist( input_jobs );
1779 bool bEndrun =
false;
1789 if ( !option[ OptionKeys::run::no_prof_info_in_silentout ]() ) {
1795 while ( jobdist.next_job(curr_job, curr_nstruct) && !bEndrun ) {
1796 time_t pdb_start_time = time(NULL);
1797 if ( run_time && !option[ OptionKeys::abinitio::no_write_failures ]() ) {
1802 std::cerr <<
"Starting work on structure: " << curr_job->output_tag(curr_nstruct) << std::endl;
1808 if (option[OptionKeys::run::show_simulation_in_pymol].user()
1809 && option[OptionKeys::run::show_simulation_in_pymol].value() > 0.0)
1812 option[OptionKeys::run::keep_pymol_simulation_history](),
1813 option[OptionKeys::run::show_simulation_in_pymol].value());
1819 Size njumps = option[jumps::njumps]();
1825 if ( option[ OptionKeys::abinitio::kill_hairpins ].user() ) {
1832 #ifdef BOINC_GRAPHICS
1834 protocols::boinc::Boinc::attach_graphics_current_pose_observer( fold_pose );
1848 if ( option[ OptionKeys::abinitio::perturb ].user() ) {
1849 Real sig = option[ OptionKeys::abinitio::perturb ];
1851 fold_pose.
set_phi( pos, fold_pose.
phi( pos ) + numeric::random::gaussian()*sig );
1852 fold_pose.
set_psi( pos, fold_pose.
psi( pos ) + numeric::random::gaussian()*sig );
1860 abinitio_protocol.
set_current_tag( jobdist.get_current_output_tag() );
1864 tr.Debug <<
"fold_pose is " << (fold_pose.
is_fullatom() ?
" fullatom " :
" centroid " ) <<
"before protocol run "<<std::endl;
1867 abinitio_protocol.
apply( fold_pose );
1869 bool loop_closure_failed(
false );
1871 if ( option[ OptionKeys::abinitio::close_loops ]()
1873 && !option[ OptionKeys::loopfcst::use_general_protocol ] )
1875 tr.Info <<
"OLD PATHWAY: close loops" << std::endl;
1876 loop_closure_failed = !
close_loops( fold_pose, centroid_scorefxn, jobdist.get_current_output_tag() );
1881 std::string silent_file = option[ basic::options::OptionKeys::out::file::silent ]() +
"_" +
"before_relax";
1884 process_decoy( fold_pose, fold_pose.
is_fullatom() ? *fullatom_scorefxn : *centroid_scorefxn, jobdist.get_current_output_tag(), *pss );
1890 if(option[OptionKeys::abinitio::membrane]){
1891 passes_filters=
true;
1893 bool bProcessDecoy(
true );
1897 if( option[ basic::options::OptionKeys::abinitio::relax_failures ]() ) bCanRelax =
true;
1898 bCanRelax = bCanRelax && passes_filters
1899 && ( !loop_closure_failed || option[ OptionKeys::abinitio::relax_with_jumps ]() );
1903 pose::Pose const centroid_pose ( fold_pose );
1908 res_switch.
apply( fold_pose );
1910 if ( option[ OptionKeys::constraints::cst_fa_file ].user() ) {
1916 if( option[ basic::options::OptionKeys::abinitio::close_loops_by_idealizing ]() ){
1922 std::max( (
int) 1,
int(cutpoint - 5) ),
1927 if( cloops->size() >= 2 )
1928 if( newloop.
start() <= ( *cloops )[cloops->size()-1].stop() ) newloop.
set_start( ( *cloops )[cloops->size()-1].stop() +2 );
1930 cloops->add_loop( newloop );
1933 cloops->auto_choose_cutpoints( fold_pose );
1942 idealizer.
fast(
false );
1943 idealizer.
apply( fold_pose );
1945 relax( fold_pose, fullatom_scorefxn, jobdist.get_current_output_tag() );
1947 if( option[ basic::options::OptionKeys::abinitio::optimize_cutpoints_using_kic ]() ){
1952 refine_kic.
apply( fold_pose );
1961 if ( option[ basic::options::OptionKeys::abinitio::multifastrelax ]() ) {
1962 bEndrun =
multi_fast_relax( abinitio_protocol, fullatom_scorefxn, jobdist, curr_nstruct, curr_job );
1963 bProcessDecoy =
false;
1964 if ( bEndrun )
break;
1966 relax( fold_pose, fullatom_scorefxn, jobdist.get_current_output_tag() );
1969 (*fullatom_scorefxn)( fold_pose );
1970 if ( option[ basic::options::OptionKeys::abinitio::fastrelax ]() ) {
1983 if ( bProcessDecoy ) {
1984 if( option[ run::checkpoint ]() ){
2001 if ( !passes_filters && loop_closure_failed ) {
2002 new_output_tag =
"X_"+new_output_tag.substr(2);
2003 }
else if( loop_closure_failed ) {
2004 new_output_tag =
"C_"+new_output_tag.substr(2);
2005 }
else if( !passes_filters ) {
2006 new_output_tag =
"F_"+new_output_tag.substr(2);
2008 new_output_tag =
"P_"+new_output_tag.substr(2);
2011 if ( !option[ OptionKeys::abinitio::no_write_failures ]()
2014 process_decoy( fold_pose, fold_pose.
is_fullatom() ? *fullatom_scorefxn : *centroid_scorefxn, new_output_tag, *pss );
2020 if ( option[ OptionKeys::out::pdb ] ) fold_pose.
dump_pdb(
std::string(option[ OptionKeys::out::path::path ]()) +
"/" + new_output_tag +
".pdb");
2022 if ( run_time && option[ OptionKeys::abinitio::no_write_failures ]() ) {
2028 jobdist.dump_silent( outsfd );
2032 time_t pdb_end_time = time(NULL);
2033 tr.Info <<
"Finished " << curr_job->output_tag(curr_nstruct) <<
" in " << (pdb_end_time - pdb_start_time) <<
" seconds." << std::endl;
2044 return left.second < right.second;
2058 std::cerr <<
"multi_fast_relax stubbed out" << std::endl;
2066 using namespace basic::options::OptionKeys;
2067 using namespace basic::options;
2070 if ( !option[ OptionKeys::abinitio::relax ]() &&
2071 !option[ OptionKeys::abinitio::fastrelax ]() )
return;
2077 if ( option[ constraints::no_cst_in_relax ] ) {
2084 if ( option[ OptionKeys::abinitio::detect_disulfide_before_relax ] ) {
2089 if ( option[ basic::options::OptionKeys::abinitio::fastrelax ]() ) {
2090 tr.Error <<
"WARNING: Using DEPRECATED OPTION fastrelax ! " << std::endl;
2091 option[ basic::options::OptionKeys::abinitio::relax ].def(
true );
2092 option[ basic::options::OptionKeys::relax::fast ].def(
true );
2094 if ( option[ OptionKeys::abinitio::relax ]() ) {
2103 if( option[ OptionKeys::loops::final_clean_fastrelax ]() ){
2108 fast_relax.
apply( pose );
2118 using namespace basic::options::OptionKeys;
2119 if ( !basic::options::option[ basic::options::OptionKeys::in::path::database ].user() ) {
2120 basic::options::option[ basic::options::OptionKeys::in::path::database ].def(
"/work/olange/minirosetta_database");
2124 if ( option [ OptionKeys::abinitio::rerun ] ) {
2129 if ( option [ OptionKeys::abinitio::jdist_rerun ] ) {
2138 std::cerr <<
"Setting up folding (abrelax) ..." << std::endl;
2143 std::cerr <<
"Beginning folding (abrelax) ... " << std::endl;
2145 fold( init_pose, prot_ptr );
2153 using namespace basic::options::OptionKeys;
2156 pose.
constraint_set()->show_violations( std::cout, pose, option[ constraints::viol_level ] );
2163 using namespace basic::options::OptionKeys;
2165 if ( !constraints_ ) {
2168 if ( option[ constraints::compute_total_dist_cst ]() ) {
2183 pca_->eval( pose, proj );