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.0.0.tar.gz (8.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.0.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ontology_loader-0.0.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.0 Darwin/21.6.0

File hashes

Hashes for ontology_loader-0.0.0.tar.gz
Algorithm Hash digest
SHA256 31a5183e80b804998da18ec38631b8e08b8b8037ba412df8b16b6a73fc9be25a
MD5 a7d405c50313c2a120922c10dba6dc8f
BLAKE2b-256 6d1cb424bde75a6c9718804bbb2a7e835c6e09e55357d9965dd5bffdb2227fb2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ontology_loader-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.0 Darwin/21.6.0

File hashes

Hashes for ontology_loader-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5a80d83da0c3bbdff16051f8b7520d6b0ef4727e0089d53ab444ce819cb024b
MD5 7d554df66c81bdb2d509f0af7e514025
BLAKE2b-256 68bfb0710dba5fed36e3ee4821d4b4ea30f2d2a8859e5c247992850e2fc026a9

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