Skip to main content

ontology_loader

Project description

ontology_loader

Suite of tools to configure and load an ontology from the OboFoundary into the data object for OntologyClass as specified by NMDC schema.

Development Environment

Pre-requisites

  • =Python 3.9

  • Poetry
  • Docker
  • MongoDB
  • NMDC materialized schema
  • ENV variable for MONGO_PASSWORD (or pass it in via the cli/runner itself directly)
% docker pull mongo
% docker run -d --name mongodb-container -p 27017:27017 mongo

Basic mongosh commands

% docker ps
% docker exec -it [mongodb-container-id] bash
% mongosh
% show dbs
% use test
% db.ontology_class_set.find().pretty()
% db.ontology_relation_set.find().pretty()

Command line

% poetry install
% poetry run ontology_loader --help
% poetry run ontology_loader --source-ontology "envo"
% poetry run ontology_loader --source-ontology "go"

Running the tests

% make test

Running the linter

% make lint

python example usage

pip install nmdc-ontology-loader
from  nmdc_ontology_loader.ontology_loader import OntologyLoader
import tempfile

def test_load_ontology():
    """Test the load_ontology method."""
    ontology_loader = OntologyLoader(
        source_ontology="envo",
        output_directory=tempfile.gettempdir(),
        generate_reports=True,
    )
    ontology_loader.load_ontology()
    assert ontology_loader.ontology_class_set
    assert ontology_loader.ontology_relation_set
    assert ontology_loader.ontology_class_set.count() > 0
    assert ontology_loader.ontology_relation_set.count() > 0

Project details


Download files

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

Source Distribution

ontology_loader-0.1.3.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

ontology_loader-0.1.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file ontology_loader-0.1.3.tar.gz.

File metadata

  • Download URL: ontology_loader-0.1.3.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for ontology_loader-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c4471903b9759b199a582888e9de46aeb79b8023eb8eb845c84c8b4ef482a2cb
MD5 1356e161a97d41c896b8a4dfd4329109
BLAKE2b-256 c0df5c678387a62e8e8bda11e5de37fffcca86c4dc800b20e9f413a67cf9338e

See more details on using hashes here.

File details

Details for the file ontology_loader-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ontology_loader-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 11601d6c9767e2123405b251d584a35b94483d83b57241d5f86894e717aa8b26
MD5 6d62ddb271f0e942b33fdffaca6a5d9c
BLAKE2b-256 45ef26996cb390a92fdf1f8b777370a4f3aa97e6f22526558ee0e9a053ac289f

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