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 27018:27017 mongo
Basic mongosh commands
% docker ps
% docker exec -it [mongodb-container-id] bash
% mongosh mongodb://admin:root@mongo:27017/nmdc?authSource=admin
% show dbs
% use nmdc
% 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
Reset collections in dev
% docker exec -it mongodb-container bash
% mongosh mongodb://admin:root@mongo:27017/nmdc?authSource=admin
% db.ontology_class_set.drop()
% db.ontology_relation_set.drop()
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
ontology_loader-0.1.6.tar.gz
(8.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ontology_loader-0.1.6.tar.gz.
File metadata
- Download URL: ontology_loader-0.1.6.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01b0191bd708bde6136c02485d40dbb8c11d586370e1815d3830686902b8f846
|
|
| MD5 |
c0619d4e54c41b0bbb86ead4cfa701ba
|
|
| BLAKE2b-256 |
1e8ef696ab08f1458e1fcbd5b96371366500e44a15475971e100a7cb0acce5f1
|
File details
Details for the file ontology_loader-0.1.6-py3-none-any.whl.
File metadata
- Download URL: ontology_loader-0.1.6-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10c0239c6848f7944a86508c805387b1c9ed084f63616f4ff5646061cd0e7fb5
|
|
| MD5 |
91ab35ddf53eddc4ddb17fe4c4714813
|
|
| BLAKE2b-256 |
a5a8ea83f482c35a6e3df545da2886ab92448bd1481908299f1c1c99e4e4eda2
|