Skip to content
Snippets Groups Projects
Commit 2a25ef9a authored by Gerardo Tauriello's avatar Gerardo Tauriello
Browse files

Cleaning up code/doc/tests of consistency checks.

parent 253ab131
No related branches found
No related tags found
No related merge requests found
......@@ -1075,7 +1075,7 @@ The following function detects steric clashes in atomic structures. Two atoms ar
The function requires a reference structure and a probe structure. The
function checks that all the residues in the reference structure that appear
in the probe structure (i.e., that have the same ResNum) are of the same
residue type. Chains are comapred by order, not by chain name (i.e.: the first
residue type. Chains are compared by order, not by chain name (i.e.: the first
chain of the reference will be compared with the first chain of the probe
structure, etc.)
......
......@@ -31,21 +31,29 @@ bool ResidueNamesMatch(const EntityView& probe, const EntityView& reference,
ChainViewList ref_chains = reference.GetChainList();
ChainViewList probe_chains = probe.GetChainList();
for (unsigned int rci = 0; rci < ref_chains.size(); ++rci) {
ChainView ref_chain= ref_chains[rci];
if (rci<probe_chains.size()) {
ChainView ref_chain = ref_chains[rci];
if (rci < probe_chains.size()) {
ChainView probe_chain = probe_chains[rci];
ResidueViewList ref_residues = ref_chain.GetResidueList();
for (ResidueViewList::iterator rri=ref_residues.begin(), rre=ref_residues.end(); rri!=rre; ++rri) {
for (ResidueViewList::iterator rri = ref_residues.begin(),
rre = ref_residues.end(); rri != rre; ++rri) {
ResidueView probe_residue = probe_chain.FindResidue(rri->GetNumber());
if (probe_residue.IsValid()) {
if (probe_residue.GetName()!=rri->GetName()) {
return_value = false;
if (log_as_error) {
LOG_ERROR("Name mismatch for residue " << probe_residue.GetNumber() << ": in the reference structure(s) is " << rri->GetName() << ", in the model " << probe_residue.GetName());
LOG_ERROR("Name mismatch for residue "
<< probe_residue.GetNumber()
<< ": in the reference structure(s) is "
<< rri->GetName() << ", in the model "
<< probe_residue.GetName());
} else {
LOG_WARNING("Name mismatch for residue " << probe_residue.GetNumber() << ": in the reference structure(s) is " << rri->GetName() << ", in the model " << probe_residue.GetName());
LOG_WARNING("Name mismatch for residue "
<< probe_residue.GetNumber()
<< ": in the reference structure(s) is "
<< rri->GetName() << ", in the model "
<< probe_residue.GetName());
}
}
}
}
......
......@@ -35,37 +35,40 @@ BOOST_AUTO_TEST_SUITE( mol_alg );
BOOST_AUTO_TEST_CASE(consistency_check)
{
EntityHandle a=CreateEntity();
XCSEditor eda=a.EditXCS();
ChainHandle ca=eda.InsertChain("A");
ResidueHandle r1a = eda.AppendResidue(ca, "ALA",1);
ResidueHandle r2a = eda.AppendResidue(ca, "TYR",2);
ResidueHandle r3a = eda.AppendResidue(ca, "LEU",3);
ResidueHandle r4a = eda.AppendResidue(ca, "GLY",4);
ChainHandle ca2=eda.InsertChain("C");
ResidueHandle r1a2 = eda.AppendResidue(ca2, "PRO",1);
EntityHandle a = CreateEntity();
XCSEditor eda = a.EditXCS();
ChainHandle ca = eda.InsertChain("A");
ResidueHandle r1a = eda.AppendResidue(ca, "ALA", 1);
ResidueHandle r2a = eda.AppendResidue(ca, "TYR", 2);
ResidueHandle r3a = eda.AppendResidue(ca, "LEU", 3);
ResidueHandle r4a = eda.AppendResidue(ca, "GLY", 4);
ChainHandle ca2 = eda.InsertChain("C");
ResidueHandle r1a2 = eda.AppendResidue(ca2, "PRO", 1);
EntityHandle b = CreateEntity();
XCSEditor edb = b.EditXCS();
ChainHandle cb = edb.InsertChain("A");
ResidueHandle r1b = edb.AppendResidue(cb, "ALA", 1);
ResidueHandle r2b = edb.AppendResidue(cb, "TYR", 2);
ResidueHandle r3b = edb.AppendResidue(cb, "LEU", 3);
ResidueHandle r4b = edb.AppendResidue(cb, "GLY", 4);
ResidueHandle r5b = edb.AppendResidue(cb, "PRO", 5);
EntityHandle b=CreateEntity();
XCSEditor edb=b.EditXCS();
ChainHandle cb=edb.InsertChain("A");
ResidueHandle r1b = edb.AppendResidue(cb, "ALA",1);
ResidueHandle r2b = edb.AppendResidue(cb, "TYR",2);
ResidueHandle r3b = edb.AppendResidue(cb, "LEU",3);
ResidueHandle r4b = edb.AppendResidue(cb, "GLY",4);
ResidueHandle r5b = edb.AppendResidue(cb, "PRO",5);
EntityHandle c=CreateEntity();
XCSEditor edc=c.EditXCS();
ChainHandle cc=edc.InsertChain("A");
ResidueHandle r1c = edc.AppendResidue(cc, "ALA",1);
ResidueHandle r2c = edc.AppendResidue(cc, "PRO",2);
ResidueHandle r3c = edc.AppendResidue(cc, "LEU",3);
ResidueHandle r4c = edc.AppendResidue(cc, "GLY",4);
EntityHandle c = CreateEntity();
XCSEditor edc = c.EditXCS();
ChainHandle cc = edc.InsertChain("A");
ResidueHandle r1c = edc.AppendResidue(cc, "ALA", 1);
ResidueHandle r2c = edc.AppendResidue(cc, "PRO", 2);
ResidueHandle r3c = edc.AppendResidue(cc, "LEU", 3);
ResidueHandle r4c = edc.AppendResidue(cc, "GLY", 4);
BOOST_CHECK(ost::mol::alg::ResidueNamesMatch(a.CreateFullView(),b.CreateFullView())==true);
BOOST_CHECK(ost::mol::alg::ResidueNamesMatch(c.CreateFullView(),b.CreateFullView())==false);
const EntityView eva = a.CreateFullView();
const EntityView evb = b.CreateFullView();
const EntityView evc = c.CreateFullView();
BOOST_CHECK(ResidueNamesMatch(eva, evb) == true);
BOOST_CHECK(ResidueNamesMatch(evb, eva) == true);
BOOST_CHECK(ResidueNamesMatch(evc, evb) == false);
BOOST_CHECK(ResidueNamesMatch(evb, evc) == false);
}
BOOST_AUTO_TEST_SUITE_END();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment