diff --git a/.github/scripts/json_to_nef.py b/.github/scripts/json_to_nef.py new file mode 100644 index 0000000..3f835c9 --- /dev/null +++ b/.github/scripts/json_to_nef.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""Convert specification/v1_2_under_review/namespaces.json to namespaces.nef.""" + +import json +import pynmrstar +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parents[2] +VERSION = (REPO_ROOT / "specification" / "current_version").read_text().strip() +JSON_PATH = REPO_ROOT / "specification" / VERSION / "namespaces.json" +NEF_PATH = REPO_ROOT / "specification" / VERSION / "namespaces.nef" + + +def main(): + entries = json.loads(JSON_PATH.read_text(encoding="utf-8")) + + entry = pynmrstar.Entry.from_scratch("nef_namespaces_registry") + + sf = pynmrstar.Saveframe.from_scratch("nns_namespaces", tag_prefix="nns_namespaces") + sf.add_tag("sf_category", "nns_namespaces") + sf.add_tag("sf_framecode", "nns_namespaces") + + loop = pynmrstar.Loop.from_scratch(category="nns_namespaces_namespace") + for col in ("id", "name", "description", "url", "dictionary_url"): + loop.add_tag(col) + + for item in entries: + raw_url = item.get("url") or item.get("urls") or "." + url = (raw_url[0] if isinstance(raw_url, list) else raw_url) or "." + dict_url = item.get("dict_url") or "." + loop.add_data([ + item.get("id", "."), + item.get("name", "."), + item.get("description", "."), + url, + dict_url, + ]) + + sf.add_loop(loop) + entry.add_saveframe(sf) + + NEF_PATH.write_text(str(entry), encoding="utf-8") + print(f"Written {len(entries)} namespaces to {NEF_PATH}") + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/generate-namespaces-nef.yml b/.github/workflows/generate-namespaces-nef.yml new file mode 100644 index 0000000..bcfc5d3 --- /dev/null +++ b/.github/workflows/generate-namespaces-nef.yml @@ -0,0 +1,34 @@ +name: Generate namespaces.nef + +on: + push: + paths: + - 'specification/*/namespaces.json' + - 'specification/current_version' + workflow_dispatch: + +jobs: + generate: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install pynmrstar + run: pip install pynmrstar + + - name: Convert JSON to NEF + run: python .github/scripts/json_to_nef.py + + - name: Commit if changed + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add specification/v1_2_under_review/namespaces.nef + git diff --staged --quiet || git commit -m "chore: regenerate namespaces.nef from namespaces.json" + git push diff --git a/.github/workflows/update-current-symlink.yml b/.github/workflows/update-current-symlink.yml new file mode 100644 index 0000000..922cafe --- /dev/null +++ b/.github/workflows/update-current-symlink.yml @@ -0,0 +1,32 @@ +name: Update current symlink + +on: + push: + paths: + - 'specification/current_version' + workflow_dispatch: + +jobs: + update-symlink: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Update current symlink + run: | + VERSION=$(cat specification/current_version | tr -d '[:space:]') + if [ ! -d "specification/$VERSION" ]; then + echo "Error: specification/$VERSION does not exist" + exit 1 + fi + cd specification + rm -f current + ln -s "$VERSION" current + cd .. + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add specification/current + git diff --staged --quiet || git commit -m "chore: update current symlink to $VERSION" + git push diff --git a/namespaces.html b/namespaces.html new file mode 100644 index 0000000..080d7e9 --- /dev/null +++ b/namespaces.html @@ -0,0 +1,177 @@ + + + + + + NEF Namespaces Registry + + + + +

NEF Namespace Registry

+ +
+ The raw data for this table can be found at: + . + To register your own namespace raise an issue at this repository requesting one. +
+ + + + + + + + + + + + + + +
NamespaceNameDescriptionResourcesDictionary
Initializing registry...
+ + + + \ No newline at end of file diff --git a/specification/current b/specification/current new file mode 120000 index 0000000..639f8d2 --- /dev/null +++ b/specification/current @@ -0,0 +1 @@ +v1_1 \ No newline at end of file diff --git a/specification/current_version b/specification/current_version new file mode 100644 index 0000000..4f966e3 --- /dev/null +++ b/specification/current_version @@ -0,0 +1 @@ +v1_1 diff --git a/specification/v1_1/namespaces.json b/specification/v1_1/namespaces.json new file mode 100644 index 0000000..05b0f96 --- /dev/null +++ b/specification/v1_1/namespaces.json @@ -0,0 +1,21 @@ +[ + { "id": "nef", "name": "NEF Standard", "description": "Data Exchange", "url": "https://github.com/NMRExchangeFormat/NEF", + "dict_url": "https://github.com/NMRExchangeFormat/NEF/blob/master/specification/v1_1/mmcif_nef_v1_1.dic"}, + { "id": "nefpls", "name": "NEF Pipelines", "description": "Format transcoding and NEF manipulation", "url": "https://github.com/varioustoxins/NEF-Pipelines" }, + + { "id": "amber", "name": "Amber", "description": "Structure modelling and refinement", "url": "https://ambermd.org" }, + { "id": "aria", "name": "Aria", "description": "Structure calculation", "url": "https://aria.pasteur.fr" }, + { "id": "ccpn", "name": "CcpNmr Analysis", "description": "NMR spectra processing and data analysis", "url": "https://ccpn.ac.uk" }, + { "id": "csrosetta", "name": "CS-Rosetta", "description": "Structure calculation", "url": "https://web.archive.org/web/20240421045134/https://csrosetta.chemistry.ucsc.edu/", + "comment": "the original version by the Bax group is still available at https://spin.niddk.nih.gov/bax/software/CSROSETTA/, the archive on the wayback machine at \"https://web.archive.org/web/20240421045134/https://csrosetta.chemistry.ucsc.edu/most probably contains the most complete reference" + }, + { "id": "cyana", "name": "Cyana", "description": "Structure calculation", "url": "http://www.cyana.org" }, + { "id": "meld", "name": "MELD", "description": "Structure modelling and refinement", "url": "https://meldmd.org" }, + { "id": "NMRFx", "name": "NMRFx", "description": "Structure calculation", "url": "https://nmrfx.org" }, + { "id": "pdbstat", "name": "PDBStat", "description": "NMR data validation", "url": "https://github.rpi.edu/RPIBioinformatics/PDBStat_public" }, + { "id": "unio", "name": "Unio NMR", "description": "Structure calculation", "url": "https://unio-nmr.fr" }, + { "id": "unres", "name": "Unres", "description": "Structure modelling and refinement", "url": "http://www.unres.pl" }, + { "id": "pdbx", "name": "wwPDB/BMRB", "description": "Database", "url": "https://www.wwpdb.org" }, + { "id": "XplorNIH", "name": "Xplor-NIH", "description": "Structure calculation and refinement", "url": "https://nmr.cit.nih.gov/xplor-nih/" }, + { "id": "yasara", "name": "Yasara", "description": "Structure refinement", "url": "http://www.yasara.org" } +] \ No newline at end of file diff --git a/specification/v1_1/namespaces.nef b/specification/v1_1/namespaces.nef new file mode 100644 index 0000000..e119a45 --- /dev/null +++ b/specification/v1_1/namespaces.nef @@ -0,0 +1,32 @@ +data_nef_namespaces_registry + +save_nns_namespaces + _nns_namespaces.sf_category nns_namespaces + _nns_namespaces.sf_framecode nns_namespaces + + loop_ + _nns_namespaces_namespace.id + _nns_namespaces_namespace.name + _nns_namespaces_namespace.description + _nns_namespaces_namespace.url + _nns_namespaces_namespace.dictionary_url + + nef 'NEF Standard' 'Data Exchange' https://github.com/NMRExchangeFormat/NEF https://github.com/NMRExchangeFormat/NEF/blob/master/specification/v1_1/mmcif_nef_v1_1.dic + nefpls 'NEF Pipelines' 'Format transcoding and NEF manipulation' https://github.com/varioustoxins/NEF-Pipelines . + amber Amber 'Structure modelling and refinement' https://ambermd.org . + aria Aria 'Structure calculation' https://aria.pasteur.fr . + ccpn 'CcpNmr Analysis' 'NMR spectra processing and data analysis' https://ccpn.ac.uk . + csrosetta CS-Rosetta 'Structure calculation' https://web.archive.org/web/20240421045134/https://csrosetta.chemistry.ucsc.edu/ . + cyana Cyana 'Structure calculation' http://www.cyana.org . + meld MELD 'Structure modelling and refinement' https://meldmd.org . + NMRFx NMRFx 'Structure calculation' https://nmrfx.org . + pdbstat PDBStat 'NMR data validation' https://github.rpi.edu/RPIBioinformatics/PDBStat_public . + unio 'Unio NMR' 'Structure calculation' https://unio-nmr.fr . + unres Unres 'Structure modelling and refinement' http://www.unres.pl . + pdbx wwPDB/BMRB Database https://www.wwpdb.org . + XplorNIH Xplor-NIH 'Structure calculation and refinement' https://nmr.cit.nih.gov/xplor-nih/ . + yasara Yasara 'Structure refinement' http://www.yasara.org . + + stop_ + +save_