16 #include <core/types.hh>
18 #include <core/chemical/ResidueTypeSet.fwd.hh>
19 #include <core/chemical/ChemicalManager.hh>
21 #include <core/pose/Pose.hh>
22 #include <core/pose/util.hh>
30 #include <core/scoring/ScoreFunction.hh>
31 #include <core/scoring/ScoreFunctionFactory.hh>
33 #include <core/import_pose/pose_stream/PoseInputStream.fwd.hh>
34 #include <core/import_pose/pose_stream/SilentFilePoseInputStream.hh>
36 #include <core/pose/symmetry/util.hh>
45 #include <basic/options/keys/in.OptionKeys.gen.hh>
46 #include <basic/options/keys/out.OptionKeys.gen.hh>
47 #include <basic/options/keys/score.OptionKeys.gen.hh>
51 #include <boost/algorithm/string/erase.hpp>
57 main(
int argc,
char* argv [] ) {
64 OPT(in::file::silent_struct_type);
65 OPT(in::file::silent_renumber);
66 OPT(out::file::residue_type_set);
69 OPT(in::file::rescore);
73 using namespace core::chemical;
74 using namespace core::import_pose::pose_stream;
76 using namespace basic::options::OptionKeys;
81 std::string usage(
"");
82 usage +=
"\n\nusage: extract_pdbs [options] -in::file::silent <silent_files>\n";
83 usage +=
"\tTo see a list of other valid options, use the option -help.\n";
92 core::chemical::ResidueTypeSetCOP rsd_set( NULL );
93 if (
option[ out::file::residue_type_set ].
user() ) {
94 rsd_set = ChemicalManager::get_instance()->residue_type_set(
95 option[ out::file::residue_type_set ]()
98 PoseInputStreamOP
input;
101 input = PoseInputStreamOP(
new SilentFilePoseInputStream(
103 option[ in::file::tags ]()
105 }
else if (
option[ in::file::tagfile ].
user() ) {
109 std::copy( std::istream_iterator< std::string >( tag_file ), std::istream_iterator< std::string >(),
110 std::back_inserter( input_tags ) );
118 core::scoring::ScoreFunctionOP
scorefxn;
120 if (
option[ in::file::rescore ]() ) {
121 scorefxn = core::scoring::get_score_function();
122 tr.
Debug <<
"scoring using ScoreFunction with weights: " << std::endl;
128 std::string out_prefix =
option[ out::prefix ]();
129 while (
input->has_another_pose() ) {
131 if ( core::pose::symmetry::is_symmetric(
pose ) ) {
132 core::pose::symmetry::make_asymmetric_pose(
pose );
143 map< string, string > score_line_strings( core::pose::get_all_score_line_strings(
pose ) );
145 end = score_line_strings.end();
147 if ( it->first !=
"aln_id" )
continue;
148 core::pose::add_comment(
pose,
"parents", it->second );
150 std::string
tag( tag_from_pose(
pose ) );
152 if ( tag.find(
".pdb" ) != std::string::npos ) {
153 tag.erase( tag.find(
".pdb" ) , tag.size() );
155 std::string fn( out_prefix + tag +
".pdb" );
157 tr <<
"extracting Pose with tag " << tag <<
" into PDB file " << fn
160 if (
option[ in::file::rescore ]() ) {
161 tr.
Debug <<
"rescoring Pose with tag " << tag << std::endl;
179 std::cout <<
"caught exception " << e.
msg() << std::endl;
ocstream cerr(std::cerr)
Wrapper around std::cerr.
virtual std::string const msg() const
utility::keys::KeyLookup< KeyType >::const_iterator const_iterator
Key collection iterators.
void init(int argc, char *argv[])
Command line init() version.
BooleanOptionKey const user("options:user")
utility::keys::lookup::end< KeyType > const end
common derived classes for thrown exceptions
izstream: Input file stream wrapper for uncompressed and compressed files
Input file stream wrapper for uncompressed and compressed files.
rule< Scanner, options_closure::context_t > options
ocstream cout(std::cout)
Wrapper around std::cout.
BooleanOptionKey const exit("options:exit")
vector1: std::vector with 1-based indexing
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
Program options global and initialization function.
rule< Scanner, tag_closure::context_t > tag
THREAD_LOCAL basic::Tracer tr("struc_set_fragment_picker")
int const silent
Named verbosity levels.
rule< Scanner, option_closure::context_t > option