Skip to content
Snippets Groups Projects
Commit f221d10e authored by Marco Biasini's avatar Marco Biasini
Browse files

don't throw but warn in case of microheterogeneity

parent 5ac78bec
No related branches found
No related tags found
No related merge requests found
......@@ -609,15 +609,22 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num,
LOG_DEBUG("adding atom " << aname << " (" << s_ele << ") @" << apos);
mol::AtomHandle ah;
if (curr_residue_.GetName()!=res_name.str()) {
if (!profile_.fault_tolerant) {
if (!profile_.fault_tolerant && alt_loc==' ') {
std::stringstream ss;
ss << "error on line " << line_num << ": "
<< "residue with number " << res_num << " has more than one name.";
throw IOException(ss.str());
}
if (!warned_name_mismatch_) {
LOG_INFO("Residue with number " << res_num << " has more than one name."
"Ignoring atoms for everything but the first");
if (alt_loc==' ') {
LOG_WARNING("Residue with number " << res_num << " has more than one name."
"Ignoring atoms for everything but the first");
} else {
LOG_WARNING("Residue with number " << res_num
<< " contains a microheterogeneity. Everything but atoms for "
<< "the residue '" << curr_residue_.GetName()
<< "' will be ignored");
}
}
warned_name_mismatch_=true;
return;
......
......@@ -429,7 +429,7 @@ BOOST_AUTO_TEST_CASE(res_name_too_long)
}
BOOST_AUTO_TEST_CASE(res_name_mismatch_tolerant)
BOOST_AUTO_TEST_CASE(res_name_mismatch_alt_loc)
{
String fname("testfiles/pdb/arg-glu-gln.pdb");
IOProfile profile;
......@@ -442,15 +442,40 @@ BOOST_AUTO_TEST_CASE(res_name_mismatch_tolerant)
BOOST_CHECK_EQUAL(ent.GetAtomCount(), 11);
}
BOOST_AUTO_TEST_CASE(res_name_mismatch_pedantic)
BOOST_AUTO_TEST_CASE(res_name_mismatch_alt_loc_pedantic)
{
String fname("testfiles/pdb/arg-glu-gln.pdb");
IOProfile profile;
PDBReader reader(fname, profile);
mol::EntityHandle ent=mol::CreateEntity();
BOOST_CHECK_NO_THROW(reader.Import(ent));
BOOST_CHECK_EQUAL(ent.GetChainCount(), 1);
BOOST_CHECK_EQUAL(ent.GetResidueCount(), 1);
BOOST_CHECK_EQUAL(ent.GetAtomCount(), 11);
}
BOOST_AUTO_TEST_CASE(res_name_mismatch_pedantic)
{
String fname("testfiles/pdb/more-than-one-name.pdb");
IOProfile profile;
PDBReader reader(fname, profile);
mol::EntityHandle ent=mol::CreateEntity();
BOOST_CHECK_THROW(reader.Import(ent), IOException);
}
BOOST_AUTO_TEST_CASE(res_name_mismatch_tolerant)
{
String fname("testfiles/pdb/more-than-one-name.pdb");
IOProfile profile;
profile.fault_tolerant=true;
PDBReader reader(fname, profile);
mol::EntityHandle ent=mol::CreateEntity();
BOOST_CHECK_NO_THROW(reader.Import(ent));
BOOST_CHECK_EQUAL(ent.GetChainCount(), 1);
BOOST_CHECK_EQUAL(ent.GetResidueCount(), 1);
BOOST_CHECK_EQUAL(ent.GetAtomCount(), 4);
}
BOOST_AUTO_TEST_CASE(seqres_import)
{
SetPrefixPath(getenv("OST_ROOT"));
......
ATOM 25 N TRP A 14 6.698 -48.684 24.846 1.00 52.82 N
ATOM 26 CA TRP A 14 6.905 -49.681 23.809 1.00 51.62 C
ATOM 27 C TRP A 14 8.347 -49.671 23.315 1.00 52.83 C
ATOM 28 O TRP A 14 8.982 -50.733 23.187 1.00 52.24 O
ATOM 29 N LYS A 14 8.863 -48.472 23.046 1.00 53.47 N
ATOM 30 CA LYS A 14 10.228 -48.320 22.537 1.00 54.31 C
ATOM 31 C LYS A 14 11.280 -48.867 23.508 1.00 54.74 C
ATOM 32 O LYS A 14 12.215 -49.573 23.109 1.00 52.47 O
END
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment