Commit fb2ad7b7 by Maarten L. Hekkelman

Fix in REMARK3 parser for more strict mmcif_pdbx dictionary

parent 24aa7a70
......@@ -807,11 +807,17 @@ float monomer::chi(size_t nr) const
atoms.back() = "CG2";
}
result = static_cast<float>(dihedral_angle(
get_atom_by_atom_id(atoms[nr + 0]).get_location(),
get_atom_by_atom_id(atoms[nr + 1]).get_location(),
get_atom_by_atom_id(atoms[nr + 2]).get_location(),
get_atom_by_atom_id(atoms[nr + 3]).get_location()));
auto atom_0 = get_atom_by_atom_id(atoms[nr + 0]);
auto atom_1 = get_atom_by_atom_id(atoms[nr + 1]);
auto atom_2 = get_atom_by_atom_id(atoms[nr + 2]);
auto atom_3 = get_atom_by_atom_id(atoms[nr + 3]);
if (atom_0 and atom_1 and atom_2 and atom_3)
result = static_cast<float>(dihedral_angle(
atom_0.get_location(),
atom_1.get_location(),
atom_2.get_location(),
atom_3.get_location()));
}
}
catch (const std::exception &e)
......
......@@ -3359,7 +3359,7 @@ std::tuple<int, int> WriteCoordinatesForModel(std::ostream &pdbFile, const datab
auto &atom_site_anisotrop = db["atom_site_anisotrop"];
auto &entity = db["entity"];
auto &pdbx_poly_seq_scheme = db["pdbx_poly_seq_scheme"];
auto &pdbx_nonpoly_scheme = db["pdbx_nonpoly_scheme"];
// auto &pdbx_nonpoly_scheme = db["pdbx_nonpoly_scheme"];
auto &pdbx_branch_scheme = db["pdbx_branch_scheme"];
int serial = 1;
......@@ -3434,16 +3434,26 @@ std::tuple<int, int> WriteCoordinatesForModel(std::ostream &pdbFile, const datab
r.get("id", "group_PDB", "label_atom_id", "label_alt_id", "auth_comp_id", "auth_asym_id", "auth_seq_id",
"pdbx_PDB_ins_code", "Cartn_x", "Cartn_y", "Cartn_z", "occupancy", "B_iso_or_equiv", "type_symbol", "pdbx_formal_charge");
int entity_id = r.get<int>("label_entity_id");
auto type = entity.find1<std::string>("id"_key == entity_id, "type");
if (type == "branched") // find the real auth_seq_num, since sugars have their auth_seq_num reused as sugar number... sigh.
resSeq = pdbx_branch_scheme.find1<int>("asym_id"_key == r.get<std::string>("label_asym_id") and "pdb_seq_num"_key == resSeq, "auth_seq_num");
// else if (type == "non-polymer") // same for non-polymers
// resSeq = pdbx_nonpoly_scheme.find1<int>("asym_id"_key == r.get<std::string>("label_asym_id") and "pdb_seq_num"_key == resSeq, "auth_seq_num");
else if (type == "polymer")
resSeq = pdbx_poly_seq_scheme.find1<int>("asym_id"_key == r.get<std::string>("label_asym_id") and "pdb_seq_num"_key == resSeq, "auth_seq_num");
if (resName != "HOH")
{
int entity_id = r.get<int>("label_entity_id");
try
{
auto type = entity.find1<std::string>("id"_key == entity_id, "type");
if (type == "branched") // find the real auth_seq_num, since sugars have their auth_seq_num reused as sugar number... sigh.
resSeq = pdbx_branch_scheme.find1<int>("asym_id"_key == r.get<std::string>("label_asym_id") and "pdb_seq_num"_key == resSeq, "auth_seq_num");
// else if (type == "non-polymer") // same for non-polymers
// resSeq = pdbx_nonpoly_scheme.find1<int>("asym_id"_key == r.get<std::string>("label_asym_id") and "pdb_seq_num"_key == resSeq, "auth_seq_num");
else if (type == "polymer")
resSeq = pdbx_poly_seq_scheme.find1<int>("asym_id"_key == r.get<std::string>("label_asym_id") and "pdb_seq_num"_key == resSeq, "auth_seq_num");
}
catch (const std::exception &ex)
{
std::cerr << "Oops, there was not exactly one entity with id " << entity_id << std::endl;
}
}
if (chainID.length() > 1)
throw std::runtime_error("Chain ID " + chainID + " won't fit into a PDB file");
......
......@@ -1233,7 +1233,9 @@ void Remark3Parser::storeCapture(const char *category, std::initializer_list<con
{
cat.emplace({ // #warning("crystal id, diffrn id, what should be put here?")
{ "crystal_id", 1 },
{ "diffrn_id", 1 } });
{ "diffrn_id", 1 },
{ "operator", "" },
{ "fraction", 0.f } });
}
else if (iequals(category, "reflns"))
cat.emplace({ { "pdbx_ordinal", cat.size() + 1 },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment