MetabolomicsHub Common Data Model and Utility Tools (mhd-model)
You can find documentation on Github
Development Environment
Development environment for linux or mac
# install python package manager uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# add $HOME/.local/bin to your PATH, either restart your shell or run
export PATH=$HOME/.local/bin:$PATH
# install git from https://git-scm.com/downloads
# Linux command
apt update; apt install git -y
# Mac command
# brew install git
# clone project from github
git clone https://github.com/MetabolomicsHub/mhd_model.git
cd mhd-model
# install python if it is not installed
uv python install 3.12
# install python dependencies
uv sync
# install pre-commit to check repository integrity and format checking
uv run pre-commit
# open your IDE (vscode, pycharm, etc.) and set python interpreter as .venv/bin/python
Commandline (CLI) Tool Usage
# you can use any python version >= 3.12
pip install mhd-model
mhd-cli
Example API Usage
from mhd_model.mhd_client import MhdClient, MhdClientError
mhd_webservice_base_url = "https://www.metabolomicshub.org/test/api/submission"
api_token = "<your-api-token>"
def get_new_mhd_accession_example():
mhd_client: MhdClient = MhdClient(mhd_webservice_base_url, api_token)
try:
accession = mhd_client.get_new_mhd_accession(
dataset_repository_identifier="MTBLS1234567", accession_type="mhd"
)
print("Accession: %s" % accession)
except MhdClientError as ex:
print("Error: %s" % ex.message)
def get_new_test_mhd_accession_example():
mhd_client: MhdClient = MhdClient(mhd_webservice_base_url, api_token)
try:
accession = mhd_client.get_new_mhd_accession(
dataset_repository_identifier="MTBLS4444", accession_type="test"
)
print("Accession: %s" % accession)
except MhdClientError as ex:
print("Error: %s" % ex.message)
def submit_legacy_dataset_example():
announcement_file_path = "MTBLS9876543.announcement.json"
dataset_repository_id = "MTBLS9876543"
announcement_reason = "Initial revision"
mhd_client: MhdClient = MhdClient(mhd_webservice_base_url, api_token)
try:
revision: SubmittedRevision = mhd_client.submit_announcement_file(
dataset_repository_id=dataset_repository_id,
mhd_id=None,
file_path=announcement_file_path,
announcement_reason=announcement_reason,
)
print("Revision: %s" % revision.revision)
except MhdClientError as ex:
print("Error: %s" % ex.message)
def submit_mhd_dataset_example():
announcement_file_path = "MTBLS9876543.announcement.json"
mhd_id = "MHD0000001"
dataset_repository_id = "MTBLS22222"
announcement_reason = "Initial revision"
mhd_client: MhdClient = MhdClient(mhd_webservice_base_url, api_token)
try:
revision: SubmittedRevision = mhd_client.submit_announcement_file(
dataset_repository_id=dataset_repository_id,
mhd_id=mhd_id,
file_path=announcement_file_path,
announcement_reason=announcement_reason,
)
print("Revision: %s" % revision.revision)
except MhdClientError as ex:
print("Error: %s" % ex.message)
Metadata
Release files for mhd-model 0.1.110
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mhd_model-0.1.110.tar.gz | 231.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mhd_model-0.1.110-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 526.0 kB
Release files / mhd_model-0.1.110.tar.gz
| Download URL | mhd_model-0.1.110.tar.gz |
|---|---|
| Size | 231.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1970f107f3cfb663ed7d3b50f891fe2cf0d0aa21dd7e97be0cb477862b6ef5d7
|
|
BLAKE2b-256 checksum How to use checksums |
d82ef6a35beeacfc49e614186dfc46c58fc3487e0ad5e664dac87eaa86e9b4f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mhd_model-0.1.110-py3-none-any.whl
| Download URL | mhd_model-0.1.110-py3-none-any.whl |
|---|---|
| Size | 295.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
092e5f8b3fad1f0b0c546056c443f490a3dfeebbffa6a4a2a772322249d7010b
|
|
BLAKE2b-256 checksum How to use checksums |
03fc63b1450bbc3e66b7e9b860a0395fb1f246c703064fd4e483b5f2e1ff8c99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|