55 #include <basic/Tracer.hh>
57 #include <ObjexxFCL/string.functions.hh>
60 #include <utility/exit.hh>
61 #include <utility/string_util.hh>
62 #include <utility/io/izstream.hh>
65 #include <utility/vector1.hh>
66 #include <boost/foreach.hpp>
69 #define foreach BOOST_FOREACH
75 namespace import_pose {
84 using namespace core::io::pdb;
85 using namespace ObjexxFCL;
87 basic::Tracer
TR(
"core.import_pose.import_pose");
113 if ( (!read_fold_tree) && (!options.
fold_tree_io()) )
return;
118 while(start < s.size()) {
119 if( s[i] ==
'\n' || s[i] ==
'\r' ) {
124 if( i == s.size() ) {
131 for (
Size i=1; i<= lines.size(); ++i ) {
135 if ( line.size() >= 16 && line.substr(0,16) ==
"REMARK FOLD_TREE" ) {
136 std::istringstream l( line );
141 TR <<
"setting foldtree from pdb file: " << f << std::endl;
144 TR.Fatal <<
"pose_io:: foldtree io failure: " << line <<
' ' << pose.
total_residue()
145 <<
' ' << f << std::endl;
165 pose_from_pdb( *pose, residue_set, filename, read_fold_tree);
178 pose_from_pdb(pose, residue_set, filenames_string, options, read_fold_tree);
195 utility::io::izstream file( filename );
197 TR.Error <<
"PDB File:" << filename <<
" not found!" << std::endl;
198 utility_exit_with_message(
"Cannot open PDB file \"" + filename +
"\"" );
200 TR.Debug <<
"read file: " << filename << std::endl;
202 utility::slurp( file, res );
212 fd.
filename = utility::join(filenames,
"_");
242 using namespace chemical;
269 using namespace chemical;
285 using namespace chemical;
298 using namespace chemical;
308 for ( vec_it it = filenames.begin(),
end = filenames.end(); it !=
end; ++it ) {
311 poses.push_back( pose );
331 poses->push_back(pose);
342 using namespace chemical;
350 for ( vec_it it = filenames.begin(),
end = filenames.end(); it !=
end; ++it ) {
353 poses.push_back( pose );
367 using namespace chemical;
384 pose_from_pdb( poses, residue_set, filename, options, read_fold_tree );
400 utility::io::izstream file( filename );
402 TR.Error <<
"File:" << filename <<
" not found!" << std::endl;
403 utility_exit_with_message(
"Cannot open file " + filename );
405 TR.Debug <<
"read file: " << filename << std::endl;
408 utility::slurp( file, all_lines );
410 all_lines =
"\n" + all_lines;
417 while( pos1 != std::string::npos )
419 pos1 = all_lines.find(
"\nMODEL ", pos1 );
420 if ( pos1 != std::string::npos )
427 TR.Debug <<
"Reading " << n_models <<
" poses." << std::endl;
429 if ( n_models == 0 ) n_models = 1;
430 poses.reserve( poses.size() + n_models );
434 pos1 = all_lines.find(
"\nMODEL ", pos1 );
436 if ( pos1 != std::string::npos ) {
438 while( pos2 != std::string::npos ) {
443 pos2 = all_lines.find(
"\nMODEL ", pos1);
444 sub_lines = all_lines.substr( pos1, pos2-pos1 ) ;
453 poses.push_back( pose );
463 poses.push_back( pose );
521 std::istream & pdb_stream,
526 utility::slurp( pdb_stream, pdb_file_contents );
540 using namespace chemical;
567 TR.Debug <<
"build_pose..." << std::endl;
569 TR.Debug <<
"build_pose... Ok." << std::endl;
601 using namespace chemical;
602 using namespace conformation;
603 typedef std::map< std::string, double > ResidueTemps;
604 typedef std::map< std::string, ResidueTemps > Temps;
605 typedef std::map< std::string, Vector > ResidueCoords;
606 typedef std::map< std::string, ResidueCoords > Coords;
642 using namespace core::chemical;
643 using namespace core::kinematics;
644 TR.Debug <<
"original fold tree: " << pose.
fold_tree() << std::endl;
652 Size last_jump_id = 0;
659 Size const ii = e.stop();
663 bool found_connection_residue_in_fold_tree(
false );
667 if ( jj_res_ID < ii){
678 newft.add_edge(jj_res_ID, ii, jj_connector, ii_connector);
680 found_connection_residue_in_fold_tree =
true;
686 if( ! found_connection_residue_in_fold_tree ) {
688 TR.Warning <<
"Can't find a chemical connection for residue " << ii <<
" " << pose.
residue_type(ii).
name() << std::endl;
690 if( e.is_jump() ) e.label() = ++last_jump_id;
694 if( e.is_jump() ) e.label() = ++last_jump_id;
699 runtime_assert( newft.size() > 0 || pose.
total_residue() == 0 );
701 TR.Debug <<
"new fold tree " << newft << std::endl;