Skip to content
Snippets Groups Projects
Commit 90e42dd6 authored by B13nch3n's avatar B13nch3n
Browse files

Make validation work with dictionary version 1.4.5 (info on PDBx dic split up...

Make validation work with dictionary version 1.4.5 (info on PDBx dic split up into its single components)
parent cc3ded3d
No related branches found
No related tags found
No related merge requests found
...@@ -80,7 +80,7 @@ COPY --chmod=755 validate-mmcif-file.py /usr/local/bin/validate-mmcif-file ...@@ -80,7 +80,7 @@ COPY --chmod=755 validate-mmcif-file.py /usr/local/bin/validate-mmcif-file
## https://github.com/ihmwg/ModelCIF/blob/master/dist/mmcif_ma.dic. ## https://github.com/ihmwg/ModelCIF/blob/master/dist/mmcif_ma.dic.
## Dictionaries do not change that frequently therefore we skip the hassle of ## Dictionaries do not change that frequently therefore we skip the hassle of
## keeping them in an external volume. ## keeping them in an external volume.
ARG USE_DICT_VERSION="1.4.4" ARG USE_DICT_VERSION="1.4.5"
ENV USE_DICT_VERSION=${USE_DICT_VERSION} ENV USE_DICT_VERSION=${USE_DICT_VERSION}
LABEL org.modelarchive.dict_release="${USE_DICT_VERSION}" LABEL org.modelarchive.dict_release="${USE_DICT_VERSION}"
WORKDIR ${SRC_DIR} WORKDIR ${SRC_DIR}
...@@ -118,9 +118,7 @@ RUN set -e pipefail; \ ...@@ -118,9 +118,7 @@ RUN set -e pipefail; \
-dictSdbFile ${MMCIF_DICTS_DIR}/mmcif_pdbx_v50.dic.sdb; \ -dictSdbFile ${MMCIF_DICTS_DIR}/mmcif_pdbx_v50.dic.sdb; \
# #
## Get versions of ModelCIF & PDBx/mmCIF dictionaries ## Get versions of ModelCIF & PDBx/mmCIF dictionaries
get-mmcif-dict-versions --parent-location ${_GIT_URL}/base/mmcif_pdbx_v50.dic \ get-mmcif-dict-versions --child-location ${_MA_DICT_URL} mmcif_ma.dic; \
--child-location ${_MA_DICT_URL} \
mmcif_ma.dic; \
mv mmcif_ma_version.json ${MMCIF_DICTS_DIR}/; \ mv mmcif_ma_version.json ${MMCIF_DICTS_DIR}/; \
# #
## Make SDBs readable and keep possible error logs from building them ## Make SDBs readable and keep possible error logs from building them
......
...@@ -25,15 +25,6 @@ def _parse_command_line(): ...@@ -25,15 +25,6 @@ def _parse_command_line():
metavar="<DICTIONARY FILE>", metavar="<DICTIONARY FILE>",
help="The mmCIF dictionary file to read the versions from.", help="The mmCIF dictionary file to read the versions from.",
) )
parser.add_argument(
"--parent",
"-p",
type=str,
metavar="<NAME OF PARENT DICT>",
help="Name of to the 'parent' dictionary. This is the one the other "
+ "dictionary is appended to. This is usually the mmcif_pdbx_v50.dic.",
default="mmcif_pdbx_v50.dic",
)
parser.add_argument( parser.add_argument(
"--output", "--output",
"-o", "-o",
...@@ -42,14 +33,6 @@ def _parse_command_line(): ...@@ -42,14 +33,6 @@ def _parse_command_line():
help="Path to store the JSON file with the version at.", help="Path to store the JSON file with the version at.",
default="mmcif_ma_version.json", default="mmcif_ma_version.json",
) )
parser.add_argument(
"--parent-location",
"-u",
type=str,
metavar="<URL OF PARENT DICT FILE>",
help="Download location of the parent dictionary file.",
default=None,
)
parser.add_argument( parser.add_argument(
"--child-location", "--child-location",
"-l", "-l",
...@@ -90,7 +73,7 @@ def _get_data_item(itm, cat, file_name, cat_data): ...@@ -90,7 +73,7 @@ def _get_data_item(itm, cat, file_name, cat_data):
return val[0] return val[0]
def _get_versions(dic_file, parent_name, io_adapter): def _get_versions(dic_file, io_adapter):
"""Fetch the 'category_group_list' object and assemble a version for the """Fetch the 'category_group_list' object and assemble a version for the
dictionary.""" dictionary."""
...@@ -112,24 +95,11 @@ def _get_versions(dic_file, parent_name, io_adapter): ...@@ -112,24 +95,11 @@ def _get_versions(dic_file, parent_name, io_adapter):
ttl = _get_data_item("title", "dictionary", dic_file, dic) ttl = _get_data_item("title", "dictionary", dic_file, dic)
dic_version = {"title": ttl, "version": vrsn} dic_version = {"title": ttl, "version": vrsn}
cmp = _get_data_cat("pdbx_dictionary_component", dic_file, cntnr) return dic_version
dc_idx = cmp.getAttributeIndex("dictionary_component_id")
vs_idx = cmp.getAttributeIndex("version")
for row in cmp:
if row[dc_idx] == parent_name:
vrsn = row[vs_idx]
prnt_version = {"title": parent_name, "version": vrsn}
break
return dic_version, prnt_version
def _add_dict_location(parent, child, parent_loc, child_loc): def _add_dict_location(child, child_loc):
"""Add URLs to the dictionary versions if available.""" """Add URLs to the dictionary versions if available."""
if parent_loc is None:
parent["location"] = "."
else:
parent["location"] = parent_loc
if child_loc is None: if child_loc is None:
child["location"] = "." child["location"] = "."
else: else:
...@@ -141,13 +111,11 @@ def _main(): ...@@ -141,13 +111,11 @@ def _main():
opts = _parse_command_line() opts = _parse_command_line()
io_adapter = IoAdapterPy(False, sys.stdout) io_adapter = IoAdapterPy(False, sys.stdout)
c_vrsn, p_vrsn = _get_versions(opts.dic_file, opts.parent, io_adapter) c_vrsn = _get_versions(opts.dic_file, io_adapter)
_add_dict_location( _add_dict_location(c_vrsn, opts.child_location)
p_vrsn, c_vrsn, opts.parent_location, opts.child_location
)
with open(opts.output, "w", encoding="utf8") as jfh: with open(opts.output, "w", encoding="utf8") as jfh:
json.dump({"versions": [p_vrsn, c_vrsn]}, jfh) json.dump({"versions": [c_vrsn]}, jfh)
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment