diff --git a/modules/mol/alg/doc/molalg.rst b/modules/mol/alg/doc/molalg.rst index 8c9322a30b882a7238a620bee273716f42343232..d1957af348352fef64244f099abd962f7e29d2fe 100644 --- a/modules/mol/alg/doc/molalg.rst +++ b/modules/mol/alg/doc/molalg.rst @@ -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.) diff --git a/modules/mol/alg/src/consistency_checks.cc b/modules/mol/alg/src/consistency_checks.cc index ddbecd43d343dfed1a9684adaa96b4eb9e512126..f476f3ad685ba3ca02087be57c72e0bbfed44a86 100644 --- a/modules/mol/alg/src/consistency_checks.cc +++ b/modules/mol/alg/src/consistency_checks.cc @@ -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()); } - } } } diff --git a/modules/mol/alg/tests/test_consistency_checks.cc b/modules/mol/alg/tests/test_consistency_checks.cc index ffc21d43c3e13b938b7633ff93fe411b638d758d..657c3076f47f7518f541c15af8bbe7e0e2c90fd6 100644 --- a/modules/mol/alg/tests/test_consistency_checks.cc +++ b/modules/mol/alg/tests/test_consistency_checks.cc @@ -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();