Skip to content

Commit

Permalink
oak-ai -> ontogpt
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh committed May 25, 2023
1 parent 2377ae2 commit 7c15589
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 82 deletions.
6 changes: 3 additions & 3 deletions .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"checkout": null,
"context": {
"cookiecutter": {
"project_name": "oak-ai",
"__project_slug": "oak_ai",
"project_description": "OAK AI",
"project_name": "ontogpt",
"__project_slug": "ontogpt",
"project_description": "ontogpt",
"min_python_version": "3.9",
"file_name": "OAK for Artifical Intelligence",
"greeting_recipient": "World",
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Copyright (c) 2022, Harshad Hegde
Copyright (c) 2022, Caufield, J. H., Hegde, H., Harris, N. L., Joachimiak, M. P., Moxon, S. A., Reese, J. T. & Mungall, C. J.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -12,7 +12,7 @@ modification, are permitted provided that the following conditions are met:
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of pytest-oak-ai nor the names of its
* Neither the name of ontogpt nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

Expand Down
2 changes: 1 addition & 1 deletion src/ontogpt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""oak-ai package."""
"""ontogpt package."""
from importlib import metadata

try:
Expand Down
4 changes: 2 additions & 2 deletions src/ontogpt/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Command line interface for oak-ai."""
"""Command line interface for ontogpt."""
import codecs
import logging
import pickle
Expand Down Expand Up @@ -152,7 +152,7 @@ def write_extraction(
)
@click.version_option(__version__)
def main(verbose: int, quiet: bool, cache_db: str, skip_annotator):
"""CLI for oak-ai.
"""CLI for ontogpt.
:param verbose: Verbosity while running.
:param quiet: Boolean to be quiet or verbose.
Expand Down
164 changes: 91 additions & 73 deletions src/ontogpt/templates/ibd.py
Original file line number Diff line number Diff line change
@@ -1,204 +1,221 @@
"""IBD template."""
from __future__ import annotations

from datetime import datetime, date
from enum import Enum
from typing import Any, List, Optional

from pydantic import BaseModel as BaseModel
from pydantic import Field
from typing import List, Dict, Optional, Any, Union, Literal
from pydantic import BaseModel as BaseModel, Field
from linkml_runtime.linkml_model import Decimal

metamodel_version = "None"
version = "None"


class WeakRefShimBaseModel(BaseModel):
__slots__ = "__weakref__"


class ConfiguredBaseModel(
WeakRefShimBaseModel,
validate_assignment=True,
validate_all=True,
underscore_attrs_are_private=True,
extra="forbid",
arbitrary_types_allowed=True,
):
pass
__slots__ = '__weakref__'

class ConfiguredBaseModel(WeakRefShimBaseModel,
validate_assignment = True,
validate_all = True,
underscore_attrs_are_private = True,
extra = 'forbid',
arbitrary_types_allowed = True):
pass


class GeneLocationEnum(str, Enum):


dummy = "dummy"


class GOCellComponentType(str, Enum):


dummy = "dummy"


class CellType(str, Enum):


dummy = "dummy"


class NullDataOptions(str, Enum):

UNSPECIFIED_METHOD_OF_ADMINISTRATION = "UNSPECIFIED_METHOD_OF_ADMINISTRATION"
NOT_APPLICABLE = "NOT_APPLICABLE"
NOT_MENTIONED = "NOT_MENTIONED"



class IBDAnnotations(ConfiguredBaseModel):
genes: Optional[List[str]] = Field(
default_factory=list, description="""semicolon-separated list of genes"""
)
organisms: Optional[List[str]] = Field(
default_factory=list, description="""semicolon-separated list of organism taxons"""
)

genes: Optional[List[str]] = Field(default_factory=list, description="""semicolon-separated list of genes""")
organisms: Optional[List[str]] = Field(default_factory=list, description="""semicolon-separated list of organism taxons""")
gene_organisms: Optional[List[GeneOrganismRelationship]] = Field(default_factory=list)
activities: Optional[List[str]] = Field(
default_factory=list, description="""semicolon-separated list of molecular activities"""
)
gene_functions: Optional[List[GeneMolecularActivityRelationship]] = Field(
default_factory=list,
description="""semicolon-separated list of gene to molecular activity relationships""",
)
cellular_processes: Optional[List[str]] = Field(
default_factory=list, description="""semicolon-separated list of cellular processes"""
)
pathways: Optional[List[str]] = Field(
default_factory=list, description="""semicolon-separated list of pathways"""
)
gene_gene_interactions: Optional[List[GeneGeneInteraction]] = Field(
default_factory=list,
description="""semicolon-separated list of gene to gene interactions""",
)
gene_localizations: Optional[List[GeneSubcellularLocalizationRelationship]] = Field(
default_factory=list,
description="""semicolon-separated list of genes plus their location in the cell;\
for example, \"gene1 / cytoplasm; gene2 / mitochondrion\"""",
)
activities: Optional[List[str]] = Field(default_factory=list, description="""semicolon-separated list of molecular activities""")
gene_functions: Optional[List[GeneMolecularActivityRelationship]] = Field(default_factory=list, description="""semicolon-separated list of gene to molecular activity relationships""")
cellular_processes: Optional[List[str]] = Field(default_factory=list, description="""semicolon-separated list of cellular processes""")
pathways: Optional[List[str]] = Field(default_factory=list, description="""semicolon-separated list of pathways""")
gene_gene_interactions: Optional[List[GeneGeneInteraction]] = Field(default_factory=list, description="""semicolon-separated list of gene to gene interactions""")
gene_localizations: Optional[List[GeneSubcellularLocalizationRelationship]] = Field(default_factory=list, description="""semicolon-separated list of genes plus their location in the cell; for example, \"gene1 / cytoplasm; gene2 / mitochondrion\"""")



class ExtractionResult(ConfiguredBaseModel):
"""A result of extracting knowledge on text."""

"""
A result of extracting knowledge on text
"""
input_id: Optional[str] = Field(None)
input_title: Optional[str] = Field(None)
input_text: Optional[str] = Field(None)
raw_completion_output: Optional[str] = Field(None)
prompt: Optional[str] = Field(None)
extracted_object: Optional[Any] = Field(
None, description="""The complex objects extracted from the text"""
)
named_entities: Optional[List[Any]] = Field(
default_factory=list, description="""Named entities extracted from the text"""
)
extracted_object: Optional[Any] = Field(None, description="""The complex objects extracted from the text""")
named_entities: Optional[List[Any]] = Field(default_factory=list, description="""Named entities extracted from the text""")



class NamedEntity(ConfiguredBaseModel):

id: Optional[str] = Field(None, description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")



class Gene(NamedEntity):

id: Optional[str] = Field(None, description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")



class Pathway(NamedEntity):

id: Optional[str] = Field(None, description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")



class CellularProcess(NamedEntity):

id: Optional[str] = Field(None, description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")



class MolecularActivity(NamedEntity):

id: Optional[str] = Field(None, description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")



class GeneLocation(NamedEntity):

id: Optional[str] = Field(None, description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")



class Organism(NamedEntity):

id: Optional[str] = Field(None, description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")



class Molecule(NamedEntity):

id: Optional[str] = Field(None, description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")



class CompoundExpression(ConfiguredBaseModel):
pass

None



class GeneOrganismRelationship(CompoundExpression):

gene: Optional[str] = Field(None)
organism: Optional[str] = Field(None)



class GeneMolecularActivityRelationship(CompoundExpression):

gene: Optional[str] = Field(None)
molecular_activity: Optional[str] = Field(None)



class GeneMolecularActivityRelationship2(CompoundExpression):

gene: Optional[str] = Field(None)
molecular_activity: Optional[str] = Field(None)
target: Optional[str] = Field(None)



class GeneSubcellularLocalizationRelationship(CompoundExpression):

gene: Optional[str] = Field(None)
location: Optional[str] = Field(None)



class GeneGeneInteraction(CompoundExpression):

gene1: Optional[str] = Field(None)
gene2: Optional[str] = Field(None)



class Triple(CompoundExpression):
"""Abstract parent for Relation Extraction tasks."""

"""
Abstract parent for Relation Extraction tasks
"""
subject: Optional[str] = Field(None)
predicate: Optional[str] = Field(None)
object: Optional[str] = Field(None)
qualifier: Optional[str] = Field(
None, description="""A qualifier for the statements, e.g. \"NOT\" for negation"""
)
subject_qualifier: Optional[str] = Field(
None,
description="""An optional qualifier or modifier for the subject of the statement,\
e.g. \"high dose\" or \"intravenously administered\"""",
)
object_qualifier: Optional[str] = Field(
None,
description="""An optional qualifier or modifier for the object of the statement,\
e.g. \"severe\" or \"with additional complications\"""",
)
qualifier: Optional[str] = Field(None, description="""A qualifier for the statements, e.g. \"NOT\" for negation""")
subject_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the subject of the statement, e.g. \"high dose\" or \"intravenously administered\"""")
object_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the object of the statement, e.g. \"severe\" or \"with additional complications\"""")



class TextWithTriples(ConfiguredBaseModel):

publication: Optional[Publication] = Field(None)
triples: Optional[List[Triple]] = Field(default_factory=list)



class RelationshipType(NamedEntity):

id: Optional[str] = Field(None, description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")



class Publication(ConfiguredBaseModel):

id: Optional[str] = Field(None, description="""The publication identifier""")
title: Optional[str] = Field(None, description="""The title of the publication""")
abstract: Optional[str] = Field(None, description="""The abstract of the publication""")
combined_text: Optional[str] = Field(None)
full_text: Optional[str] = Field(None, description="""The full text of the publication""")



class AnnotatorResult(ConfiguredBaseModel):

subject_text: Optional[str] = Field(None)
object_id: Optional[str] = Field(None)
object_text: Optional[str] = Field(None)




# Update forward refs
Expand All @@ -224,3 +241,4 @@ class AnnotatorResult(ConfiguredBaseModel):
RelationshipType.update_forward_refs()
Publication.update_forward_refs()
AnnotatorResult.update_forward_refs()

2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for oak-ai."""
"""Tests for ontogpt."""
import logging
import os
from pathlib import Path
Expand Down

0 comments on commit 7c15589

Please sign in to comment.