Skip to content

Commit

Permalink
Merge branch 'main' into obo-compliance-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
cmungall authored Dec 21, 2023
2 parents eca9023 + 66998cd commit 0b14399
Show file tree
Hide file tree
Showing 37 changed files with 640,920 additions and 3,787 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ jobs:
#----------------------------------------------
- name: Install dependencies
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
run: |
poetry add setuptools@latest
poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Python lib for common ontology operations over a variety of backends.
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6456239.svg)](https://doi.org/10.5281/zenodo.6456239)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](.github/CODE_OF_CONDUCT.md)

OAK provides a collection of [interfaces](https://incatools.github.io/ontology-access-kit/interfaces/index.html) for various ontology operations, including:
OAK provides a collection of [interfaces](https://incatools.github.io/ontology-access-kit/packages/interfaces/index.html#interfaces) for various ontology operations, including:

- [look up basic features](https://incatools.github.io/ontology-access-kit/guide/basics.html) of an ontology element, such as its label, definition, relationships, or aliases
- search an ontology for a term
Expand Down Expand Up @@ -84,7 +84,7 @@ For more examples, see
See:

- [CLI docs](https://incatools.github.io/ontology-access-kit/cli.html)
- [Example notebooks](https://github.com/INCATools/ontology-access-kit/tree/main/notebooks/Commands
- [Example notebooks](https://github.com/INCATools/ontology-access-kit/tree/main/notebooks/Commands)

## Search

Expand Down
File renamed without changes
2,459 changes: 643 additions & 1,816 deletions notebooks/Commands/Enrichment.ipynb

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions notebooks/Commands/input/eds-genes-hgnc.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
id label
HGNC:11976 TNXB
HGNC:1246 C1R
HGNC:1247 C1S
HGNC:17978 B3GALT6
HGNC:18625 FKBP14
HGNC:20859 SLC39A13
HGNC:21144 DSE
HGNC:2188 COL12A1
HGNC:218 ADAMTS2
HGNC:2198 COL1A2
HGNC:2201 COL3A1
HGNC:2209 COL5A1
HGNC:2210 COL5A2
HGNC:23216 ZNF469
HGNC:24464 CHST14
HGNC:303 AEBP1
HGNC:9081 PLOD1
HGNC:930 B4GALT7
HGNC:9349 PRDM5
3,391 changes: 1,521 additions & 1,870 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ SQLAlchemy = ">=1.4.32"
linkml-runtime = ">=1.5.3"
linkml-renderer = ">=0.3.0"
networkx = ">=2.7.1"
sssom-schema = ">=0.11.0"
sssom = ">=0.3.38"
sssom = "^0.4.0"
ratelimit = ">=2.2.1"
appdirs = ">=1.4.4"
semsql = ">=0.3.1"
lark = ">=1.1.2"
kgcl-schema = "0.6.0"
kgcl-schema = ">=0.6.0"
funowl = ">=0.2.0"
gilda = {version = ">=1.0.0", optional = true}
kgcl-rdflib = "0.5.0"
Expand All @@ -37,7 +35,7 @@ pysolr = "^3.9.0"
eutils = ">=0.6.0"
requests-cache = "^1.0.1"
click = "*"
semsimian = "0.2.1"
semsimian = "^0.2.1"
urllib3 = {version = "< 2", optional = true}
pydantic = "*"

Expand Down
17 changes: 11 additions & 6 deletions src/oaklib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,8 +1006,9 @@ def main(
@main.command()
@click.argument("terms", nargs=-1)
@ontological_output_type_option
@autolabel_option
@output_option
def search(terms, output_type: str, output: TextIO):
def search(terms, output_type: str, autolabel, output: TextIO):
"""
Searches ontology for entities that have a label, alias, or other property matching a search term.
Expand Down Expand Up @@ -1056,11 +1057,15 @@ def search(terms, output_type: str, output: TextIO):
if isinstance(impl, SearchInterface):
writer = _get_writer(output_type, impl, StreamingInfoWriter)
writer.output = output
for curie_it in chunk(query_terms_iterator(terms, impl)):
logging.info("** Next chunk:")
# TODO: move chunking logic to writer
for curie, label in impl.labels(curie_it):
writer.emit(dict(id=curie, label=label))
if autolabel:
for curie_it in chunk(query_terms_iterator(terms, impl)):
logging.info("** Next chunk:")
# TODO: move chunking logic to writer
for curie, label in impl.labels(curie_it):
writer.emit(dict(id=curie, label=label))
else:
for curie in query_terms_iterator(terms, impl):
writer.emit(dict(id=curie), label_fields=[])
writer.finish()
else:
raise NotImplementedError(f"Cannot execute this using {impl} of type {type(impl)}")
Expand Down
52 changes: 50 additions & 2 deletions src/oaklib/datamodels/association.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Auto generated from association.yaml by pythongen.py version: 0.9.0
# Generation date: 2023-08-14T15:53:04
# Auto generated from association.yaml by pythongen.py version: 0.0.1
# Generation date: 2023-11-17T17:56:03
# Schema: association
#
# id: https://w3id.org/oak/association
Expand Down Expand Up @@ -69,6 +69,7 @@
OA = CurieNamespace("oa", "http://www.w3.org/ns/oa#")
ONTOASSOC = CurieNamespace("ontoassoc", "https://w3id.org/oak/association/")
RDF = CurieNamespace("rdf", "http://example.org/UNKNOWN/rdf/")
RDFS = CurieNamespace("rdfs", "http://example.org/UNKNOWN/rdfs/")
SSSOM = CurieNamespace("sssom", "https://w3id.org/sssom/")
DEFAULT_ = ONTOASSOC

Expand Down Expand Up @@ -100,6 +101,10 @@ class PositiveOrNegativeAssociation(YAMLRoot):
publications: Optional[
Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]
] = empty_list()
evidence_type: Optional[Union[str, URIorCURIE]] = None
supporting_objects: Optional[
Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]
] = empty_list()
primary_knowledge_source: Optional[Union[str, URIorCURIE]] = None
aggregator_knowledge_source: Optional[Union[str, URIorCURIE]] = None
subject_closure: Optional[
Expand All @@ -110,6 +115,7 @@ class PositiveOrNegativeAssociation(YAMLRoot):
Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]
] = empty_list()
object_closure_label: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()

def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.subject is not None and not isinstance(self.subject, URIorCURIE):
Expand Down Expand Up @@ -148,6 +154,17 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.publications
]

if self.evidence_type is not None and not isinstance(self.evidence_type, URIorCURIE):
self.evidence_type = URIorCURIE(self.evidence_type)

if not isinstance(self.supporting_objects, list):
self.supporting_objects = (
[self.supporting_objects] if self.supporting_objects is not None else []
)
self.supporting_objects = [
v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.supporting_objects
]

if self.primary_knowledge_source is not None and not isinstance(
self.primary_knowledge_source, URIorCURIE
):
Expand Down Expand Up @@ -188,6 +205,10 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
v if isinstance(v, str) else str(v) for v in self.object_closure_label
]

if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]

super().__post_init__(**kwargs)


Expand Down Expand Up @@ -711,6 +732,33 @@ class slots:
range=Optional[Union[str, URIorCURIE]],
)

slots.evidence_type = Slot(
uri=ONTOASSOC.evidence_type,
name="evidence_type",
curie=ONTOASSOC.curie("evidence_type"),
model_uri=ONTOASSOC.evidence_type,
domain=None,
range=Optional[Union[str, URIorCURIE]],
)

slots.supporting_objects = Slot(
uri=ONTOASSOC.supporting_objects,
name="supporting_objects",
curie=ONTOASSOC.curie("supporting_objects"),
model_uri=ONTOASSOC.supporting_objects,
domain=None,
range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]],
)

slots.comments = Slot(
uri=RDFS.comment,
name="comments",
curie=RDFS.curie("comment"),
model_uri=ONTOASSOC.comments,
domain=None,
range=Optional[Union[str, List[str]]],
)

slots.denormalized_slot = Slot(
uri=ONTOASSOC.denormalized_slot,
name="denormalized_slot",
Expand Down
16 changes: 16 additions & 0 deletions src/oaklib/datamodels/association.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ classes:
- object_label
- negated
- publications
- evidence_type
- supporting_objects
- primary_knowledge_source
- aggregator_knowledge_source
- subject_closure
- subject_closure_label
- object_closure
- object_closure_label
- comments

Association:
is_a: PositiveOrNegativeAssociation
Expand Down Expand Up @@ -242,6 +245,18 @@ slots:
description: The knowledge source that aggregated the association
slot_uri: biolink:aggregator_knowledge_source
range: uriorcurie
evidence_type:
description: The type of evidence supporting the association
range: uriorcurie
supporting_objects:
description: The objects that support the association
range: uriorcurie
multivalued: true
comments:
description: Comments about the association
slot_uri: rdfs:comment
range: string
multivalued: true
denormalized_slot:
mixin: true
description: |-
Expand Down Expand Up @@ -387,3 +402,4 @@ slots:
associations_for_subjects_in_common:
multivalued: true
range: Association

2 changes: 2 additions & 0 deletions src/oaklib/implementations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from oaklib.implementations.kgx.kgx_implementation import KGXImplementation
from oaklib.implementations.llm_implementation import LLMImplementation
from oaklib.implementations.monarch.monarch_implementation import MonarchImplementation
from oaklib.implementations.ncbi.ncbi_gene_implementation import NCBIGeneImplementation
from oaklib.implementations.ols import (
BaseOlsImplementation,
OlsImplementation,
Expand Down Expand Up @@ -77,6 +78,7 @@
"OlsImplementation",
"TIBOlsImplementation",
"MonarchImplementation",
"NCBIGeneImplementation",
"OntobeeImplementation",
"ProntoImplementation",
"SimpleOboImplementation",
Expand Down
Loading

0 comments on commit 0b14399

Please sign in to comment.