Skip to content

Commit

Permalink
Merge pull request #11 from geneontology/issue-8-activity-input-output
Browse files Browse the repository at this point in the history
Add `has_direct_output` slot to `Activity` class
  • Loading branch information
pkalita-lbl authored Sep 16, 2024
2 parents 3929536 + c447d35 commit e29440e
Show file tree
Hide file tree
Showing 18 changed files with 959 additions and 663 deletions.
Binary file modified project/excel/gocam.xlsx
Binary file not shown.
35 changes: 29 additions & 6 deletions project/gocam.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Auto generated from gocam.yaml by pythongen.py version: 0.0.1
# Generation date: 2024-08-28T17:21:26
# Generation date: 2024-09-13T15:30:52
# Schema: gocam
#
# id: https://w3id.org/gocam
Expand Down Expand Up @@ -211,7 +211,10 @@ class Activity(YAMLRoot):
molecular_function: Optional[Union[dict, "MolecularFunctionAssociation"]] = None
occurs_in: Optional[Union[dict, "CellularAnatomicalEntityAssociation"]] = None
part_of: Optional[Union[dict, "BiologicalProcessAssociation"]] = None
has_direct_input: Optional[Union[dict, "MoleculeAssociation"]] = None
has_input: Optional[Union[Union[dict, "MoleculeAssociation"], List[Union[dict, "MoleculeAssociation"]]]] = empty_list()
has_primary_input: Optional[Union[dict, "MoleculeAssociation"]] = None
has_output: Optional[Union[Union[dict, "MoleculeAssociation"], List[Union[dict, "MoleculeAssociation"]]]] = empty_list()
has_primary_output: Optional[Union[dict, "MoleculeAssociation"]] = None
causal_associations: Optional[Union[Union[dict, "CausalAssociation"], List[Union[dict, "CausalAssociation"]]]] = empty_list()
provenances: Optional[Union[Union[dict, "ProvenanceInfo"], List[Union[dict, "ProvenanceInfo"]]]] = empty_list()

Expand All @@ -233,8 +236,19 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.part_of is not None and not isinstance(self.part_of, BiologicalProcessAssociation):
self.part_of = BiologicalProcessAssociation(**as_dict(self.part_of))

if self.has_direct_input is not None and not isinstance(self.has_direct_input, MoleculeAssociation):
self.has_direct_input = MoleculeAssociation(**as_dict(self.has_direct_input))
if not isinstance(self.has_input, list):
self.has_input = [self.has_input] if self.has_input is not None else []
self.has_input = [v if isinstance(v, MoleculeAssociation) else MoleculeAssociation(**as_dict(v)) for v in self.has_input]

if self.has_primary_input is not None and not isinstance(self.has_primary_input, MoleculeAssociation):
self.has_primary_input = MoleculeAssociation(**as_dict(self.has_primary_input))

if not isinstance(self.has_output, list):
self.has_output = [self.has_output] if self.has_output is not None else []
self.has_output = [v if isinstance(v, MoleculeAssociation) else MoleculeAssociation(**as_dict(v)) for v in self.has_output]

if self.has_primary_output is not None and not isinstance(self.has_primary_output, MoleculeAssociation):
self.has_primary_output = MoleculeAssociation(**as_dict(self.has_primary_output))

if not isinstance(self.causal_associations, list):
self.causal_associations = [self.causal_associations] if self.causal_associations is not None else []
Expand Down Expand Up @@ -1172,8 +1186,17 @@ class slots:
slots.activity__part_of = Slot(uri=GOCAM.part_of, name="activity__part_of", curie=GOCAM.curie('part_of'),
model_uri=GOCAM.activity__part_of, domain=None, range=Optional[Union[dict, BiologicalProcessAssociation]])

slots.activity__has_direct_input = Slot(uri=GOCAM.has_direct_input, name="activity__has_direct_input", curie=GOCAM.curie('has_direct_input'),
model_uri=GOCAM.activity__has_direct_input, domain=None, range=Optional[Union[dict, MoleculeAssociation]])
slots.activity__has_input = Slot(uri=GOCAM.has_input, name="activity__has_input", curie=GOCAM.curie('has_input'),
model_uri=GOCAM.activity__has_input, domain=None, range=Optional[Union[Union[dict, MoleculeAssociation], List[Union[dict, MoleculeAssociation]]]])

slots.activity__has_primary_input = Slot(uri=GOCAM.has_primary_input, name="activity__has_primary_input", curie=GOCAM.curie('has_primary_input'),
model_uri=GOCAM.activity__has_primary_input, domain=None, range=Optional[Union[dict, MoleculeAssociation]])

slots.activity__has_output = Slot(uri=GOCAM.has_output, name="activity__has_output", curie=GOCAM.curie('has_output'),
model_uri=GOCAM.activity__has_output, domain=None, range=Optional[Union[Union[dict, MoleculeAssociation], List[Union[dict, MoleculeAssociation]]]])

slots.activity__has_primary_output = Slot(uri=GOCAM.has_primary_output, name="activity__has_primary_output", curie=GOCAM.curie('has_primary_output'),
model_uri=GOCAM.activity__has_primary_output, domain=None, range=Optional[Union[dict, MoleculeAssociation]])

slots.activity__causal_associations = Slot(uri=GOCAM.causal_associations, name="activity__causal_associations", curie=GOCAM.curie('causal_associations'),
model_uri=GOCAM.activity__causal_associations, domain=None, range=Optional[Union[Union[dict, CausalAssociation], List[Union[dict, CausalAssociation]]]])
Expand Down
5 changes: 4 additions & 1 deletion project/graphql/gocam.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ type Activity
molecularFunction: MolecularFunctionAssociation
occursIn: CellularAnatomicalEntityAssociation
partOf: BiologicalProcessAssociation
hasDirectInput: MoleculeAssociation
hasInput: [MoleculeAssociation]
hasPrimaryInput: MoleculeAssociation
hasOutput: [MoleculeAssociation]
hasPrimaryOutput: MoleculeAssociation
causalAssociations: [CausalAssociation]
provenances: [ProvenanceInfo]
}
Expand Down
18 changes: 15 additions & 3 deletions project/jsonld/gocam.context.jsonld
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"comments": {
"description": "Auto generated by LinkML jsonld context generator",
"generation_date": "2024-08-28T17:21:26",
"generation_date": "2024-09-13T15:30:51",
"source": "gocam.yaml"
},
"@context": {
Expand Down Expand Up @@ -59,9 +59,21 @@
"@type": "@id",
"@id": "enabled_by"
},
"has_direct_input": {
"has_input": {
"@type": "@id",
"@id": "has_direct_input"
"@id": "has_input"
},
"has_output": {
"@type": "@id",
"@id": "has_output"
},
"has_primary_input": {
"@type": "@id",
"@id": "has_primary_input"
},
"has_primary_output": {
"@type": "@id",
"@id": "has_primary_output"
},
"id": "@id",
"molecular_function": {
Expand Down
88 changes: 80 additions & 8 deletions project/jsonld/gocam.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -690,11 +690,57 @@
"@type": "SlotDefinition"
},
{
"name": "activity__has_direct_input",
"name": "activity__has_input",
"description": "The input molecules that are directly consumed by the activity",
"from_schema": "https://w3id.org/gocam",
"slot_uri": "https://w3id.org/gocam/has_direct_input",
"alias": "has_direct_input",
"slot_uri": "https://w3id.org/gocam/has_input",
"multivalued": true,
"alias": "has_input",
"owner": "Activity",
"domain_of": [
"Activity"
],
"range": "MoleculeAssociation",
"inlined": true,
"inlined_as_list": true,
"@type": "SlotDefinition"
},
{
"name": "activity__has_primary_input",
"description": "The primary input molecule that is directly consumed by the activity",
"from_schema": "https://w3id.org/gocam",
"slot_uri": "https://w3id.org/gocam/has_primary_input",
"alias": "has_primary_input",
"owner": "Activity",
"domain_of": [
"Activity"
],
"range": "MoleculeAssociation",
"inlined": true,
"@type": "SlotDefinition"
},
{
"name": "activity__has_output",
"description": "The output molecules that are directly produced by the activity",
"from_schema": "https://w3id.org/gocam",
"slot_uri": "https://w3id.org/gocam/has_output",
"multivalued": true,
"alias": "has_output",
"owner": "Activity",
"domain_of": [
"Activity"
],
"range": "MoleculeAssociation",
"inlined": true,
"inlined_as_list": true,
"@type": "SlotDefinition"
},
{
"name": "activity__has_primary_output",
"description": "The primary output molecule that is directly produced by the activity",
"from_schema": "https://w3id.org/gocam",
"slot_uri": "https://w3id.org/gocam/has_primary_output",
"alias": "has_primary_output",
"owner": "Activity",
"domain_of": [
"Activity"
Expand Down Expand Up @@ -1373,7 +1419,10 @@
"activity__molecular_function",
"activity__occurs_in",
"activity__part_of",
"activity__has_direct_input",
"activity__has_input",
"activity__has_primary_input",
"activity__has_output",
"activity__has_primary_output",
"activity__causal_associations",
"activity__provenances"
],
Expand Down Expand Up @@ -1421,8 +1470,31 @@
"@type": "SlotDefinition"
},
{
"name": "has_direct_input",
"name": "has_input",
"description": "The input molecules that are directly consumed by the activity",
"multivalued": true,
"range": "MoleculeAssociation",
"inlined_as_list": true,
"@type": "SlotDefinition"
},
{
"name": "has_primary_input",
"description": "The primary input molecule that is directly consumed by the activity",
"range": "MoleculeAssociation",
"inlined": true,
"@type": "SlotDefinition"
},
{
"name": "has_output",
"description": "The output molecules that are directly produced by the activity",
"multivalued": true,
"range": "MoleculeAssociation",
"inlined_as_list": true,
"@type": "SlotDefinition"
},
{
"name": "has_primary_output",
"description": "The primary output molecule that is directly produced by the activity",
"range": "MoleculeAssociation",
"inlined": true,
"@type": "SlotDefinition"
Expand Down Expand Up @@ -2138,9 +2210,9 @@
],
"metamodel_version": "1.7.0",
"source_file": "gocam.yaml",
"source_file_date": "2024-08-28T16:22:21",
"source_file_size": 13188,
"generation_date": "2024-08-28T17:21:26",
"source_file_date": "2024-09-13T14:36:24",
"source_file_size": 13755,
"generation_date": "2024-09-13T15:30:51",
"@type": "SchemaDefinition",
"@context": [
"project/jsonld/gocam.context.jsonld",
Expand Down
22 changes: 20 additions & 2 deletions project/jsonschema/gocam.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,27 @@
],
"description": "The gene product or complex that carries out the activity"
},
"has_direct_input": {
"has_input": {
"description": "The input molecules that are directly consumed by the activity",
"items": {
"$ref": "#/$defs/MoleculeAssociation"
},
"type": "array"
},
"has_output": {
"description": "The output molecules that are directly produced by the activity",
"items": {
"$ref": "#/$defs/MoleculeAssociation"
},
"type": "array"
},
"has_primary_input": {
"$ref": "#/$defs/MoleculeAssociation",
"description": "The primary input molecule that is directly consumed by the activity"
},
"has_primary_output": {
"$ref": "#/$defs/MoleculeAssociation",
"description": "The input molecules that are directly consumed by the activity"
"description": "The primary output molecule that is directly produced by the activity"
},
"id": {
"description": "Identifier of the activity unit. Should be in gocam namespace.",
Expand Down
Loading

0 comments on commit e29440e

Please sign in to comment.