Skip to content

Commit

Permalink
meta: add missing items to SoftwareItem
Browse files Browse the repository at this point in the history
  • Loading branch information
keitaroyam committed Jul 17, 2024
1 parent 9deb88a commit 8593552
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions include/gemmi/metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ struct SoftwareItem {
std::string version;
std::string date;
std::string description;
std::string contact_author;
std::string contact_author_email;
Classification classification = Unspecified;
};

Expand Down
3 changes: 2 additions & 1 deletion include/gemmi/serialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ SERIALIZE(AtomAddress, o.chain_name, o.res_id, o.atom_name, o.altloc)
SERIALIZE(Metadata, o.authors, o.experiments, o.crystals, o.refinement,
o.software, o.solved_by, o.starting_model, o.remark_300_detail)

SERIALIZE(SoftwareItem, o.name, o.version, o.date, o.description, o.classification)
SERIALIZE(SoftwareItem, o.name, o.version, o.date, o.description, o.classification,
o.contact_author, o.contact_author_email)

SERIALIZE(ReflectionsInfo, o.resolution_high, o.resolution_low, o.completeness,
o.redundancy, o.r_merge, o.r_sym, o.mean_I_over_sigma)
Expand Down
2 changes: 2 additions & 0 deletions python/meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ void add_meta(py::module& m) {
.def_readwrite("version", &SoftwareItem::version)
.def_readwrite("date", &SoftwareItem::date)
.def_readwrite("classification", &SoftwareItem::classification)
.def_readwrite("contact_author", &SoftwareItem::contact_author)
.def_readwrite("contact_author_email", &SoftwareItem::contact_author_email)
;
py::class_<ReflectionsInfo>(m, "ReflectionsInfo")
.def(py::init<>())
Expand Down
6 changes: 5 additions & 1 deletion src/mmcif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,9 @@ Structure make_structure_from_block(const cif::Block& block_) {
"?classification",
"?version",
"?date",
"?description"})) {
"?description",
"?contact_author",
"?contact_author_email"})) {
st.meta.software.emplace_back();
SoftwareItem& item = st.meta.software.back();
item.name = row.str(0);
Expand All @@ -638,6 +640,8 @@ Structure make_structure_from_block(const cif::Block& block_) {
copy_string(row, 2, item.version);
copy_string(row, 3, item.date);
copy_string(row, 4, item.description);
copy_string(row, 5, item.contact_author);
copy_string(row, 6, item.contact_author_email);
}

std::vector<std::string> ncs_oper_tags = transform_tags("matrix", "vector");
Expand Down
7 changes: 5 additions & 2 deletions src/to_mmcif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,8 @@ void update_mmcif_block(const Structure& st, cif::Block& block, MmcifOutputGroup

if (groups.software && !st.meta.software.empty()) {
cif::Loop& loop = block.init_mmcif_loop("_software.",
{"pdbx_ordinal", "classification", "name", "version", "date", "description"});
{"pdbx_ordinal", "classification", "name", "version", "date", "description",
"contact_author", "contact_author_email"});
int ordinal = 0;
for (const SoftwareItem& item : st.meta.software)
loop.add_row({
Expand All @@ -1184,7 +1185,9 @@ void update_mmcif_block(const Structure& st, cif::Block& block, MmcifOutputGroup
cif::quote(item.name),
string_or_dot(item.version),
string_or_qmark(item.date),
string_or_qmark(item.description)});
string_or_qmark(item.description),
string_or_qmark(item.contact_author),
string_or_qmark(item.contact_author_email)});
}
}

Expand Down

0 comments on commit 8593552

Please sign in to comment.