Merge rc187-sugaralt: sugar links within one conformer, warning for ignored restraint files
This commit is contained in:
commit
28056e8097
4 files changed
+44
-3
No files matched your search
+4
-3
@@ -58,9 +58,10 @@ rugnux --mode refine -o refined data.mtz model.cif
|
||||
```
|
||||
|
||||
Refines a model against merged data that already exist - an MTZ or a structure-factor mmCIF - and
|
||||
reads no images. The model is required, given among the inputs or with `--model`. Given a model and
|
||||
reflections among the inputs and no images, without `--mode`, rugnux takes `--mode refine`
|
||||
(`rugnux -o refined data.mtz model.cif`). A restraint dictionary for a ligand can be given among the
|
||||
reads no images. The model is required, given among the inputs or with `--model`. Without `--mode`,
|
||||
rugnux takes `--mode refine` when the inputs hold reflections and no images and a model is given -
|
||||
among the inputs or with `--model` (`rugnux -o refined data.mtz model.cif`,
|
||||
`rugnux -o refined --model model.cif data.mtz`). A restraint dictionary for a ligand can be given among the
|
||||
inputs as well (`--restraints`)
|
||||
([Refining a model against structure factors](RUGNUX_MODEL_AND_REFERENCE.md#refining-a-model-against-structure-factors-rugnux---mode-refine)).
|
||||
|
||||
|
||||
@@ -244,7 +244,9 @@ int AddSugarLinks(gemmi::Structure &st, const gemmi::MonLib &monlib) {
|
||||
for (gemmi::Chain &ch2 : model.chains)
|
||||
for (gemmi::Residue &r2 : ch2.residues)
|
||||
for (gemmi::Atom &a2 : r2.atoms) {
|
||||
// two conformers (A with B) are never bonded; a blank altloc pairs with any
|
||||
if (&r1 == &r2 || a1.is_hydrogen() || a2.is_hydrogen() || recorded.count({&a1, &a2}) ||
|
||||
(a1.altloc && a2.altloc && a1.altloc != a2.altloc) ||
|
||||
a1.pos.dist(a2.pos) > SUGAR_BOND_MAX ||
|
||||
std::get<0>(monlib.match_link(r1, a1.name, a1.altloc, r2, a2.name, a2.altloc)) == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -1858,6 +1858,10 @@ int RugnuxCli::Parse(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!restraint_files.empty()
|
||||
&& (!model || !(mode == RugnuxMode::Refine || (mode == RugnuxMode::MX && refine_model))))
|
||||
logger.Warning("The restraint files are ignored: this run refines no model (no model given, --no-refine, "
|
||||
"or a --mode without refinement)");
|
||||
for (const std::string &path : restraint_files) {
|
||||
try {
|
||||
std::ifstream f(path, std::ios::binary);
|
||||
|
||||
@@ -527,6 +527,40 @@ TEST_CASE("RefinementRestraints_glcnac", "[Refinement]") {
|
||||
CHECK(glycosidic == 1);
|
||||
}
|
||||
|
||||
// A GlcNAc on an Asn, both in two conformers A and B with no LINK record: the sugar links join A to A and B to B,
|
||||
// never the C1 of one conformer to the ND2 of the other, though that pair is within bonding distance too.
|
||||
TEST_CASE("RefinementRestraints_sugar_links_altloc", "[Refinement]") {
|
||||
const gemmi::UnitCell cell(50, 55, 60, 90, 90, 90);
|
||||
gemmi::Structure st = residue_crystal({"ASN", "NAG"}, cell, "P 1", 5);
|
||||
std::vector<gemmi::Residue> &res = st.models[0].chains[0].residues;
|
||||
// the ring moved for its C1 to be 1.43 A from ND2, and its O1 removed
|
||||
const gemmi::Position shift = res[0].find_atom("ND2", '*')->pos + gemmi::Position(1.43, 0, 0)
|
||||
- res[1].find_atom("C1", '*')->pos;
|
||||
for (gemmi::Atom &a : res[1].atoms)
|
||||
a.pos += shift;
|
||||
std::erase_if(res[1].atoms, [](const gemmi::Atom &a) { return a.name == "O1"; });
|
||||
// conformer B of both residues 0.6 A off A: C1(A)-ND2(B) is 1.55 A
|
||||
for (gemmi::Residue &r : res) {
|
||||
std::vector<gemmi::Atom> atoms;
|
||||
for (gemmi::Atom a : r.atoms) {
|
||||
a.occ = 0.5f;
|
||||
a.altloc = 'A';
|
||||
atoms.push_back(a);
|
||||
a.altloc = 'B';
|
||||
a.pos += gemmi::Position(0, 0.6, 0);
|
||||
atoms.push_back(a);
|
||||
}
|
||||
r.atoms = atoms;
|
||||
}
|
||||
const RefinementTopology topo = BuildRefinementTopology(st);
|
||||
CHECK(topo.sugar_links == 2);
|
||||
int same = 0, mixed = 0;
|
||||
for (const gemmi::Connection &c : st.connections)
|
||||
(c.partner1.altloc == c.partner2.altloc ? same : mixed)++;
|
||||
CHECK(same == 2);
|
||||
CHECK(mixed == 0);
|
||||
}
|
||||
|
||||
// A zinc bound by four cysteines (the dictionary's own ZN-CYS link) and a magnesium by six waters (links made from
|
||||
// the library's metal-site statistics), both from LINK records: the bonds come out at the expected distances,
|
||||
// and a metal set off its site returns there under them alone.
|
||||
|
||||
Reference in new issue
Block a user