26 #include <basic/Tracer.hh>
27 #include <basic/options/option.hh>
28 #include <utility/vector1.hh>
29 #include <utility/file/FileName.hh>
32 #include <boost/foreach.hpp>
33 #define foreach BOOST_FOREACH
39 #include <basic/options/keys/in.OptionKeys.gen.hh>
43 static basic::Tracer
tr(
"protocols.jd2.AtomTreeDiffJobInputter");
51 tr.Debug <<
"Instantiate AtomTreeDiffJobInputter" << std::endl;
64 tr.Debug <<
"AtomTreeDiffJobInputter::pose_from_job" << std::endl;
66 if ( !job->inner_job()->get_pose() ) {
69 tr.Debug <<
"filling pose from AtomTree (tag = " << job->input_tag() <<
")" << std::endl;
72 if ( atom_tree_diff_.has_ref_tag( job->input_tag() ) ) {
73 atom_tree_diff_.read_pose(job->input_tag(), pose);
74 }
else if( basic::options::option[ basic::options::OptionKeys::in::file::native ].user() ) {
77 tr <<
"Using -in:file:native for reference pose with AtomTreeDiff input format.";
80 atom_tree_diff_.read_pose(job->input_tag(), pose, native_pose);
82 utility_exit_with_message(
"Can't find the reference structure for job with input tag " + job->input_tag());
84 load_pose_into_job( pose, job );
88 pose = *(job->inner_job()->get_pose());
89 tr.Debug <<
"filling pose from saved copy (tag = " << job->input_tag() <<
")" << std::endl;
96 tr.Debug <<
"AtomTreeDiffJobInputter::fill_jobs" << std::endl;
103 using namespace basic::options;
104 using namespace basic::options::OptionKeys;
108 runtime_assert( atom_tree_diff_files.size() > 0 );
110 if( atom_tree_diff_files.size() != 1 ){
111 utility_exit_with_message(
"Code currently deals with only one input atom_tree_diff file" );
113 FileName file_name= atom_tree_diff_files.at(1);
114 tr.Debug <<
"reading " << file_name << std::endl;
116 atom_tree_diff_.read_file( file_name );
122 if ( option[ in::file::tags ].user() ) {
124 foreach(
string tag, option[ in::file::tags ]()){
125 if ( ! atom_tree_diff_.has_tag(tag) ) {
126 utility_exit_with_message(
"Input AtomTreeDiff file does not have tag "+tag);
128 core::import_pose::atom_tree_diffs::TagScoreMap::const_iterator tag_score_iter(atd_tsm.find(tag));
129 assert( tag_score_iter != atd_tsm.end() );
130 tags[tag] = tag_score_iter->second;
133 tags = atom_tree_diff_.get_tag_score_map();
136 if ( ! tags.size() ) {
137 utility_exit_with_message(
"No valid input structures found for AtomTreeDiff file.");
145 assert( tag_score.first == all_scores[tag_score.second].first );
150 if( basic::options::option[ basic::options::OptionKeys::in::file::keep_input_scores ] ) {
152 job->add_string_real_pair(score.first, score.second);
155 jobs.push_back( job );
175 return atom_tree_diff_.all_ref_poses();
182 return "AtomTreeDiffJobInputter";