{ "cells": [ { "cell_type": "markdown", "id": "9bdd6a77", "metadata": {}, "source": [ "\n", "Example for creating a COMBINE archive." ] }, { "cell_type": "code", "execution_count": null, "id": "7cf211b9", "metadata": { "lines_to_next_cell": 2 }, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "from pymetadata.console import console\n", "from pymetadata.omex import EntryFormat, ManifestEntry, Omex" ] }, { "cell_type": "markdown", "id": "22795a31", "metadata": { "lines_to_next_cell": 2 }, "source": [ "\n", "Creating an empty archive and adding entry for SBML." ] }, { "cell_type": "code", "execution_count": null, "id": "be17333a", "metadata": {}, "outputs": [], "source": [ "\n", "\n", "def create_omex(omex_path: Path, results_dir: Path) -> None:\n", " \"\"\"Create OMEX archive of resources.\"\"\"\n", " omex = Omex()\n", " omex.add_entry(\n", " entry=ManifestEntry(\n", " location=\"./sbml/repressilator_sbml_libsbml.xml\",\n", " format=EntryFormat.SBML_L3V2,\n", " master=False,\n", " ),\n", " entry_path=results_dir / \"repressilator_sbml_libsbml.xml\",\n", " )\n", "\n", " omex.add_entry(\n", " entry=ManifestEntry(\n", " location=\"./sbml/repressilator_sbml_antimony.xml\",\n", " format=EntryFormat.SBML_L3V2,\n", " master=False,\n", " ),\n", " entry_path=results_dir / \"repressilator_sbml_antimony.xml\",\n", " )\n", "\n", " omex.add_entry(\n", " entry=ManifestEntry(\n", " location=\"./sbml/repressilator_sbml_sbmlutils.xml\",\n", " format=EntryFormat.SBML_L3V2,\n", " master=False,\n", " ),\n", " entry_path=results_dir / \"repressilator_sbml_sbmlutils.xml\",\n", " )\n", "\n", " omex.add_entry(\n", " entry=ManifestEntry(\n", " location=\"./cellml/repressilator_cellml.cellml\",\n", " format=EntryFormat.CELLML,\n", " master=False,\n", " ),\n", " entry_path=results_dir / \"repressilator_cellml.cellml\",\n", " )\n", "\n", " omex.add_entry(\n", " entry=ManifestEntry(\n", " location=\"./biopax/repressilator_biopax.owl\",\n", " format=EntryFormat.BIOPAX,\n", " master=False,\n", " ),\n", " entry_path=results_dir / \"repressilator_biopax.owl\",\n", " )\n", "\n", " omex.add_entry(\n", " entry=ManifestEntry(\n", " location=\"./sbgn/repressilator_sbgn.sbgn\",\n", " format=EntryFormat.SBGN,\n", " master=False,\n", " ),\n", " entry_path=results_dir / \"repressilator_sbgn.sbgn\",\n", " )\n", " omex.add_entry(\n", " entry=ManifestEntry(\n", " location=\"./sbgn/repressilator_sbgn.png\",\n", " format=EntryFormat.PNG,\n", " master=False,\n", " ),\n", " entry_path=results_dir / \"repressilator_sbgn.png\",\n", " )\n", "\n", " omex.add_entry(\n", " entry=ManifestEntry(\n", " location=\"./sedml/repressilator_sedml.xml\",\n", " format=EntryFormat.SEDML,\n", " master=False,\n", " ),\n", " entry_path=results_dir / \"repressilator_sedml.xml\"\n", " # FIXME: add the model relative and test\n", " )\n", "\n", " console.print(omex)\n", " omex.to_omex(omex_path)\n", "\n", "\n", "if __name__ == \"__main__\":\n", " from combine_notebooks import RESULTS_DIR\n", "\n", " create_omex(omex_path=RESULTS_DIR / \"combine.omex\", results_dir=RESULTS_DIR)" ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "-all", "main_language": "python", "notebook_metadata_filter": "-all" } }, "nbformat": 4, "nbformat_minor": 5 }