Skip to main content

MetabolomicsHub Common Data Model

Project description

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 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/api/submission"
api_key = "<your-api-key>"

def get_new_mhd_accession_example():
    mhd_client: MhdClient = MhdClient(mhd_webservice_base_url, api_key)

    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_key)

    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_key)

    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_key)

    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)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mhd_model-0.1.78.tar.gz (113.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mhd_model-0.1.78-py3-none-any.whl (145.3 kB view details)

Uploaded Python 3

File details

Details for the file mhd_model-0.1.78.tar.gz.

File metadata

  • Download URL: mhd_model-0.1.78.tar.gz
  • Upload date:
  • Size: 113.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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}

File hashes

Hashes for mhd_model-0.1.78.tar.gz
Algorithm Hash digest
SHA256 e3335dc8d9f3af5b43a587e039654a6f992ef229a84ee6fabe7b158f5da0b85f
MD5 a8953b67b996cc7a40e9c3782a326e93
BLAKE2b-256 d58a6f0312a3f8f2d4336386203841c97c2168c55c8e1bfffe2d68c27c268429

See more details on using hashes here.

File details

Details for the file mhd_model-0.1.78-py3-none-any.whl.

File metadata

  • Download URL: mhd_model-0.1.78-py3-none-any.whl
  • Upload date:
  • Size: 145.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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}

File hashes

Hashes for mhd_model-0.1.78-py3-none-any.whl
Algorithm Hash digest
SHA256 6ff090462e00efc5ee9b4a4e4f6647e14cb38102fea3822329197a361cd90d34
MD5 967fe6090506349b497f058dddb7d99b
BLAKE2b-256 ef05a8fa2a623e2c082c8003f3522490c857ee6b4c4517b3fbfd78badbbeee39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page