15 #include <protocols/enzdes/EnzdesFixBBProtocol.hh>
16 #include <protocols/enzdes/EnzdesFlexBBProtocol.hh>
18 #include <protocols/enzdes/enzdes_util.hh>
19 #include <protocols/enzdes/EnzFilters.hh>
22 #include <core/types.hh>
24 #include <core/pose/Pose.hh>
25 #include <core/pose/datacache/CacheableDataType.hh>
28 #include <protocols/toolbox/match_enzdes_util/EnzConstraintIO.hh>
30 #include <protocols/jobdist/standard_mains.hh>
31 #include <protocols/jobdist/JobDistributors.hh>
36 #include <core/io/silent/SilentStruct.hh>
37 #include <core/io/silent/ScoreFileSilentStruct.hh>
41 #include <basic/options/keys/out.OptionKeys.gen.hh>
42 #include <basic/options/keys/run.OptionKeys.gen.hh>
43 #include <basic/options/keys/enzdes.OptionKeys.gen.hh>
45 #include <core/io/silent/SilentFileData.hh>
52 #if defined(WIN32) || defined(__CYGWIN__)
65 main(
int argc,
char * argv [])
77 time_t overall_start_time = time(NULL);
86 protocols::jobdist::PlainPdbJobDistributor jobdist( input_jobs );
89 using namespace basic::options::OptionKeys;
91 if (
option[ out::nooutput ]() ) {
92 jobdist.disable_output();
93 jobdist.enable_ignorefinished();
97 protocols::enzdes::EnzdesBaseProtocolOP enzdes_protocol;
98 protocols::enzdes::EnzdesScorefileFilterOP enz_scofile;
100 if (
option[ OptionKeys::enzdes::flexbb_protocol ] ) enzdes_protocol = protocols::enzdes::EnzdesBaseProtocolOP(
new protocols::enzdes::EnzdesFlexBBProtocol() );
102 else enzdes_protocol = protocols::enzdes::EnzdesBaseProtocolOP(
new protocols::enzdes::EnzdesFixBBProtocol() );
104 std::string scorefile_name(
"");
106 if (
option[ OptionKeys::out::file::o ].
user() ) {
107 scorefile_name =
option[ OptionKeys::out::file::o ]();
108 enz_scofile = protocols::enzdes::EnzdesScorefileFilterOP(
new protocols::enzdes::EnzdesScorefileFilter() );
110 if (
option[ OptionKeys::out::overwrite ].
user() ) {
114 core::io::silent::SilentFileDataOP scorefile(
new core::io::silent::SilentFileData() );
116 if (
option[OptionKeys::enzdes::cstfile].
user() ) {
117 option[OptionKeys::run::preserve_header ].value(
true);
122 protocols::jobdist::BasicJobOP curr_job, prev_job;
123 int curr_nstruct=0, num_structures_processed = 0;
125 core::pose::PoseOP input_pose;
128 while ( jobdist.next_job(curr_job, curr_nstruct) ) {
129 time_t pdb_start_time = time(NULL);
130 tr <<
"Starting " << curr_job->output_tag(curr_nstruct) <<
" ..." << std::endl;
132 if ( curr_nstruct == 1 ) prevstruct = 0;
135 if ( curr_job.get() != prev_job.get() || input_pose.get() == NULL ) {
138 protocols::enzdes::enzutil::read_pose_from_pdb( *input_pose, curr_job->input_tag() );
143 std::string outext =
"_DE";
147 std::string prefix =
"";
154 if (
option[ OptionKeys::enzdes::process_ligrot_separately ].
user() ) {
156 (*enzdes_protocol->get_scorefxn() )( *the_pose );
157 enzdes_protocol->generate_explicit_ligand_rotamer_poses( *the_pose, poses_to_process, enzdes_protocol->get_scorefxn() );
159 if ( poses_to_process.size() == 0 ) poses_to_process.push_back( the_pose );
160 else tr <<
"For " << curr_job->input_tag() <<
", " << poses_to_process.size() <<
" explicit ligrot poses will be processed." << std::endl;
161 }
else poses_to_process.push_back( the_pose );
163 for (
core::Size pose_count = 1; pose_count <= poses_to_process.size(); ++pose_count ) {
167 std::string outtag = prefix + out_name.
base() +
"_" + outext +
"_" +
utility::to_string( pose_count + prevstruct );
170 tr <<
"File " << outtag+
".pdb" <<
" already exists, skipping structure. Use option -out::overwrite if you want to overwrite existing files." << std::endl;
174 using namespace basic::datacache;
175 (poses_to_process[ pose_count ])->
data().set(core::pose::datacache::CacheableDataType::JOBDIST_OUTPUT_TAG, DataCache_CacheableData::DataOP(
new basic::datacache::CacheableString( outtag ) ) );
176 enzdes_protocol->apply( *(poses_to_process[ pose_count ]) );
180 if ( !( (
option[OptionKeys::enzdes::enz_score] ) &&
181 (
option[ OptionKeys::out::file::o ].
user() ) &&
183 jobdist.dump_pose_and_map( outtag, *(poses_to_process[ pose_count ]) );
189 protocols::toolbox::match_enzdes_util::EnzConstraintIOCOP cstio( protocols::enzdes::enzutil::get_enzcst_io( *(poses_to_process[ pose_count ] ) ) );
190 enz_scofile->set_cstio( cstio );
191 core::io::silent::SilentStructOP ss(
new core::io::silent::ScoreFileSilentStruct(
192 *(poses_to_process[ pose_count ]), outtag ) );
194 ss->scoreline_prefix(
"" );
196 enz_scofile->examine_pose( *(poses_to_process[ pose_count ]) );
198 if (
option[OptionKeys::enzdes::final_repack_without_ligand] ) {
200 if (
option[OptionKeys::enzdes::dump_final_repack_without_ligand_pdb] ) {
201 jobdist.dump_pose_and_map( outtag+
"_nlrepack", *(enz_scofile->rnl_pose() ) );
205 ss->silent_energies( enz_scofile->silent_Es() );
206 scorefile->write_silent_struct( *ss, scorefile_name,
true );
210 prevstruct += poses_to_process.size();
213 num_structures_processed += 1;
214 time_t pdb_end_time = time(NULL);
216 tr <<
"Finished " << curr_job->output_tag(curr_nstruct) <<
" in " << (long)(pdb_end_time - pdb_start_time) <<
" seconds." << std::endl;
220 time_t overall_end_time = time(NULL);
221 tr <<
"Finished all " << num_structures_processed <<
" structures in " << (long)(overall_end_time - overall_start_time) <<
" seconds." << std::endl;
222 if ( num_structures_processed == 0 ) {
223 basic::Warning() <<
"No structures processed. Existing output files may have been skipped, did you mean to delete them or to use the -overwrite flag?" << std::endl;
228 std::cout <<
"caught exception " << e.
msg() << std::endl;
virtual std::string const msg() const
A DataCache storing objects derived from basic::datacache::CacheableData.
int main(int argc, char *argv[])
void init(int argc, char *argv[])
Command line init() version.
BooleanOptionKey const user("options:user")
Platform independent operations on files (except I/O)
static THREAD_LOCAL basic::Tracer tr("apps.public.enzdes.enzyme_design")
File name class supporting Windows and UN*X/Linux format names.
common derived classes for thrown exceptions
static void add_relevant(const OptionKey &key)
add OptionKey to list of application relevant options
std::vector with 1-based indexing
basic::options::IntegerOptionKey const nstruct("nstruct")
rule< Scanner, options_closure::context_t > options
int file_delete(std::string const &path)
Delete File.
Tracer & Warning(TracerPriority priority=t_warning)
Predefined Warning tracer.
utility::options::OptionCollection option
OptionCollection global.
ocstream cout(std::cout)
Wrapper around std::cout.
FileName & base(std::string const &base_a)
Base assignment.
vector1: std::vector with 1-based indexing
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
bool file_exists(std::string const &path)
Does File Exist?
std::string to_string(const T &t)
Some std::string helper functions.
Program options global and initialization function.
rule< Scanner, option_closure::context_t > option