-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from linkml/enrich
Schema enricher and Docker config
- Loading branch information
Showing
10 changed files
with
190 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# set base image (host OS) | ||
FROM python:3.9 | ||
|
||
# https://stackoverflow.com/questions/53835198/integrating-python-poetry-with-docker | ||
ENV YOUR_ENV=${YOUR_ENV} \ | ||
PYTHONFAULTHANDLER=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONHASHSEED=random \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
POETRY_VERSION=1.1.13 | ||
|
||
# System deps: | ||
RUN pip install "poetry==$POETRY_VERSION" | ||
|
||
# set the working directory in the container | ||
WORKDIR /work | ||
|
||
RUN pip install schema-automator | ||
|
||
#COPY poetry.lock pyproject.toml /code/ | ||
|
||
# Project initialization: | ||
#RUN poetry install | ||
|
||
|
||
# command to run on container start | ||
CMD [ "bash" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[Term] | ||
id: SO:0000704 | ||
name: gene | ||
def: "A region (or regions) that includes all of the sequence elements necessary to encode a functional transcript. A gene may include regulatory regions, transcribed regions and/or other functional sequence regions." [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import logging | ||
import os | ||
import unittest | ||
from linkml.utils.schema_builder import SchemaBuilder | ||
from linkml_runtime.dumpers import yaml_dumper | ||
from linkml_runtime.linkml_model import SchemaDefinition, EnumDefinition, PermissibleValue | ||
from oaklib.implementations import BioportalImplementation | ||
from oaklib.selector import get_implementation_from_shorthand | ||
|
||
from schema_automator.annotators.schema_annotator import SchemaAnnotator | ||
from linkml.generators.yamlgen import YAMLGenerator | ||
from tests import INPUT_DIR, OUTPUT_DIR | ||
|
||
|
||
class SchemaEnricherTestCase(unittest.TestCase): | ||
|
||
def setUp(self) -> None: | ||
impl = get_implementation_from_shorthand(os.path.join(INPUT_DIR, "so-mini.obo")) | ||
self.annotator = SchemaAnnotator(impl) | ||
|
||
def test_enrich(self): | ||
s = SchemaDefinition(id='test', name='test') | ||
sb = SchemaBuilder(s) | ||
sb.add_class('Gene', class_uri="SO:0000704").add_slot('part_of') | ||
s = self.annotator.enrich(sb.schema) | ||
#print(yaml_dumper.dumps(s)) | ||
assert s.classes['Gene'].description.startswith("A region") | ||
|
||
|
||
|