26 #include <utility/exit.hh>
27 #include <utility/string_util.hh>
28 #include <utility/vector1.hh>
29 #include <utility/excn/Exceptions.hh>
30 #include <utility/io/izstream.hh>
33 namespace pack_daemon {
59 pdb_pose_map_( src.pdb_pose_map_ ),
60 entity_id_2_resids_( src.entity_id_2_resids_ ),
61 resid_2_entity_id_( src.resid_2_entity_id_ ),
62 funcnames_( src.funcnames_ )
68 if (
this != &other ) {
81 using namespace core::pose;
83 if (
pose_ == 0 ||
pose_->total_residue() != pose->total_residue() ) {
88 if ( !
pose_->pdb_info() ) {
107 Size count_correspondences( 0 );
108 Size line_count( 0 );
112 Size entity_id( 0 ), residue_index( 0 );
117 getline( instream, line );
118 if ( line.size() == 0 )
continue;
120 std::istringstream linestream( line );
121 if (( linestream >> entity_id ).fail() ) {
122 throw utility::excn::EXCN_Msg_Exception(
123 "Failed to read entity id on line " + utility::to_string( line_count ) +
124 " of the EntityCorrespondence file:\n" + line );
126 ++count_correspondences;
128 throw utility::excn::EXCN_Msg_Exception(
129 "Entity ID read on line " + utility::to_string( line_count ) +
130 " of the EntityCorrespondence file exceeds the number of entities: " +
131 utility::to_string( entity_id ) +
" vs " + utility::to_string(
num_entities() ) );
134 if (( linestream >> PDBnum_string ).fail() ) {
135 throw utility::excn::EXCN_Msg_Exception(
136 "Failed to read PDB id for a residue on line " + utility::to_string( line_count ) +
137 " of the EntityCorrespondence file:\n" + line );
142 condition = std::isalpha(*PDBnum_string.rbegin());
144 condition = isalpha(*PDBnum_string.rbegin());
148 for (
Size ch = 0; ch < PDBnum_string.length()-1; ++ch ) {
149 if ( ! isdigit( PDBnum_string[ ch ] ) && ( ch != 0 || PDBnum_string[ ch ] !=
'-' )) {
150 throw utility::excn::EXCN_Msg_Exception(
151 "Failed to read PDB residue id on line " + utility::to_string( line_count ) +
152 " of the EntityCorrespondence file:\n" + line +
"\nCharacter" +
153 utility::to_string( ch + 1 ) +
" of '" + PDBnum_string +
"' is not a digit");
156 PDBnum = atoi( PDBnum_string.substr( 0, PDBnum_string.length() - 1 ).c_str() );
157 icode = *PDBnum_string.rbegin();
159 for (
Size ch = 0; ch < PDBnum_string.length(); ++ch ) {
160 if ( ! isdigit( PDBnum_string[ ch ] ) && ( ch != 0 || PDBnum_string[ ch ] !=
'-' )) {
161 throw utility::excn::EXCN_Msg_Exception(
162 "Failed to read PDB residue id on line " + utility::to_string( line_count ) +
163 " of the EntityCorrespondence file:\n" + line +
"\nCharacter" +
164 utility::to_string( ch + 1 ) +
" of '" + PDBnum_string +
"' is not a digit");
167 PDBnum = atoi( PDBnum_string.c_str() );
169 if ((linestream >> chain ).fail() ) {
170 throw utility::excn::EXCN_Msg_Exception(
171 "Failed to read a chain id for a PDB residue on line " + utility::to_string( line_count ) +
172 " of the EntityCorrespondence file:\n" + line );
174 if (chain ==
'_') chain =
' ';
178 if ( residue_index == 0 ) {
179 throw utility::excn::EXCN_Msg_Exception(
180 "Residue ID read on line " + utility::to_string( line_count ) +
181 " of the EntityCorrespondence file is not present in the pose: " +
182 PDBnum_string +
" ch: " + chain +
" vs pose.total_residue()= " + utility::to_string(
num_residues() ) );
220 return pose_->total_residue();
259 throw utility::excn::EXCN_Msg_Exception(
"EntityCorrespondence::" + funcname +
" "
260 "attempted to access information for entity " + utility::to_string( entity_id ) +
261 " (only " + utility::to_string(
num_entities() ) +
" entities exist)" );
271 throw utility::excn::EXCN_Msg_Exception(
"EntityCorrespondence::" + funcname +
" "
272 "invoked before pose_ pointer was set." );
275 throw utility::excn::EXCN_Msg_Exception(
"EntityCorrespondence::" + funcname +
" "
276 "attempted to access information for residue " + utility::to_string( resid ) +
277 " (only " + utility::to_string(
num_residues() ) +
" residues exist)" );