From fdaa3684952d1ac2d02307a1b9522cdc7df8f21f Mon Sep 17 00:00:00 2001 From: Chris Mungall Date: Fri, 16 Aug 2024 19:11:04 -0700 Subject: [PATCH] Enhanced heatmap functionality --- docs/datamodels/obograph/Axiom.md | 35 ++- .../datamodels/obograph/BasicPropertyValue.md | 28 +- .../obograph/DefinitionPropertyValue.md | 28 +- docs/datamodels/obograph/DomainRangeAxiom.md | 43 ++- docs/datamodels/obograph/Edge.md | 23 +- .../datamodels/obograph/EquivalentNodesSet.md | 28 +- .../ExistentialRestrictionExpression.md | 18 +- docs/datamodels/obograph/Graph.md | 136 +++++--- docs/datamodels/obograph/GraphDocument.md | 45 ++- docs/datamodels/obograph/Meta.md | 291 +++++++++++++++--- docs/datamodels/obograph/Node.md | 46 ++- docs/datamodels/obograph/PropertyValue.md | 31 +- .../obograph/SynonymPropertyValue.md | 37 ++- docs/datamodels/obograph/XrefPropertyValue.md | 28 +- docs/datamodels/obograph/index.md | 49 ++- src/oaklib/cli.py | 76 +++-- src/oaklib/datamodels/association.py | 17 +- src/oaklib/datamodels/association.yaml | 6 + .../amigo/amigo_implementation.py | 28 +- .../sparql/abstract_sparql_implementation.py | 51 ++- .../association_provider_interface.py | 20 +- src/oaklib/interfaces/usages_interface.py | 23 ++ src/oaklib/io/heatmap_writer.py | 30 +- src/oaklib/io/streaming_writer.py | 8 +- 24 files changed, 893 insertions(+), 232 deletions(-) diff --git a/docs/datamodels/obograph/Axiom.md b/docs/datamodels/obograph/Axiom.md index c5f8ff41f..37218dd91 100644 --- a/docs/datamodels/obograph/Axiom.md +++ b/docs/datamodels/obograph/Axiom.md @@ -1,6 +1,12 @@ + + # Class: Axiom -_A generic grouping for any OWL axiom or group of axioms that is not captured by existing constructs in this standard. -_ + + +_A generic grouping for any OWL axiom or group of axioms that is not captured by existing constructs in this standard._ + +__ + @@ -11,17 +17,32 @@ URI: [owl:Axiom](http://www.w3.org/2002/07/owl#Axiom) -```{mermaid} + + + +```mermaid classDiagram class Axiom + click Axiom href "../Axiom" Axiom <|-- DomainRangeAxiom + click DomainRangeAxiom href "../DomainRangeAxiom" Axiom <|-- EquivalentNodesSet + click EquivalentNodesSet href "../EquivalentNodesSet" Axiom <|-- LogicalDefinitionAxiom + click LogicalDefinitionAxiom href "../LogicalDefinitionAxiom" + Axiom <|-- DisjointClassExpressionsAxiom + click DisjointClassExpressionsAxiom href "../DisjointClassExpressionsAxiom" Axiom <|-- PropertyChainAxiom + click PropertyChainAxiom href "../PropertyChainAxiom" Axiom : meta - Axiom ..> Meta : meta + + + + Axiom --> "0..1" Meta : meta + click Meta href "../Meta" + ``` @@ -35,6 +56,7 @@ URI: [owl:Axiom](http://www.w3.org/2002/07/owl#Axiom) * [DomainRangeAxiom](DomainRangeAxiom.md) * [EquivalentNodesSet](EquivalentNodesSet.md) * [LogicalDefinitionAxiom](LogicalDefinitionAxiom.md) + * [DisjointClassExpressionsAxiom](DisjointClassExpressionsAxiom.md) * [PropertyChainAxiom](PropertyChainAxiom.md) @@ -69,7 +91,6 @@ URI: [owl:Axiom](http://www.w3.org/2002/07/owl#Axiom) - ## Mappings | Mapping Type | Mapped Value | @@ -81,6 +102,8 @@ URI: [owl:Axiom](http://www.w3.org/2002/07/owl#Axiom) + + ## LinkML Source @@ -95,7 +118,6 @@ description: 'A generic grouping for any OWL axiom or group of axioms that is no ' from_schema: https://github.com/geneontology/obographs -rank: 1000 abstract: true slots: - meta @@ -114,7 +136,6 @@ description: 'A generic grouping for any OWL axiom or group of axioms that is no ' from_schema: https://github.com/geneontology/obographs -rank: 1000 abstract: true attributes: meta: diff --git a/docs/datamodels/obograph/BasicPropertyValue.md b/docs/datamodels/obograph/BasicPropertyValue.md index f7512fdb2..4910034a5 100644 --- a/docs/datamodels/obograph/BasicPropertyValue.md +++ b/docs/datamodels/obograph/BasicPropertyValue.md @@ -1,23 +1,38 @@ + + # Class: BasicPropertyValue + + _A property value that represents an assertion about an entity that is not a definition, synonym, or xref_ + URI: [obographs:BasicPropertyValue](https://github.com/geneontology/obographs/BasicPropertyValue) -```{mermaid} + + + +```mermaid classDiagram class BasicPropertyValue + click BasicPropertyValue href "../BasicPropertyValue" PropertyValue <|-- BasicPropertyValue + click PropertyValue href "../PropertyValue" BasicPropertyValue : lang BasicPropertyValue : meta - BasicPropertyValue ..> Meta : meta + + + + BasicPropertyValue --> "0..1" Meta : meta + click Meta href "../Meta" + BasicPropertyValue : pred @@ -46,7 +61,7 @@ URI: [obographs:BasicPropertyValue](https://github.com/geneontology/obographs/Ba | --- | --- | --- | --- | | [pred](pred.md) | 0..1
[String](String.md) | the predicate of an edge | [PropertyValue](PropertyValue.md) | | [val](val.md) | 0..1
[String](String.md) | the value of a property | [PropertyValue](PropertyValue.md) | -| [xrefs](xrefs.md) | 0..*
[XrefString](XrefString.md) | A list of cross references to other entities represented in other ontologies,... | [PropertyValue](PropertyValue.md) | +| [xrefs](xrefs.md) | *
[XrefString](XrefString.md) | A list of cross references to other entities represented in other ontologies,... | [PropertyValue](PropertyValue.md) | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | [PropertyValue](PropertyValue.md) | | [valType](valType.md) | 0..1
[String](String.md) | the datatype of a property value | [PropertyValue](PropertyValue.md) | | [lang](lang.md) | 0..1
[String](String.md) | the language of a property value | [PropertyValue](PropertyValue.md) | @@ -82,7 +97,6 @@ URI: [obographs:BasicPropertyValue](https://github.com/geneontology/obographs/Ba - ## Mappings | Mapping Type | Mapped Value | @@ -94,6 +108,8 @@ URI: [obographs:BasicPropertyValue](https://github.com/geneontology/obographs/Ba + + ## LinkML Source @@ -106,7 +122,6 @@ name: BasicPropertyValue description: A property value that represents an assertion about an entity that is not a definition, synonym, or xref from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: PropertyValue ``` @@ -120,7 +135,6 @@ name: BasicPropertyValue description: A property value that represents an assertion about an entity that is not a definition, synonym, or xref from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: PropertyValue attributes: pred: @@ -161,13 +175,13 @@ attributes: close_mappings: - rdfs:seeAlso rank: 1000 - multivalued: true alias: xrefs owner: BasicPropertyValue domain_of: - Meta - PropertyValue range: XrefString + multivalued: true meta: name: meta description: A collection of metadata about either an ontology (graph), an entity, diff --git a/docs/datamodels/obograph/DefinitionPropertyValue.md b/docs/datamodels/obograph/DefinitionPropertyValue.md index 151bebe9c..2e52720b8 100644 --- a/docs/datamodels/obograph/DefinitionPropertyValue.md +++ b/docs/datamodels/obograph/DefinitionPropertyValue.md @@ -1,23 +1,38 @@ + + # Class: DefinitionPropertyValue + + _A property value that represents an assertion about the textual definition of an entity_ + URI: [obographs:DefinitionPropertyValue](https://github.com/geneontology/obographs/DefinitionPropertyValue) -```{mermaid} + + + +```mermaid classDiagram class DefinitionPropertyValue + click DefinitionPropertyValue href "../DefinitionPropertyValue" PropertyValue <|-- DefinitionPropertyValue + click PropertyValue href "../PropertyValue" DefinitionPropertyValue : lang DefinitionPropertyValue : meta - DefinitionPropertyValue ..> Meta : meta + + + + DefinitionPropertyValue --> "0..1" Meta : meta + click Meta href "../Meta" + DefinitionPropertyValue : pred @@ -46,7 +61,7 @@ URI: [obographs:DefinitionPropertyValue](https://github.com/geneontology/obograp | --- | --- | --- | --- | | [pred](pred.md) | 0..1
[String](String.md) | the predicate of an edge | [PropertyValue](PropertyValue.md) | | [val](val.md) | 0..1
[String](String.md) | The textual string representing the definition | [PropertyValue](PropertyValue.md) | -| [xrefs](xrefs.md) | 0..*
[XrefString](XrefString.md) | A list of identifiers that support the definition | [PropertyValue](PropertyValue.md) | +| [xrefs](xrefs.md) | *
[XrefString](XrefString.md) | A list of identifiers that support the definition | [PropertyValue](PropertyValue.md) | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | [PropertyValue](PropertyValue.md) | | [valType](valType.md) | 0..1
[String](String.md) | the datatype of a property value | [PropertyValue](PropertyValue.md) | | [lang](lang.md) | 0..1
[String](String.md) | the language of a property value | [PropertyValue](PropertyValue.md) | @@ -82,7 +97,6 @@ URI: [obographs:DefinitionPropertyValue](https://github.com/geneontology/obograp - ## Mappings | Mapping Type | Mapped Value | @@ -94,6 +108,8 @@ URI: [obographs:DefinitionPropertyValue](https://github.com/geneontology/obograp + + ## LinkML Source @@ -106,7 +122,6 @@ name: DefinitionPropertyValue description: A property value that represents an assertion about the textual definition of an entity from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: PropertyValue slot_usage: val: @@ -138,7 +153,6 @@ name: DefinitionPropertyValue description: A property value that represents an assertion about the textual definition of an entity from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: PropertyValue slot_usage: val: @@ -194,7 +208,6 @@ attributes: a contributing role in the definition. from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: xrefs owner: DefinitionPropertyValue domain_of: @@ -202,6 +215,7 @@ attributes: - PropertyValue role: supporting identifiers range: XrefString + multivalued: true meta: name: meta description: A collection of metadata about either an ontology (graph), an entity, diff --git a/docs/datamodels/obograph/DomainRangeAxiom.md b/docs/datamodels/obograph/DomainRangeAxiom.md index 6b201d6db..7d22c2d6c 100644 --- a/docs/datamodels/obograph/DomainRangeAxiom.md +++ b/docs/datamodels/obograph/DomainRangeAxiom.md @@ -1,27 +1,47 @@ + + # Class: DomainRangeAxiom + + _This groups potentially multiple axioms that constrain the usage of a property depending on some combination of domain and range._ + URI: [obographs:DomainRangeAxiom](https://github.com/geneontology/obographs/DomainRangeAxiom) -```{mermaid} + + + +```mermaid classDiagram class DomainRangeAxiom + click DomainRangeAxiom href "../DomainRangeAxiom" Axiom <|-- DomainRangeAxiom + click Axiom href "../Axiom" DomainRangeAxiom : allValuesFromEdges - DomainRangeAxiom ..> Edge : allValuesFromEdges + + + + DomainRangeAxiom --> "*" Edge : allValuesFromEdges + click Edge href "../Edge" + DomainRangeAxiom : domainClassIds DomainRangeAxiom : meta - DomainRangeAxiom ..> Meta : meta + + + + DomainRangeAxiom --> "0..1" Meta : meta + click Meta href "../Meta" + DomainRangeAxiom : predicateId @@ -45,9 +65,9 @@ URI: [obographs:DomainRangeAxiom](https://github.com/geneontology/obographs/Doma | Name | Cardinality and Range | Description | Inheritance | | --- | --- | --- | --- | | [predicateId](predicateId.md) | 0..1
[String](String.md) | | direct | -| [domainClassIds](domainClassIds.md) | 0..*
[String](String.md) | | direct | -| [rangeClassIds](rangeClassIds.md) | 0..*
[String](String.md) | | direct | -| [allValuesFromEdges](allValuesFromEdges.md) | 0..*
[Edge](Edge.md) | A list of edges that represent subclasses of universal restrictions | direct | +| [domainClassIds](domainClassIds.md) | *
[String](String.md) | | direct | +| [rangeClassIds](rangeClassIds.md) | *
[String](String.md) | | direct | +| [allValuesFromEdges](allValuesFromEdges.md) | *
[Edge](Edge.md) | A list of edges that represent subclasses of universal restrictions | direct | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | [Axiom](Axiom.md) | @@ -85,7 +105,6 @@ URI: [obographs:DomainRangeAxiom](https://github.com/geneontology/obographs/Doma - ## Mappings | Mapping Type | Mapped Value | @@ -97,6 +116,8 @@ URI: [obographs:DomainRangeAxiom](https://github.com/geneontology/obographs/Doma + + ## LinkML Source @@ -114,7 +135,6 @@ comments: to a DomainRangeAxiom with a rangeClassIds, and no domainClassIds. But translations may merge these, but only when semantically valid. from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: Axiom slots: - predicateId @@ -138,7 +158,6 @@ comments: to a DomainRangeAxiom with a rangeClassIds, and no domainClassIds. But translations may merge these, but only when semantically valid. from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: Axiom attributes: predicateId: @@ -155,34 +174,34 @@ attributes: name: domainClassIds from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: domainClassIds owner: DomainRangeAxiom domain_of: - DomainRangeAxiom range: string + multivalued: true rangeClassIds: name: rangeClassIds from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: rangeClassIds owner: DomainRangeAxiom domain_of: - DomainRangeAxiom range: string + multivalued: true allValuesFromEdges: name: allValuesFromEdges description: A list of edges that represent subclasses of universal restrictions from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: allValuesFromEdges owner: DomainRangeAxiom domain_of: - Graph - DomainRangeAxiom range: Edge + multivalued: true meta: name: meta description: A collection of metadata about either an ontology (graph), an entity, diff --git a/docs/datamodels/obograph/Edge.md b/docs/datamodels/obograph/Edge.md index c923647b5..b762f6dd0 100644 --- a/docs/datamodels/obograph/Edge.md +++ b/docs/datamodels/obograph/Edge.md @@ -1,19 +1,33 @@ + + # Class: Edge + + _An edge is a simple typed relationship between two nodes. When mapping to OWL, an edge represents either (a) s SubClassOf o (b) s SubClassOf p some o (c) s p o (where s and o are individuals) (d) s SubPropertyOf o (e) s EquivalentTo o (f) s type o_ + URI: [obographs:Edge](https://github.com/geneontology/obographs/Edge) -```{mermaid} + + + +```mermaid classDiagram class Edge + click Edge href "../Edge" Edge : meta - Edge ..> Meta : meta + + + + Edge --> "0..1" Meta : meta + click Meta href "../Meta" + Edge : obj @@ -72,7 +86,6 @@ URI: [obographs:Edge](https://github.com/geneontology/obographs/Edge) - ## Mappings | Mapping Type | Mapped Value | @@ -84,6 +97,8 @@ URI: [obographs:Edge](https://github.com/geneontology/obographs/Edge) + + ## LinkML Source @@ -98,7 +113,6 @@ description: An edge is a simple typed relationship between two nodes. When mapp s p o (where s and o are individuals) (d) s SubPropertyOf o (e) s EquivalentTo o (f) s type o from_schema: https://github.com/geneontology/obographs -rank: 1000 slots: - sub - pred @@ -118,7 +132,6 @@ description: An edge is a simple typed relationship between two nodes. When mapp s p o (where s and o are individuals) (d) s SubPropertyOf o (e) s EquivalentTo o (f) s type o from_schema: https://github.com/geneontology/obographs -rank: 1000 attributes: sub: name: sub diff --git a/docs/datamodels/obograph/EquivalentNodesSet.md b/docs/datamodels/obograph/EquivalentNodesSet.md index 05d2c53a4..a5fc72ad0 100644 --- a/docs/datamodels/obograph/EquivalentNodesSet.md +++ b/docs/datamodels/obograph/EquivalentNodesSet.md @@ -1,21 +1,36 @@ + + # Class: EquivalentNodesSet + + _A clique of nodes that are all mutually equivalent_ + URI: [owl:equivalentClass](http://www.w3.org/2002/07/owl#equivalentClass) -```{mermaid} + + + +```mermaid classDiagram class EquivalentNodesSet + click EquivalentNodesSet href "../EquivalentNodesSet" Axiom <|-- EquivalentNodesSet + click Axiom href "../Axiom" EquivalentNodesSet : meta - EquivalentNodesSet ..> Meta : meta + + + + EquivalentNodesSet --> "0..1" Meta : meta + click Meta href "../Meta" + EquivalentNodesSet : nodeIds @@ -39,7 +54,7 @@ URI: [owl:equivalentClass](http://www.w3.org/2002/07/owl#equivalentClass) | Name | Cardinality and Range | Description | Inheritance | | --- | --- | --- | --- | | [representativeNodeId](representativeNodeId.md) | 0..1
[String](String.md) | The identifier of a node that represents the class in an OWL equivalence cliq... | direct | -| [nodeIds](nodeIds.md) | 0..*
[String](String.md) | | direct | +| [nodeIds](nodeIds.md) | *
[String](String.md) | | direct | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | [Axiom](Axiom.md) | @@ -73,7 +88,6 @@ URI: [owl:equivalentClass](http://www.w3.org/2002/07/owl#equivalentClass) - ## Mappings | Mapping Type | Mapped Value | @@ -85,6 +99,8 @@ URI: [owl:equivalentClass](http://www.w3.org/2002/07/owl#equivalentClass) + + ## LinkML Source @@ -96,7 +112,6 @@ URI: [owl:equivalentClass](http://www.w3.org/2002/07/owl#equivalentClass) name: EquivalentNodesSet description: A clique of nodes that are all mutually equivalent from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: Axiom slots: - representativeNodeId @@ -113,7 +128,6 @@ class_uri: owl:equivalentClass name: EquivalentNodesSet description: A clique of nodes that are all mutually equivalent from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: Axiom attributes: representativeNodeId: @@ -131,12 +145,12 @@ attributes: name: nodeIds from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: nodeIds owner: EquivalentNodesSet domain_of: - EquivalentNodesSet range: string + multivalued: true meta: name: meta description: A collection of metadata about either an ontology (graph), an entity, diff --git a/docs/datamodels/obograph/ExistentialRestrictionExpression.md b/docs/datamodels/obograph/ExistentialRestrictionExpression.md index 881977ce0..737440af6 100644 --- a/docs/datamodels/obograph/ExistentialRestrictionExpression.md +++ b/docs/datamodels/obograph/ExistentialRestrictionExpression.md @@ -1,16 +1,25 @@ + + # Class: ExistentialRestrictionExpression + + _An existential restriction (OWL some values from) expression_ + URI: [owl:Restriction](http://www.w3.org/2002/07/owl#Restriction) -```{mermaid} + + + +```mermaid classDiagram class ExistentialRestrictionExpression + click ExistentialRestrictionExpression href "../ExistentialRestrictionExpression" ExistentialRestrictionExpression : fillerId ExistentialRestrictionExpression : propertyId @@ -40,6 +49,8 @@ URI: [owl:Restriction](http://www.w3.org/2002/07/owl#Restriction) | used by | used in | type | used | | --- | --- | --- | --- | | [LogicalDefinitionAxiom](LogicalDefinitionAxiom.md) | [restrictions](restrictions.md) | range | [ExistentialRestrictionExpression](ExistentialRestrictionExpression.md) | +| [DisjointClassExpressionsAxiom](DisjointClassExpressionsAxiom.md) | [classExpressions](classExpressions.md) | range | [ExistentialRestrictionExpression](ExistentialRestrictionExpression.md) | +| [DisjointClassExpressionsAxiom](DisjointClassExpressionsAxiom.md) | [unionEquivalentToExpression](unionEquivalentToExpression.md) | range | [ExistentialRestrictionExpression](ExistentialRestrictionExpression.md) | @@ -77,7 +88,6 @@ URI: [owl:Restriction](http://www.w3.org/2002/07/owl#Restriction) - ## Mappings | Mapping Type | Mapped Value | @@ -89,6 +99,8 @@ URI: [owl:Restriction](http://www.w3.org/2002/07/owl#Restriction) + + ## LinkML Source @@ -110,7 +122,6 @@ comments: from_schema: https://github.com/geneontology/obographs aliases: - some values from expression -rank: 1000 slots: - fillerId - propertyId @@ -136,7 +147,6 @@ comments: from_schema: https://github.com/geneontology/obographs aliases: - some values from expression -rank: 1000 attributes: fillerId: name: fillerId diff --git a/docs/datamodels/obograph/Graph.md b/docs/datamodels/obograph/Graph.md index 2011649b0..e02256829 100644 --- a/docs/datamodels/obograph/Graph.md +++ b/docs/datamodels/obograph/Graph.md @@ -1,31 +1,60 @@ + + # Class: Graph + + _A graph is a collection of nodes and edges and other axioms that represents a single ontology._ + URI: [owl:Ontology](http://www.w3.org/2002/07/owl#Ontology) -```{mermaid} + + + +```mermaid classDiagram class Graph + click Graph href "../Graph" Graph : allValuesFromEdges - Graph ..> Edge : allValuesFromEdges + + + + Graph --> "*" Edge : allValuesFromEdges + click Edge href "../Edge" + Graph : domainRangeAxioms - Graph ..> DomainRangeAxiom : domainRangeAxioms + + + + Graph --> "*" DomainRangeAxiom : domainRangeAxioms + click DomainRangeAxiom href "../DomainRangeAxiom" + Graph : edges - Graph ..> Edge : edges + + + + Graph --> "*" Edge : edges + click Edge href "../Edge" + Graph : equivalentNodesSets - Graph ..> EquivalentNodesSet : equivalentNodesSets + + + + Graph --> "*" EquivalentNodesSet : equivalentNodesSets + click EquivalentNodesSet href "../EquivalentNodesSet" + Graph : id @@ -33,31 +62,66 @@ URI: [owl:Ontology](http://www.w3.org/2002/07/owl#Ontology) Graph : logicalDefinitionAxioms - Graph ..> LogicalDefinitionAxiom : logicalDefinitionAxioms + + + + Graph --> "*" LogicalDefinitionAxiom : logicalDefinitionAxioms + click LogicalDefinitionAxiom href "../LogicalDefinitionAxiom" + Graph : meta - Graph ..> Meta : meta + + + + Graph --> "0..1" Meta : meta + click Meta href "../Meta" + Graph : nodes - Graph ..> Node : nodes + + + + Graph --> "*" Node : nodes + click Node href "../Node" + Graph : prefixes - Graph ..> PrefixDeclaration : prefixes + + + + Graph --> "*" PrefixDeclaration : prefixes + click PrefixDeclaration href "../PrefixDeclaration" + Graph : propertyChainAxioms - Graph ..> PropertyChainAxiom : propertyChainAxioms + + + + Graph --> "*" PropertyChainAxiom : propertyChainAxioms + click PropertyChainAxiom href "../PropertyChainAxiom" + Graph : subsetDefinitions - Graph ..> SubsetDefinition : subsetDefinitions + + + + Graph --> "*" SubsetDefinition : subsetDefinitions + click SubsetDefinition href "../SubsetDefinition" + Graph : synonymTypeDefinitions - Graph ..> SynonymTypeDefinition : synonymTypeDefinitions + + + + Graph --> "*" SynonymTypeDefinition : synonymTypeDefinitions + click SynonymTypeDefinition href "../SynonymTypeDefinition" + ``` @@ -72,19 +136,19 @@ URI: [owl:Ontology](http://www.w3.org/2002/07/owl#Ontology) | Name | Cardinality and Range | Description | Inheritance | | --- | --- | --- | --- | -| [id](id.md) | 1..1
[OboIdentifierString](OboIdentifierString.md) | The unique identifier of the entity | direct | +| [id](id.md) | 1
[OboIdentifierString](OboIdentifierString.md) | The unique identifier of the entity | direct | | [lbl](lbl.md) | 0..1
[String](String.md) | the human-readable label of a node | direct | -| [prefixes](prefixes.md) | 0..*
[PrefixDeclaration](PrefixDeclaration.md) | A collection of mappings between prefixes and namespaces, used to map CURIEs ... | direct | -| [subsetDefinitions](subsetDefinitions.md) | 0..*
[SubsetDefinition](SubsetDefinition.md) | | direct | -| [synonymTypeDefinitions](synonymTypeDefinitions.md) | 0..*
[SynonymTypeDefinition](SynonymTypeDefinition.md) | | direct | +| [prefixes](prefixes.md) | *
[PrefixDeclaration](PrefixDeclaration.md) | A collection of mappings between prefixes and namespaces, used to map CURIEs ... | direct | +| [subsetDefinitions](subsetDefinitions.md) | *
[SubsetDefinition](SubsetDefinition.md) | | direct | +| [synonymTypeDefinitions](synonymTypeDefinitions.md) | *
[SynonymTypeDefinition](SynonymTypeDefinition.md) | | direct | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | direct | -| [nodes](nodes.md) | 0..*
[Node](Node.md) | All nodes present in a graph | direct | -| [edges](edges.md) | 0..*
[Edge](Edge.md) | All edges present in a graph | direct | -| [equivalentNodesSets](equivalentNodesSets.md) | 0..*
[EquivalentNodesSet](EquivalentNodesSet.md) | A list of sets of nodes that form equivalence cliques | direct | -| [logicalDefinitionAxioms](logicalDefinitionAxioms.md) | 0..*
[LogicalDefinitionAxiom](LogicalDefinitionAxiom.md) | A list of logical definition axioms that define the meaning of a class in ter... | direct | -| [domainRangeAxioms](domainRangeAxioms.md) | 0..*
[DomainRangeAxiom](DomainRangeAxiom.md) | A list of axioms that define the domain and range of a property | direct | -| [allValuesFromEdges](allValuesFromEdges.md) | 0..*
[Edge](Edge.md) | A list of edges that represent subclasses of universal restrictions | direct | -| [propertyChainAxioms](propertyChainAxioms.md) | 0..*
[PropertyChainAxiom](PropertyChainAxiom.md) | A list of axioms that define an OWL property chain | direct | +| [nodes](nodes.md) | *
[Node](Node.md) | All nodes present in a graph | direct | +| [edges](edges.md) | *
[Edge](Edge.md) | All edges present in a graph | direct | +| [equivalentNodesSets](equivalentNodesSets.md) | *
[EquivalentNodesSet](EquivalentNodesSet.md) | A list of sets of nodes that form equivalence cliques | direct | +| [logicalDefinitionAxioms](logicalDefinitionAxioms.md) | *
[LogicalDefinitionAxiom](LogicalDefinitionAxiom.md) | A list of logical definition axioms that define the meaning of a class in ter... | direct | +| [domainRangeAxioms](domainRangeAxioms.md) | *
[DomainRangeAxiom](DomainRangeAxiom.md) | A list of axioms that define the domain and range of a property | direct | +| [allValuesFromEdges](allValuesFromEdges.md) | *
[Edge](Edge.md) | A list of edges that represent subclasses of universal restrictions | direct | +| [propertyChainAxioms](propertyChainAxioms.md) | *
[PropertyChainAxiom](PropertyChainAxiom.md) | A list of axioms that define an OWL property chain | direct | @@ -117,7 +181,6 @@ URI: [owl:Ontology](http://www.w3.org/2002/07/owl#Ontology) - ## Mappings | Mapping Type | Mapped Value | @@ -129,6 +192,8 @@ URI: [owl:Ontology](http://www.w3.org/2002/07/owl#Ontology) + + ## LinkML Source @@ -141,7 +206,6 @@ name: Graph description: A graph is a collection of nodes and edges and other axioms that represents a single ontology. from_schema: https://github.com/geneontology/obographs -rank: 1000 slots: - id - lbl @@ -169,7 +233,6 @@ name: Graph description: A graph is a collection of nodes and edges and other axioms that represents a single ontology. from_schema: https://github.com/geneontology/obographs -rank: 1000 attributes: id: name: id @@ -187,6 +250,7 @@ attributes: - SubsetDefinition - SynonymTypeDefinition range: OboIdentifierString + required: true lbl: name: lbl description: the human-readable label of a node @@ -214,35 +278,35 @@ attributes: from_schema: https://github.com/geneontology/obographs rank: 1000 slot_uri: sh:declare - multivalued: true alias: prefixes owner: Graph domain_of: - GraphDocument - Graph range: PrefixDeclaration + multivalued: true inlined: true subsetDefinitions: name: subsetDefinitions from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: subsetDefinitions owner: Graph domain_of: - Graph range: SubsetDefinition + multivalued: true inlined: true synonymTypeDefinitions: name: synonymTypeDefinitions from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: synonymTypeDefinitions owner: Graph domain_of: - Graph range: SynonymTypeDefinition + multivalued: true inlined: true meta: name: meta @@ -269,12 +333,12 @@ attributes: annotation properties, etc from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: nodes owner: Graph domain_of: - Graph range: Node + multivalued: true inlined: true inlined_as_list: true edges: @@ -286,12 +350,12 @@ attributes: and a simple existential axiom (d) ObjectPropertyAssertions from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: edges owner: Graph domain_of: - Graph range: Edge + multivalued: true inlined: true inlined_as_list: true equivalentNodesSets: @@ -299,24 +363,24 @@ attributes: description: A list of sets of nodes that form equivalence cliques from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: equivalentNodesSets owner: Graph domain_of: - Graph range: EquivalentNodesSet + multivalued: true logicalDefinitionAxioms: name: logicalDefinitionAxioms description: A list of logical definition axioms that define the meaning of a class in terms of other classes. from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: logicalDefinitionAxioms owner: Graph domain_of: - Graph range: LogicalDefinitionAxiom + multivalued: true inlined: true inlined_as_list: true domainRangeAxioms: @@ -324,35 +388,35 @@ attributes: description: A list of axioms that define the domain and range of a property from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: domainRangeAxioms owner: Graph domain_of: - Graph range: DomainRangeAxiom + multivalued: true allValuesFromEdges: name: allValuesFromEdges description: A list of edges that represent subclasses of universal restrictions from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: allValuesFromEdges owner: Graph domain_of: - Graph - DomainRangeAxiom range: Edge + multivalued: true propertyChainAxioms: name: propertyChainAxioms description: A list of axioms that define an OWL property chain from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: propertyChainAxioms owner: Graph domain_of: - Graph range: PropertyChainAxiom + multivalued: true class_uri: owl:Ontology ``` diff --git a/docs/datamodels/obograph/GraphDocument.md b/docs/datamodels/obograph/GraphDocument.md index 8faf7ec14..449d5b77a 100644 --- a/docs/datamodels/obograph/GraphDocument.md +++ b/docs/datamodels/obograph/GraphDocument.md @@ -1,27 +1,51 @@ + + # Class: GraphDocument + + _A graph document is a collection of graphs together with a set of prefixes that apply across all of them_ + URI: [obographs:GraphDocument](https://github.com/geneontology/obographs/GraphDocument) -```{mermaid} + + + +```mermaid classDiagram class GraphDocument + click GraphDocument href "../GraphDocument" GraphDocument : graphs - GraphDocument ..> Graph : graphs + + + + GraphDocument --> "*" Graph : graphs + click Graph href "../Graph" + GraphDocument : meta - GraphDocument ..> Meta : meta + + + + GraphDocument --> "0..1" Meta : meta + click Meta href "../Meta" + GraphDocument : prefixes - GraphDocument ..> PrefixDeclaration : prefixes + + + + GraphDocument --> "*" PrefixDeclaration : prefixes + click PrefixDeclaration href "../PrefixDeclaration" + ``` @@ -37,8 +61,8 @@ URI: [obographs:GraphDocument](https://github.com/geneontology/obographs/GraphDo | Name | Cardinality and Range | Description | Inheritance | | --- | --- | --- | --- | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | direct | -| [graphs](graphs.md) | 0..*
[Graph](Graph.md) | A list of all graphs (ontologies) in an ontology document | direct | -| [prefixes](prefixes.md) | 0..*
[PrefixDeclaration](PrefixDeclaration.md) | A collection of mappings between prefixes and namespaces, used to map CURIEs ... | direct | +| [graphs](graphs.md) | *
[Graph](Graph.md) | A list of all graphs (ontologies) in an ontology document | direct | +| [prefixes](prefixes.md) | *
[PrefixDeclaration](PrefixDeclaration.md) | A collection of mappings between prefixes and namespaces, used to map CURIEs ... | direct | @@ -68,7 +92,6 @@ URI: [obographs:GraphDocument](https://github.com/geneontology/obographs/GraphDo - ## Mappings | Mapping Type | Mapped Value | @@ -80,6 +103,8 @@ URI: [obographs:GraphDocument](https://github.com/geneontology/obographs/GraphDo + + ## LinkML Source @@ -95,7 +120,6 @@ comments: - A graph document frequently has a single graph but a multi-graph document can be used to represent multiple ontologies in an import closure in a single file. from_schema: https://github.com/geneontology/obographs -rank: 1000 slots: - meta - graphs @@ -115,7 +139,6 @@ comments: - A graph document frequently has a single graph but a multi-graph document can be used to represent multiple ontologies in an import closure in a single file. from_schema: https://github.com/geneontology/obographs -rank: 1000 attributes: meta: name: meta @@ -140,12 +163,12 @@ attributes: description: A list of all graphs (ontologies) in an ontology document. from_schema: https://github.com/geneontology/obographs rank: 1000 - multivalued: true alias: graphs owner: GraphDocument domain_of: - GraphDocument range: Graph + multivalued: true inlined: true inlined_as_list: true prefixes: @@ -155,13 +178,13 @@ attributes: from_schema: https://github.com/geneontology/obographs rank: 1000 slot_uri: sh:declare - multivalued: true alias: prefixes owner: GraphDocument domain_of: - GraphDocument - Graph range: PrefixDeclaration + multivalued: true inlined: true ``` diff --git a/docs/datamodels/obograph/Meta.md b/docs/datamodels/obograph/Meta.md index 3032b5c84..4f2319ff7 100644 --- a/docs/datamodels/obograph/Meta.md +++ b/docs/datamodels/obograph/Meta.md @@ -1,52 +1,122 @@ -# Slot: meta -_A collection of metadata about either an ontology (graph), an entity, or an axiom_ -URI: [obographs:meta](https://github.com/geneontology/obographs/meta) +# Class: Meta + + +_A collection of annotations on an entity or ontology or edge or axiom. Metadata typically does not affect the logical interpretation of the container but provides useful information to humans or machines._ + + + + + +URI: [obographs:Meta](https://github.com/geneontology/obographs/Meta) + - +```mermaid + classDiagram + class Meta + click Meta href "../Meta" + Meta : basicPropertyValues + + + + + Meta --> "*" BasicPropertyValue : basicPropertyValues + click BasicPropertyValue href "../BasicPropertyValue" + + Meta : comments + + Meta : definition + + + + + Meta --> "0..1" DefinitionPropertyValue : definition + click DefinitionPropertyValue href "../DefinitionPropertyValue" -## Applicable Classes + + Meta : deprecated + + Meta : subsets + + Meta : synonyms + + + + + Meta --> "*" SynonymPropertyValue : synonyms + click SynonymPropertyValue href "../SynonymPropertyValue" + + + Meta : version + + Meta : xrefs + + + + + Meta --> "*" XrefPropertyValue : xrefs + click XrefPropertyValue href "../XrefPropertyValue" + + + +``` -| Name | Description | -| --- | --- | -[GraphDocument](GraphDocument.md) | A graph document is a collection of graphs together with a set of prefixes th... -[Graph](Graph.md) | A graph is a collection of nodes and edges and other axioms that represents a... -[Node](Node.md) | A node is a class, property, or other entity in an ontology -[Edge](Edge.md) | An edge is a simple typed relationship between two nodes -[PropertyValue](PropertyValue.md) | A generic grouping for the different kinds of key-value associations on objec... -[Axiom](Axiom.md) | A generic grouping for any OWL axiom or group of axioms that is not captured ... -[DefinitionPropertyValue](DefinitionPropertyValue.md) | A property value that represents an assertion about the textual definition of... -[BasicPropertyValue](BasicPropertyValue.md) | A property value that represents an assertion about an entity that is not a d... -[XrefPropertyValue](XrefPropertyValue.md) | A property value that represents an assertion about an external reference to ... -[SynonymPropertyValue](SynonymPropertyValue.md) | A property value that represents an assertion about a synonym of an entity -[DomainRangeAxiom](DomainRangeAxiom.md) | This groups potentially multiple axioms that constrain the usage of a propert... -[EquivalentNodesSet](EquivalentNodesSet.md) | A clique of nodes that are all mutually equivalent -[LogicalDefinitionAxiom](LogicalDefinitionAxiom.md) | An axiom that defines a class in terms of a genus or set of genus classes and... -[PropertyChainAxiom](PropertyChainAxiom.md) | An axiom that represents an OWL property chain, e + + +## Slots +| Name | Cardinality and Range | Description | Inheritance | +| --- | --- | --- | --- | +| [subsets](subsets.md) | *
[String](String.md) | A list of subsets to which this entity belongs | direct | +| [version](version.md) | 0..1
[String](String.md) | | direct | +| [comments](comments.md) | *
[String](String.md) | A list of comments about the entity | direct | +| [definition](definition.md) | 0..1
[DefinitionPropertyValue](DefinitionPropertyValue.md) | A definition of an entity | direct | +| [xrefs](xrefs.md) | *
[XrefPropertyValue](XrefPropertyValue.md) | A list of cross references to other entities represented in other ontologies,... | direct | +| [synonyms](synonyms.md) | *
[SynonymPropertyValue](SynonymPropertyValue.md) | A list of synonym property value assertions for an entity | direct | +| [basicPropertyValues](basicPropertyValues.md) | *
[BasicPropertyValue](BasicPropertyValue.md) | A list of open-ended property values that does not correspond to those predef... | direct | +| [deprecated](deprecated.md) | 0..1
[Boolean](Boolean.md) | | direct | -## Properties -* Range: [Meta](Meta.md) +## Usages + +| used by | used in | type | used | +| --- | --- | --- | --- | +| [GraphDocument](GraphDocument.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [Graph](Graph.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [Node](Node.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [Edge](Edge.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [DefinitionPropertyValue](DefinitionPropertyValue.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [BasicPropertyValue](BasicPropertyValue.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [XrefPropertyValue](XrefPropertyValue.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [SynonymPropertyValue](SynonymPropertyValue.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [PropertyValue](PropertyValue.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [Axiom](Axiom.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [DomainRangeAxiom](DomainRangeAxiom.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [EquivalentNodesSet](EquivalentNodesSet.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [LogicalDefinitionAxiom](LogicalDefinitionAxiom.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [DisjointClassExpressionsAxiom](DisjointClassExpressionsAxiom.md) | [meta](meta.md) | range | [Meta](Meta.md) | +| [PropertyChainAxiom](PropertyChainAxiom.md) | [meta](meta.md) | range | [Meta](Meta.md) | + + ## Aliases -* annotations +* annotation collection @@ -66,26 +136,171 @@ URI: [obographs:meta](https://github.com/geneontology/obographs/meta) +## Mappings + +| Mapping Type | Mapped Value | +| --- | --- | +| self | obographs:Meta | +| native | obographs:Meta | + + + + + + + ## LinkML Source + + +### Direct + +
+```yaml +name: Meta +description: A collection of annotations on an entity or ontology or edge or axiom. + Metadata typically does not affect the logical interpretation of the container but + provides useful information to humans or machines. +from_schema: https://github.com/geneontology/obographs +aliases: +- annotation collection +slots: +- subsets +- version +- comments +- definition +- xrefs +- synonyms +- basicPropertyValues +- deprecated +slot_usage: + xrefs: + name: xrefs + domain_of: + - Meta + - PropertyValue + range: XrefPropertyValue + multivalued: true + +``` +
+ +### Induced +
```yaml -name: meta -description: A collection of metadata about either an ontology (graph), an entity, - or an axiom +name: Meta +description: A collection of annotations on an entity or ontology or edge or axiom. + Metadata typically does not affect the logical interpretation of the container but + provides useful information to humans or machines. from_schema: https://github.com/geneontology/obographs aliases: -- annotations -rank: 1000 -alias: meta -domain_of: -- GraphDocument -- Graph -- Node -- Edge -- PropertyValue -- Axiom -range: Meta +- annotation collection +slot_usage: + xrefs: + name: xrefs + domain_of: + - Meta + - PropertyValue + range: XrefPropertyValue + multivalued: true +attributes: + subsets: + name: subsets + description: A list of subsets to which this entity belongs + from_schema: https://github.com/geneontology/obographs + rank: 1000 + slot_uri: oio:inSubset + alias: subsets + owner: Meta + domain_of: + - Meta + range: string + multivalued: true + version: + name: version + from_schema: https://github.com/geneontology/obographs + rank: 1000 + slot_uri: owl:versionInfo + alias: version + owner: Meta + domain_of: + - Meta + range: string + comments: + name: comments + description: A list of comments about the entity + comments: + - for historic reasons obo format only supports a single comment per entity. This + limitation is not carried over here, but users should be aware that multiple + comments will not be supported in converting back to obo format. + from_schema: https://github.com/geneontology/obographs + rank: 1000 + slot_uri: rdfs:comment + alias: comments + owner: Meta + domain_of: + - Meta + range: string + multivalued: true + definition: + name: definition + description: A definition of an entity + from_schema: https://github.com/geneontology/obographs + rank: 1000 + slot_uri: IAO:0000115 + alias: definition + owner: Meta + domain_of: + - Meta + range: DefinitionPropertyValue + xrefs: + name: xrefs + description: A list of cross references to other entities represented in other + ontologies, vocabularies, databases, or websites. The semantics of xrefs are + intentionally weak, and most closely align with rdfs:seeAlso + from_schema: https://github.com/geneontology/obographs + rank: 1000 + alias: xrefs + owner: Meta + domain_of: + - Meta + - PropertyValue + range: XrefPropertyValue + multivalued: true + synonyms: + name: synonyms + description: A list of synonym property value assertions for an entity + from_schema: https://github.com/geneontology/obographs + rank: 1000 + alias: synonyms + owner: Meta + domain_of: + - Meta + range: SynonymPropertyValue + multivalued: true + basicPropertyValues: + name: basicPropertyValues + description: A list of open-ended property values that does not correspond to + those predefined in this standard, i.e xref, synonyms, definition + from_schema: https://github.com/geneontology/obographs + rank: 1000 + alias: basicPropertyValues + owner: Meta + domain_of: + - Meta + range: BasicPropertyValue + multivalued: true + deprecated: + name: deprecated + from_schema: https://github.com/geneontology/obographs + rank: 1000 + slot_uri: owl:deprecated + alias: deprecated + owner: Meta + domain_of: + - Meta + range: boolean ```
\ No newline at end of file diff --git a/docs/datamodels/obograph/Node.md b/docs/datamodels/obograph/Node.md index bdbf83e57..fb2600409 100644 --- a/docs/datamodels/obograph/Node.md +++ b/docs/datamodels/obograph/Node.md @@ -1,23 +1,46 @@ + + # Class: Node + + _A node is a class, property, or other entity in an ontology_ + URI: [rdf:Resource](http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource) -```{mermaid} + + + +```mermaid classDiagram class Node + click Node href "../Node" Node : id Node : lbl Node : meta - Node ..> Meta : meta + + + + Node --> "0..1" Meta : meta + click Meta href "../Meta" + + + Node : propertyType + + + + + Node --> "0..1" PropertyTypeEnum : propertyType + click PropertyTypeEnum href "../PropertyTypeEnum" + Node : type @@ -34,9 +57,10 @@ URI: [rdf:Resource](http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource) | Name | Cardinality and Range | Description | Inheritance | | --- | --- | --- | --- | -| [id](id.md) | 1..1
[OboIdentifierString](OboIdentifierString.md) | The unique identifier of the entity | direct | +| [id](id.md) | 1
[OboIdentifierString](OboIdentifierString.md) | The unique identifier of the entity | direct | | [lbl](lbl.md) | 0..1
[String](String.md) | the human-readable label of a node | direct | | [type](type.md) | 0..1
[String](String.md) | | direct | +| [propertyType](propertyType.md) | 0..1
[PropertyTypeEnum](PropertyTypeEnum.md) | | direct | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | direct | @@ -70,7 +94,6 @@ URI: [rdf:Resource](http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource) - ## Mappings | Mapping Type | Mapped Value | @@ -82,6 +105,8 @@ URI: [rdf:Resource](http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource) + + ## LinkML Source @@ -93,11 +118,11 @@ URI: [rdf:Resource](http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource) name: Node description: A node is a class, property, or other entity in an ontology from_schema: https://github.com/geneontology/obographs -rank: 1000 slots: - id - lbl - type +- propertyType - meta class_uri: rdf:Resource @@ -111,7 +136,6 @@ class_uri: rdf:Resource name: Node description: A node is a class, property, or other entity in an ontology from_schema: https://github.com/geneontology/obographs -rank: 1000 attributes: id: name: id @@ -129,6 +153,7 @@ attributes: - SubsetDefinition - SynonymTypeDefinition range: OboIdentifierString + required: true lbl: name: lbl description: the human-readable label of a node @@ -158,6 +183,15 @@ attributes: domain_of: - Node range: string + propertyType: + name: propertyType + from_schema: https://github.com/geneontology/obographs + rank: 1000 + alias: propertyType + owner: Node + domain_of: + - Node + range: PropertyTypeEnum meta: name: meta description: A collection of metadata about either an ontology (graph), an entity, diff --git a/docs/datamodels/obograph/PropertyValue.md b/docs/datamodels/obograph/PropertyValue.md index cd680d0fb..8aa993f9a 100644 --- a/docs/datamodels/obograph/PropertyValue.md +++ b/docs/datamodels/obograph/PropertyValue.md @@ -1,8 +1,13 @@ + + # Class: PropertyValue + + _A generic grouping for the different kinds of key-value associations on object. Minimally, a property value has a predicate and a value. It can also have a list of xrefs indicating provenance, as well as a metadata object._ + * __NOTE__: this is an abstract class and should not be instantiated directly @@ -10,19 +15,32 @@ URI: [obographs:PropertyValue](https://github.com/geneontology/obographs/Propert -```{mermaid} + + + +```mermaid classDiagram class PropertyValue + click PropertyValue href "../PropertyValue" PropertyValue <|-- DefinitionPropertyValue + click DefinitionPropertyValue href "../DefinitionPropertyValue" PropertyValue <|-- BasicPropertyValue + click BasicPropertyValue href "../BasicPropertyValue" PropertyValue <|-- XrefPropertyValue + click XrefPropertyValue href "../XrefPropertyValue" PropertyValue <|-- SynonymPropertyValue + click SynonymPropertyValue href "../SynonymPropertyValue" PropertyValue : lang PropertyValue : meta - PropertyValue ..> Meta : meta + + + + PropertyValue --> "0..1" Meta : meta + click Meta href "../Meta" + PropertyValue : pred @@ -54,7 +72,7 @@ URI: [obographs:PropertyValue](https://github.com/geneontology/obographs/Propert | --- | --- | --- | --- | | [pred](pred.md) | 0..1
[String](String.md) | the predicate of an edge | direct | | [val](val.md) | 0..1
[String](String.md) | the value of a property | direct | -| [xrefs](xrefs.md) | 0..*
[XrefString](XrefString.md) | A list of cross references to other entities represented in other ontologies,... | direct | +| [xrefs](xrefs.md) | *
[XrefString](XrefString.md) | A list of cross references to other entities represented in other ontologies,... | direct | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | direct | | [valType](valType.md) | 0..1
[String](String.md) | the datatype of a property value | direct | | [lang](lang.md) | 0..1
[String](String.md) | the language of a property value | direct | @@ -92,7 +110,6 @@ URI: [obographs:PropertyValue](https://github.com/geneontology/obographs/Propert - ## Mappings | Mapping Type | Mapped Value | @@ -104,6 +121,8 @@ URI: [obographs:PropertyValue](https://github.com/geneontology/obographs/Propert + + ## LinkML Source @@ -123,7 +142,6 @@ comments: from_schema: https://github.com/geneontology/obographs aliases: - annotation -rank: 1000 abstract: true slots: - pred @@ -151,7 +169,6 @@ comments: from_schema: https://github.com/geneontology/obographs aliases: - annotation -rank: 1000 abstract: true attributes: pred: @@ -192,13 +209,13 @@ attributes: close_mappings: - rdfs:seeAlso rank: 1000 - multivalued: true alias: xrefs owner: PropertyValue domain_of: - Meta - PropertyValue range: XrefString + multivalued: true meta: name: meta description: A collection of metadata about either an ontology (graph), an entity, diff --git a/docs/datamodels/obograph/SynonymPropertyValue.md b/docs/datamodels/obograph/SynonymPropertyValue.md index fb6603b3e..b1838437b 100644 --- a/docs/datamodels/obograph/SynonymPropertyValue.md +++ b/docs/datamodels/obograph/SynonymPropertyValue.md @@ -1,17 +1,27 @@ + + # Class: SynonymPropertyValue + + _A property value that represents an assertion about a synonym of an entity_ + URI: [obographs:SynonymPropertyValue](https://github.com/geneontology/obographs/SynonymPropertyValue) -```{mermaid} + + + +```mermaid classDiagram class SynonymPropertyValue + click SynonymPropertyValue href "../SynonymPropertyValue" PropertyValue <|-- SynonymPropertyValue + click PropertyValue href "../PropertyValue" SynonymPropertyValue : isExact @@ -19,11 +29,21 @@ URI: [obographs:SynonymPropertyValue](https://github.com/geneontology/obographs/ SynonymPropertyValue : meta - SynonymPropertyValue ..> Meta : meta + + + + SynonymPropertyValue --> "0..1" Meta : meta + click Meta href "../Meta" + SynonymPropertyValue : pred - SynonymPropertyValue ..> ScopeEnum : pred + + + + SynonymPropertyValue --> "0..1" ScopeEnum : pred + click ScopeEnum href "../ScopeEnum" + SynonymPropertyValue : synonymType @@ -52,9 +72,9 @@ URI: [obographs:SynonymPropertyValue](https://github.com/geneontology/obographs/ | --- | --- | --- | --- | | [synonymType](synonymType.md) | 0..1
[SynonymTypeIdentifierString](SynonymTypeIdentifierString.md) | This standard follows oboInOwl in allowing an open ended list of synonym type... | direct | | [isExact](isExact.md) | 0..1
[Boolean](Boolean.md) | | direct | -| [pred](pred.md) | 0..1
[String](String.md) | the predicate of an edge | direct | +| [pred](pred.md) | 0..1
[ScopeEnum](ScopeEnum.md) | the predicate of an edge | direct | | [val](val.md) | 0..1
[String](String.md) | The textual string representing the synonym | [PropertyValue](PropertyValue.md) | -| [xrefs](xrefs.md) | 0..*
[XrefString](XrefString.md) | A list of cross references to other entities represented in other ontologies,... | [PropertyValue](PropertyValue.md) | +| [xrefs](xrefs.md) | *
[XrefString](XrefString.md) | A list of cross references to other entities represented in other ontologies,... | [PropertyValue](PropertyValue.md) | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | [PropertyValue](PropertyValue.md) | | [valType](valType.md) | 0..1
[String](String.md) | the datatype of a property value | [PropertyValue](PropertyValue.md) | | [lang](lang.md) | 0..1
[String](String.md) | the language of a property value | [PropertyValue](PropertyValue.md) | @@ -90,7 +110,6 @@ URI: [obographs:SynonymPropertyValue](https://github.com/geneontology/obographs/ - ## Mappings | Mapping Type | Mapped Value | @@ -102,6 +121,8 @@ URI: [obographs:SynonymPropertyValue](https://github.com/geneontology/obographs/ + + ## LinkML Source @@ -113,7 +134,6 @@ URI: [obographs:SynonymPropertyValue](https://github.com/geneontology/obographs/ name: SynonymPropertyValue description: A property value that represents an assertion about a synonym of an entity from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: PropertyValue slots: - synonymType @@ -145,7 +165,6 @@ slot_usage: name: SynonymPropertyValue description: A property value that represents an assertion about a synonym of an entity from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: PropertyValue slot_usage: pred: @@ -221,13 +240,13 @@ attributes: close_mappings: - rdfs:seeAlso rank: 1000 - multivalued: true alias: xrefs owner: SynonymPropertyValue domain_of: - Meta - PropertyValue range: XrefString + multivalued: true meta: name: meta description: A collection of metadata about either an ontology (graph), an entity, diff --git a/docs/datamodels/obograph/XrefPropertyValue.md b/docs/datamodels/obograph/XrefPropertyValue.md index cfa4d08fe..79dce84de 100644 --- a/docs/datamodels/obograph/XrefPropertyValue.md +++ b/docs/datamodels/obograph/XrefPropertyValue.md @@ -1,23 +1,38 @@ + + # Class: XrefPropertyValue + + _A property value that represents an assertion about an external reference to an entity_ + URI: [obographs:XrefPropertyValue](https://github.com/geneontology/obographs/XrefPropertyValue) -```{mermaid} + + + +```mermaid classDiagram class XrefPropertyValue + click XrefPropertyValue href "../XrefPropertyValue" PropertyValue <|-- XrefPropertyValue + click PropertyValue href "../PropertyValue" XrefPropertyValue : lang XrefPropertyValue : meta - XrefPropertyValue ..> Meta : meta + + + + XrefPropertyValue --> "0..1" Meta : meta + click Meta href "../Meta" + XrefPropertyValue : pred @@ -46,7 +61,7 @@ URI: [obographs:XrefPropertyValue](https://github.com/geneontology/obographs/Xre | --- | --- | --- | --- | | [pred](pred.md) | 0..1
[String](String.md) | the predicate of an edge | [PropertyValue](PropertyValue.md) | | [val](val.md) | 0..1
[String](String.md) | The textual representation of the external reference, e | [PropertyValue](PropertyValue.md) | -| [xrefs](xrefs.md) | 0..*
[XrefString](XrefString.md) | A list of cross references to other entities represented in other ontologies,... | [PropertyValue](PropertyValue.md) | +| [xrefs](xrefs.md) | *
[XrefString](XrefString.md) | A list of cross references to other entities represented in other ontologies,... | [PropertyValue](PropertyValue.md) | | [meta](meta.md) | 0..1
[Meta](Meta.md) | A collection of metadata about either an ontology (graph), an entity, or an a... | [PropertyValue](PropertyValue.md) | | [valType](valType.md) | 0..1
[String](String.md) | the datatype of a property value | [PropertyValue](PropertyValue.md) | | [lang](lang.md) | 0..1
[String](String.md) | the language of a property value | [PropertyValue](PropertyValue.md) | @@ -82,7 +97,6 @@ URI: [obographs:XrefPropertyValue](https://github.com/geneontology/obographs/Xre - ## Mappings | Mapping Type | Mapped Value | @@ -94,6 +108,8 @@ URI: [obographs:XrefPropertyValue](https://github.com/geneontology/obographs/Xre + + ## LinkML Source @@ -106,7 +122,6 @@ name: XrefPropertyValue description: A property value that represents an assertion about an external reference to an entity from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: PropertyValue slot_usage: val: @@ -127,7 +142,6 @@ name: XrefPropertyValue description: A property value that represents an assertion about an external reference to an entity from_schema: https://github.com/geneontology/obographs -rank: 1000 is_a: PropertyValue slot_usage: val: @@ -174,13 +188,13 @@ attributes: close_mappings: - rdfs:seeAlso rank: 1000 - multivalued: true alias: xrefs owner: XrefPropertyValue domain_of: - Meta - PropertyValue range: XrefString + multivalued: true meta: name: meta description: A collection of metadata about either an ontology (graph), an entity, diff --git a/docs/datamodels/obograph/index.md b/docs/datamodels/obograph/index.md index a16acccf0..14d01f9c3 100644 --- a/docs/datamodels/obograph/index.md +++ b/docs/datamodels/obograph/index.md @@ -5,6 +5,7 @@ The principle elements of a Graph are Node objects and Edge objects. A Node repr Not everything in an ontology can be represented as nodes and edges. More complex axioms have specialized structures such as DomainRangeAxiom objects and LogicalDefinitionAxiom. URI: https://github.com/geneontology/obographs + Name: obographs_datamodel @@ -13,25 +14,28 @@ Name: obographs_datamodel | Class | Description | | --- | --- | -| [Axiom](Axiom.md) | A generic grouping for any OWL axiom or group of axioms that is not captured ... | -| [BasicPropertyValue](BasicPropertyValue.md) | A property value that represents an assertion about an entity that is not a d... | -| [DefinitionPropertyValue](DefinitionPropertyValue.md) | A property value that represents an assertion about the textual definition of... | -| [DomainRangeAxiom](DomainRangeAxiom.md) | This groups potentially multiple axioms that constrain the usage of a propert... | -| [Edge](Edge.md) | An edge is a simple typed relationship between two nodes | -| [EquivalentNodesSet](EquivalentNodesSet.md) | A clique of nodes that are all mutually equivalent | +| [Axiom](Axiom.md) | A generic grouping for any OWL axiom or group of axioms that is not captured by existing constructs in this standard. + | +|         [DisjointClassExpressionsAxiom](DisjointClassExpressionsAxiom.md) | An axiom that defines a set of classes or class expressions as being mutually disjoint. Formally, there exists no instance that instantiates more that one of the union of classIds and classExpressions. | +|         [DomainRangeAxiom](DomainRangeAxiom.md) | This groups potentially multiple axioms that constrain the usage of a property depending on some combination of domain and range. | +|         [EquivalentNodesSet](EquivalentNodesSet.md) | A clique of nodes that are all mutually equivalent | +|         [LogicalDefinitionAxiom](LogicalDefinitionAxiom.md) | An axiom that defines a class in terms of a genus or set of genus classes and a set of differentia | +|         [PropertyChainAxiom](PropertyChainAxiom.md) | An axiom that represents an OWL property chain, e.g. R <- R1 o ... o Rn | +| [Edge](Edge.md) | An edge is a simple typed relationship between two nodes. When mapping to OWL, an edge represents either (a) s SubClassOf o (b) s SubClassOf p some o (c) s p o (where s and o are individuals) (d) s SubPropertyOf o (e) s EquivalentTo o (f) s type o | | [ExistentialRestrictionExpression](ExistentialRestrictionExpression.md) | An existential restriction (OWL some values from) expression | -| [Graph](Graph.md) | A graph is a collection of nodes and edges and other axioms that represents a... | -| [GraphDocument](GraphDocument.md) | A graph document is a collection of graphs together with a set of prefixes th... | -| [LogicalDefinitionAxiom](LogicalDefinitionAxiom.md) | An axiom that defines a class in terms of a genus or set of genus classes and... | -| [Meta](Meta.md) | A collection of annotations on an entity or ontology or edge or axiom | +| [Graph](Graph.md) | A graph is a collection of nodes and edges and other axioms that represents a single ontology. | +| [GraphDocument](GraphDocument.md) | A graph document is a collection of graphs together with a set of prefixes that apply across all of them | +| [Meta](Meta.md) | A collection of annotations on an entity or ontology or edge or axiom. Metadata typically does not affect the logical interpretation of the container but provides useful information to humans or machines. | | [Node](Node.md) | A node is a class, property, or other entity in an ontology | -| [PrefixDeclaration](PrefixDeclaration.md) | A mapping between an individual prefix (e | -| [PropertyChainAxiom](PropertyChainAxiom.md) | An axiom that represents an OWL property chain, e | -| [PropertyValue](PropertyValue.md) | A generic grouping for the different kinds of key-value associations on objec... | -| [SubsetDefinition](SubsetDefinition.md) | | -| [SynonymPropertyValue](SynonymPropertyValue.md) | A property value that represents an assertion about a synonym of an entity | -| [SynonymTypeDefinition](SynonymTypeDefinition.md) | | -| [XrefPropertyValue](XrefPropertyValue.md) | A property value that represents an assertion about an external reference to ... | +| [PrefixDeclaration](PrefixDeclaration.md) | A mapping between an individual prefix (e.g. GO) and a namespace (e.g. http://purl.obolibrary.org/obo/GO_) | +| [PropertyValue](PropertyValue.md) | A generic grouping for the different kinds of key-value associations on object. Minimally, a property value has a predicate and a value. It can also have a list of xrefs indicating provenance, as well as a metadata object. | +|         [BasicPropertyValue](BasicPropertyValue.md) | A property value that represents an assertion about an entity that is not a definition, synonym, or xref | +|         [DefinitionPropertyValue](DefinitionPropertyValue.md) | A property value that represents an assertion about the textual definition of an entity | +|         [SynonymPropertyValue](SynonymPropertyValue.md) | A property value that represents an assertion about a synonym of an entity | +|         [XrefPropertyValue](XrefPropertyValue.md) | A property value that represents an assertion about an external reference to an entity | +| [SubsetDefinition](SubsetDefinition.md) | None | +| [SynonymTypeDefinition](SynonymTypeDefinition.md) | None | + ## Slots @@ -41,10 +45,13 @@ Name: obographs_datamodel | [allValuesFromEdges](allValuesFromEdges.md) | A list of edges that represent subclasses of universal restrictions | | [basicPropertyValues](basicPropertyValues.md) | A list of open-ended property values that does not correspond to those predef... | | [chainPredicateIds](chainPredicateIds.md) | A list of identifiers of predicates that form the precedent clause of a prope... | +| [classExpressions](classExpressions.md) | The set of class expressions that are mutually disjoint | +| [classIds](classIds.md) | The set of named classes that are mutually disjoint | | [comments](comments.md) | A list of comments about the entity | | [definedClassId](definedClassId.md) | The class that is defined by this axiom | | [definition](definition.md) | A definition of an entity | | [deprecated](deprecated.md) | | +| [disjointClassExpressionsAxioms](disjointClassExpressionsAxioms.md) | A list of logical disjointness axioms that specify that a class or class expr... | | [domainClassIds](domainClassIds.md) | | | [domainRangeAxioms](domainRangeAxioms.md) | A list of axioms that define the domain and range of a property | | [edges](edges.md) | All edges present in a graph | @@ -68,6 +75,7 @@ Name: obographs_datamodel | [prefixes](prefixes.md) | A collection of mappings between prefixes and namespaces, used to map CURIEs ... | | [propertyChainAxioms](propertyChainAxioms.md) | A list of axioms that define an OWL property chain | | [propertyId](propertyId.md) | in an OWL restriction expression, this is the predicate | +| [propertyType](propertyType.md) | | | [rangeClassIds](rangeClassIds.md) | | | [representativeNodeId](representativeNodeId.md) | The identifier of a node that represents the class in an OWL equivalence cliq... | | [restrictions](restrictions.md) | The set of restrictions that are the differentiating features of the defined ... | @@ -78,6 +86,8 @@ Name: obographs_datamodel | [synonymType](synonymType.md) | This standard follows oboInOwl in allowing an open ended list of synonym type... | | [synonymTypeDefinitions](synonymTypeDefinitions.md) | | | [type](type.md) | | +| [unionEquivalentTo](unionEquivalentTo.md) | If present, this equates to an OWL DisjointUnion expression | +| [unionEquivalentToExpression](unionEquivalentToExpression.md) | if present, this class expression is equivalent ot the (disjoint) union of th... | | [val](val.md) | the value of a property | | [valType](valType.md) | the datatype of a property value | | [version](version.md) | | @@ -88,6 +98,8 @@ Name: obographs_datamodel | Enumeration | Description | | --- | --- | +| [NodeTypeEnum](NodeTypeEnum.md) | The main type of a node | +| [PropertyTypeEnum](PropertyTypeEnum.md) | The node subtype for property nodes | | [ScopeEnum](ScopeEnum.md) | A vocabulary of terms that can be used to "scope" a synonym | @@ -104,10 +116,13 @@ Name: obographs_datamodel | [Double](Double.md) | A real number that conforms to the xsd:double specification | | [Float](Float.md) | A real number that conforms to the xsd:float specification | | [Integer](Integer.md) | An integer | +| [Jsonpath](Jsonpath.md) | A string encoding a JSON Path | +| [Jsonpointer](Jsonpointer.md) | A string encoding a JSON Pointer | | [Ncname](Ncname.md) | Prefix part of CURIE | | [Nodeidentifier](Nodeidentifier.md) | A URI, CURIE or BNODE that represents a node in a model | | [Objectidentifier](Objectidentifier.md) | A URI or CURIE that represents an object in the model | | [OboIdentifierString](OboIdentifierString.md) | A string that represents an OBO identifier | +| [Sparqlpath](Sparqlpath.md) | A string encoding a SPARQL Property Path | | [String](String.md) | A character string | | [SynonymTypeIdentifierString](SynonymTypeIdentifierString.md) | A string that represents a synonym type | | [Time](Time.md) | A time object represents a (local) time of day, independent of any particular... | diff --git a/src/oaklib/cli.py b/src/oaklib/cli.py index 810211c7d..70c8900bc 100644 --- a/src/oaklib/cli.py +++ b/src/oaklib/cli.py @@ -2230,34 +2230,26 @@ def dump(terms, output, output_type: str, config_file: str = None, **kwargs): ) def transform(terms, transform, output, output_type: str, config_file: str = None, **kwargs): """ - Transforms an ontology + Applies a defined transformation to an ontology (EXPERIMENTAL). - Example: - - runoak -i pato.obo dump -o pato.json -O json + Transformations include: - Example: - - runoak -i pato.owl dump -o pato.ttl -O turtle + - SEPTransform: implements Structured-Entities-Parts (SEP) design pattern + - EdgeFilterTransformer: filters edges based on a predicate - You can also pass in a JSON configuration file to parameterize the dump process. - - Currently this is only used for fhirjson dumps, the configuration options are specified here: - - https://incatools.github.io/ontology-access-kit/converters/obo-graph-to-fhir.html + Note that for most transformation operations, we recommend using ROBOT + and commands such as remove, filter, query. Example: - runoak -i pato.owl dump -o pato.ttl -O fhirjson -c fhir_config.json -o pato.fhir.json - - Currently each implementation only supports a subset of formats. - - The dump command is also blocked for remote endpoints such as Ubergraph, - to avoid killer queries. + runoak -i xao.obo transform -t SEPTransform -o xao.sep.obo - Python API: + Removes all P part-of Ws from XAO and replaces occurrences with triads of the form: - https://incatools.github.io/ontology-access-kit/interfaces/basic + - W subClassOf W-structure + - W subClassOf W-structure + - W-Part subClassOf W-structure + - P subClassOf W-Part """ if terms: @@ -4198,6 +4190,11 @@ def apply_taxon_constraints( "-P", multiple=True, ) +@click.option( + "--include-unused/--no-include-unused", + default=True, + show_default=True, +) @click.argument("terms", nargs=-1) def usages( terms, @@ -4235,6 +4232,10 @@ def usages( This will include usages over multiple ontologies + Using ontobee: + + runoak -i ubergraph: usages CL:0000540 + You can multiple queries over multiple sources (an AggregatorImplementation): runoak -i sqlite:obo:go -a ubergraph: -a amigo: -a quickgo: usages GO:0031969 @@ -4559,6 +4560,13 @@ def associations_counts( show_default=True, help="Include entities (e.g. genes) in the output, otherwise just the counts", ) +@click.option( + "--main-score-field", + "-S", + default="proportion_subjects_in_common", + show_default=True, + help="Score used for summarization", +) @click.argument("terms", nargs=-1) def associations_matrix( terms, @@ -4568,6 +4576,7 @@ def associations_matrix( autolabel: bool, output_type: str, output: str, + main_score_field: str, **kwargs, ): """ @@ -4579,18 +4588,36 @@ def associations_matrix( Example: - runoak -i amigo:NCBITaxon:9606 associations-matrix -p i,p GO:0042416 GO:0014046 + This results in a 2x2 matrix (shown as a long table) + As a heatmap: - runoak -i amigo:NCBITaxon:9606 associations-matrix -p i,p GO:0042416 GO:0014046 -o heatmap > /tmp/heatmap.png + runoak -i amigo:NCBITaxon:9606 associations-matrix -p i,p GO:0042416 GO:0014046 -O heatmap > /tmp/heatmap.png + + By default the heatmap will show the percentage of overlap between the two terms. To change this + to be either the percentage of the first term in the second, or the percentage of the second term in the first, + use the --main-score-field (-S) option, with "1" or "2". + + You can plug in as many terms as you like, it will perform an all-by-all + + To compare one set with another, use the "@" separator. + You can also substitute OAK expression language query terms + + runoak --stacktrace -i amigo:NCBITaxon:9606 associations-matrix -p i,p .idfile cp.txt @ .idfile ct.txt """ impl = settings.impl writer = _get_writer(output_type, impl, StreamingCsvWriter) writer.autolabel = autolabel writer.output = output + if main_score_field and isinstance(writer, HeatmapWriter): + if main_score_field == "1": + main_score_field = "proportion_entity1_subjects_in_entity2" + if main_score_field == "2": + main_score_field = "proportion_entity2_subjects_in_entity1" + writer.value_field = main_score_field actual_predicates = _process_predicates_arg(predicates) actual_association_predicates = _process_predicates_arg(association_predicates) if not isinstance(impl, AssociationProviderInterface): @@ -4613,6 +4640,7 @@ def associations_matrix( **kwargs, ) jaccards = [] + n = 0 for pair in pairs_it: # TODO: more elegant way to handle this pair.associations_for_subjects_in_common = None @@ -4621,8 +4649,10 @@ def associations_matrix( pair, label_fields=["object1", "object2"], ) - logging.info(f"Average Jaccard index: {stats.mean(jaccards)}") + n += 1 + logging.info(f"Emitted {n} pairs") writer.finish() + logging.info(f"Average Jaccard index: {stats.mean([j for j in jaccards if j is not None])}") @main.command() diff --git a/src/oaklib/datamodels/association.py b/src/oaklib/datamodels/association.py index eef50080c..595a1fe29 100644 --- a/src/oaklib/datamodels/association.py +++ b/src/oaklib/datamodels/association.py @@ -1,5 +1,5 @@ # Auto generated from association.yaml by pythongen.py version: 0.0.1 -# Generation date: 2024-03-23T16:11:34 +# Generation date: 2024-08-07T13:29:21 # Schema: association # # id: https://w3id.org/oak/association @@ -22,6 +22,7 @@ from jsonasobj2 import JsonObj, as_dict from typing import Optional, List, Union, Dict, ClassVar, Any from dataclasses import dataclass +from datetime import date, datetime from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions from linkml_runtime.utils.slot import Slot @@ -270,6 +271,8 @@ class PairwiseCoAssociation(YAMLRoot): number_subject_unique_to_entity2: Optional[int] = None subjects_in_common: Optional[Union[str, List[str]]] = empty_list() associations_for_subjects_in_common: Optional[Union[Union[dict, Association], List[Union[dict, Association]]]] = empty_list() + proportion_entity1_subjects_in_entity2: Optional[float] = None + proportion_entity2_subjects_in_entity1: Optional[float] = None def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self._is_empty(self.object1): @@ -311,6 +314,12 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): self.associations_for_subjects_in_common = [self.associations_for_subjects_in_common] if self.associations_for_subjects_in_common is not None else [] self.associations_for_subjects_in_common = [v if isinstance(v, Association) else Association(**as_dict(v)) for v in self.associations_for_subjects_in_common] + if self.proportion_entity1_subjects_in_entity2 is not None and not isinstance(self.proportion_entity1_subjects_in_entity2, float): + self.proportion_entity1_subjects_in_entity2 = float(self.proportion_entity1_subjects_in_entity2) + + if self.proportion_entity2_subjects_in_entity1 is not None and not isinstance(self.proportion_entity2_subjects_in_entity1, float): + self.proportion_entity2_subjects_in_entity1 = float(self.proportion_entity2_subjects_in_entity1) + super().__post_init__(**kwargs) @@ -619,6 +628,12 @@ class slots: slots.proportion_subjects_in_common = Slot(uri=ONTOASSOC.proportion_subjects_in_common, name="proportion_subjects_in_common", curie=ONTOASSOC.curie('proportion_subjects_in_common'), model_uri=ONTOASSOC.proportion_subjects_in_common, domain=None, range=Optional[float]) +slots.proportion_entity1_subjects_in_entity2 = Slot(uri=ONTOASSOC.proportion_entity1_subjects_in_entity2, name="proportion_entity1_subjects_in_entity2", curie=ONTOASSOC.curie('proportion_entity1_subjects_in_entity2'), + model_uri=ONTOASSOC.proportion_entity1_subjects_in_entity2, domain=None, range=Optional[float]) + +slots.proportion_entity2_subjects_in_entity1 = Slot(uri=ONTOASSOC.proportion_entity2_subjects_in_entity1, name="proportion_entity2_subjects_in_entity1", curie=ONTOASSOC.curie('proportion_entity2_subjects_in_entity1'), + model_uri=ONTOASSOC.proportion_entity2_subjects_in_entity1, domain=None, range=Optional[float]) + slots.number_subjects_in_union = Slot(uri=ONTOASSOC.number_subjects_in_union, name="number_subjects_in_union", curie=ONTOASSOC.curie('number_subjects_in_union'), model_uri=ONTOASSOC.number_subjects_in_union, domain=None, range=Optional[int]) diff --git a/src/oaklib/datamodels/association.yaml b/src/oaklib/datamodels/association.yaml index b367ad895..52a0bbd46 100644 --- a/src/oaklib/datamodels/association.yaml +++ b/src/oaklib/datamodels/association.yaml @@ -92,6 +92,8 @@ classes: - number_subject_unique_to_entity2 - subjects_in_common - associations_for_subjects_in_common + - proportion_entity1_subjects_in_entity2 + - proportion_entity2_subjects_in_entity1 ParserConfiguration: description: Settings that determine behavior when parsing associations. @@ -397,6 +399,10 @@ slots: range: integer proportion_subjects_in_common: range: float + proportion_entity1_subjects_in_entity2: + range: float + proportion_entity2_subjects_in_entity1: + range: float number_subjects_in_union: range: integer number_subject_unique_to_entity1: diff --git a/src/oaklib/implementations/amigo/amigo_implementation.py b/src/oaklib/implementations/amigo/amigo_implementation.py index af9afbc85..89ca478fb 100644 --- a/src/oaklib/implementations/amigo/amigo_implementation.py +++ b/src/oaklib/implementations/amigo/amigo_implementation.py @@ -5,14 +5,14 @@ import math from dataclasses import dataclass from time import sleep -from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple +from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Union import pysolr from oaklib.datamodels.association import Association from oaklib.datamodels.search import SearchConfiguration from oaklib.datamodels.vocabulary import IS_A, PART_OF, RDFS_LABEL -from oaklib.interfaces import SearchInterface +from oaklib.interfaces import SearchInterface, OboGraphInterface from oaklib.interfaces.association_provider_interface import ( AssociationProviderInterface, ) @@ -133,6 +133,7 @@ def _normalize(curie: CURIE) -> CURIE: @dataclass class AmiGOImplementation( AssociationProviderInterface, + OboGraphInterface, SearchInterface, UsagesInterface, SemanticSimilarityInterface, @@ -162,11 +163,18 @@ class AmiGOImplementation( _solr: pysolr.Solr = None _source: str = None + _go_adapter: OboGraphInterface = None def __post_init__(self): self._source = self.resource.slug self._solr = pysolr.Solr(AMIGO_ENDPOINT) + def go_adapter(self) -> OboGraphInterface: + if not self._go_adapter: + from oaklib import get_adapter + self._go_adapter = get_adapter("sqlite:obo:go") + return self._go_adapter + def _cache_nodes(self, nodes: List[Dict], curies: Iterable[CURIE]): for node in nodes: curie = node["id"] @@ -513,3 +521,19 @@ def information_content_scores( yield term, ic logger.info(f"Iterated {n} counts") + + # delegation + + def descendants( + self, + *args, + **kwargs, + ) -> Iterable[CURIE]: + yield from self.go_adapter().descendants(*args, **kwargs) + + def ancestors( + self, + *args, + **kwargs, + ) -> Iterable[CURIE]: + yield from self.go_adapter().ancestors(*args, **kwargs) diff --git a/src/oaklib/implementations/sparql/abstract_sparql_implementation.py b/src/oaklib/implementations/sparql/abstract_sparql_implementation.py index 743917a73..d53960734 100644 --- a/src/oaklib/implementations/sparql/abstract_sparql_implementation.py +++ b/src/oaklib/implementations/sparql/abstract_sparql_implementation.py @@ -509,17 +509,46 @@ def relationships( :param include_entailed: :return: """ - if not subjects: - subjects = list(self.entities()) - logging.info(f"Subjects: {len(subjects)}") - for subject in subjects: - for this_predicate, this_objects in self.outgoing_relationship_map(subject).items(): - if predicates and this_predicate not in predicates: - continue - for this_object in this_objects: - if objects and this_object not in objects: - continue - yield subject, this_predicate, this_object + s_uris = [self.curie_to_sparql(x) for x in subjects] if subjects else None + p_uris = [self.curie_to_sparql(x) for x in predicates] if predicates else None + o_uris = [self.curie_to_sparql(x) for x in objects] if objects else None + if not predicates or IS_A in predicates: + q = SparqlQuery( + distinct=True, + select=["?s", "?o"], + where=[ + "?s ?p ?o", + "FILTER (isIRI(?s) && isIRI(?o))", + _sparql_values("s", s_uris), + _sparql_values("p", [self.curie_to_sparql(IS_A)]), + _sparql_values("o", o_uris), + ] + ) + bindings = self._sparql_query(q) + for row in bindings: + yield self.uri_to_curie(row["s"]["value"]), IS_A, self.uri_to_curie(row["o"]["value"]) + if predicates != [IS_A]: + # existentials + q = SparqlQuery( + distinct=True, + select=["?s", "?p", "?o"], + where=[ + "?s rdfs:subClassOf [owl:onProperty ?p ; owl:someValuesFrom ?o]", + "FILTER (isIRI(?s) && isIRI(?o) && isIRI(?p))", + _sparql_values("s", s_uris), + _sparql_values("p", p_uris), + _sparql_values("o", o_uris), + ] + ) + bindings = self._sparql_query(q) + for row in bindings: + yield ( + self.uri_to_curie(row["s"]["value"]), + self.uri_to_curie(row["p"]["value"]), + self.uri_to_curie(row["o"]["value"]), + ) + + def outgoing_relationship_map(self, *args, **kwargs) -> RELATIONSHIP_MAP: return pairs_as_dict(self.outgoing_relationships(*args, **kwargs)) diff --git a/src/oaklib/interfaces/association_provider_interface.py b/src/oaklib/interfaces/association_provider_interface.py index ed86d0662..6cedab1e8 100644 --- a/src/oaklib/interfaces/association_provider_interface.py +++ b/src/oaklib/interfaces/association_provider_interface.py @@ -362,17 +362,18 @@ def association_pairwise_coassociations( """ if inputs_are_subjects: raise NotImplementedError - curies1 = list(curies1) - curies2 = list(curies2) + curies1 = set(curies1) + curies2 = set(curies2) + symmetric = curies1 == curies2 logging.info(f"Finding co-associations between {curies1} and {curies2}") assocmap = { - c: list(self.associations(objects=[c], **kwargs)) for c in set(curies1 + curies2) + c: list(self.associations(objects=[c], limit=-1, **kwargs)) for c in curies1.union(curies2) } assocmap1 = {c: assocmap[c] for c in curies1} assocmap2 = {c: assocmap[c] for c in curies2} for c1 in curies1: for c2 in curies2: - if c2 > c1 and not include_reciprocals: + if c2 > c1 and not include_reciprocals and symmetric: continue if c1 == c2 and not include_diagonal: continue @@ -380,6 +381,9 @@ def association_pairwise_coassociations( assocs2 = assocmap2[c2] elements1 = {a.subject for a in assocs1} elements2 = {a.subject for a in assocs2} + if not elements1 or not elements2: + logging.debug(f"No associations for {c1} or {c2}, so a coassociation is not meaningful") + continue common = elements1.intersection(elements2) assocs_to_common = [a for a in assocs1 + assocs2 if a.subject in common] coassoc = PairwiseCoAssociation( @@ -394,6 +398,14 @@ def association_pairwise_coassociations( coassoc.proportion_subjects_in_common = ( coassoc.number_subjects_in_common / coassoc.number_subjects_in_union ) + if elements1: + coassoc.proportion_entity1_subjects_in_entity2 = ( + coassoc.number_subjects_in_common / len(elements1) + ) + if elements2: + coassoc.proportion_entity2_subjects_in_entity1 = ( + coassoc.number_subjects_in_common / len(elements2) + ) if include_entities: coassoc.subjects_in_common = list(common) coassoc.associations_for_subjects_in_common = assocs_to_common diff --git a/src/oaklib/interfaces/usages_interface.py b/src/oaklib/interfaces/usages_interface.py index d6e704868..192107b8e 100644 --- a/src/oaklib/interfaces/usages_interface.py +++ b/src/oaklib/interfaces/usages_interface.py @@ -30,6 +30,7 @@ class UsageContext(str, Enum): ASSOCIATION_OBJECT = "association_object" MAPPING_SUBJECT = "mapping_subject" MAPPING_OBJECT = "mapping_object" + MULTIPLE = "multiple" class Usage(BaseModel): @@ -41,7 +42,9 @@ class Usage(BaseModel): used_by_id: str predicate: Optional[str] = None source: str + dataset: Optional[str] = None context: UsageContext + axiom: Optional[str] = None description: Optional[str] = None @@ -55,17 +58,22 @@ def usages( curies: List[CURIE], used_by: Optional[List[CURIE]] = None, used_by_prefixes: Optional[List[str]] = None, + include_unused: bool = False, **kwargs, ) -> Iterable[Usage]: """ Get usages of a term :param curies: + :param used_by: + :param used_by_prefixes: + :param include_unused: :param kwargs: :return: """ logger.info(f"Getting usages for {curies}, prefixes={used_by_prefixes}") + used_curies = set() if used_by or used_by_prefixes: for usage in self.usages(curies, **kwargs): ok = True @@ -79,6 +87,7 @@ def usages( logger.debug(f"Skipping {usage} as not in used_by") if ok: yield usage + used_curies.add(usage.used_id) return def _source_id(): @@ -93,6 +102,7 @@ def _source_id(): source=_source_id(), context=UsageContext.RELATIONSHIP_SUBJECT, ) + used_curies.add(s) logger.info(f"Checking relationships objects for {len(curies)} curies") for s, p, o in self.relationships(objects=curies): yield Usage( @@ -102,6 +112,7 @@ def _source_id(): source=_source_id(), context=UsageContext.RELATIONSHIP_OBJECT, ) + used_curies.add(o) logger.info(f"Checking relationships predicates for {len(curies)} curies") for _s, p, o in self.relationships(predicates=curies): # TODO: used_by is a relationship @@ -112,6 +123,7 @@ def _source_id(): source=_source_id(), context=UsageContext.RELATIONSHIP_PREDICATE, ) + used_curies.add(p) logger.info(f"Checking logical definitions for {len(curies)} curies") if isinstance(self, OboGraphInterface): for ldef in self.logical_definitions(objects=curies): @@ -124,6 +136,7 @@ def _source_id(): source=_source_id(), context=UsageContext.LOGICAL_DEFINITION_GENUS, ) + used_curies.add(ldef.definedClassId) for r in ldef.restrictions: if r.propertyId in curies: yield Usage( @@ -133,6 +146,7 @@ def _source_id(): source=_source_id(), context=UsageContext.LOGICAL_DEFINITION_PREDICATE, ) + used_curies.add(ldef.definedClassId) if r.fillerId in curies: yield Usage( used_id=ldef.definedClassId, @@ -141,6 +155,7 @@ def _source_id(): source=_source_id(), context=UsageContext.LOGICAL_DEFINITION_FILLER, ) + used_curies.add(ldef.definedClassId) logger.info(f"Checking associations for {len(curies)} curies") if isinstance(self, AssociationProviderInterface): for a in self.associations(objects=curies, object_closure_predicates=[]): @@ -151,6 +166,7 @@ def _source_id(): source=_source_id(), context=UsageContext.ASSOCIATION_OBJECT, ) + used_curies.add(a.subject) logger.info(f"Checking mappings for {len(curies)} curies") if isinstance(self, MappingProviderInterface): for m in self.sssom_mappings(curies): @@ -162,6 +178,7 @@ def _source_id(): source=_source_id(), context=UsageContext.MAPPING_SUBJECT, ) + used_curies.add(m.subject_id) elif m.object_id in curies: yield Usage( used_id=m.object_id, @@ -170,5 +187,11 @@ def _source_id(): source=_source_id(), context=UsageContext.MAPPING_OBJECT, ) + used_curies.add(m.object_id) else: raise AssertionError(f"Mapping {m} not in curies {curies}") + if include_unused: + for c in curies: + if c not in used_curies: + yield Usage(used_id=c, used_by_id="None", source=_source_id(), context=UsageContext.MULTIPLE) + diff --git a/src/oaklib/io/heatmap_writer.py b/src/oaklib/io/heatmap_writer.py index ea703c9f1..dd6d8940a 100644 --- a/src/oaklib/io/heatmap_writer.py +++ b/src/oaklib/io/heatmap_writer.py @@ -1,5 +1,5 @@ from dataclasses import dataclass, field -from typing import Dict, List, Union +from typing import Dict, List, Union, Optional from linkml_runtime.utils.yamlutils import YAMLRoot @@ -27,13 +27,14 @@ class HeatmapWriter(StreamingWriter): """ items: List[Dict] = field(default_factory=lambda: []) - value_field: str = field(default_factory=lambda: "phenodigm_score") + value_field: Optional[str] = None def emit(self, obj: Union[YAMLRoot, dict], label_fields=None): if isinstance(obj, TermPairwiseSimilarity): t1 = obj.subject_id + f" {obj.subject_label}" if obj.subject_label else "" t2 = obj.object_id + f" {obj.object_label}" if obj.object_label else "" - v = getattr(obj, self.value_field) + value_field = self.value_field or "phenodigm_score" + v = getattr(obj, value_field) self.items.append({"term1": t1, "term2": t2, "score": v}) if isinstance(obj, PairwiseCoAssociation): if label_fields and self.autolabel: @@ -42,16 +43,33 @@ def emit(self, obj: Union[YAMLRoot, dict], label_fields=None): else: t1 = obj.object1 t2 = obj.object2 - v = obj.proportion_subjects_in_common + value_field = self.value_field or "proportion_subjects_in_common" + v = getattr(obj, value_field) self.items.append({"term1": t1, "term2": t2, "score": v}) else: raise ValueError(f"Cannot handle: {obj}") def finish(self): import pandas - import seaborn + import seaborn as sns + import matplotlib.pyplot as plt df = pandas.DataFrame(self.items) df = df.pivot(index="term1", columns="term2", values="score") - ax = seaborn.heatmap(df, annot=True, fmt=".2f") + # mask = df != 0 + plt.figure(figsize=(24, 20)) # Adjust the dimensions as needed + value_field = self.value_field or "proportion_subjects_in_common" + plt.title(f"Heatmap of {value_field}") + # ax = sns.heatmap(df, annot=mask, fmt=".2f", mask=~mask) # Annotates only non-zero cells + ax = sns.heatmap(df, annot=True, fmt=".2f") + # Rotate x and y labels if necessary + plt.xticks(rotation=45, ha='right') # Rotate term2 labels for better fit + plt.yticks(rotation=0) # Keep term1 labels horizontal + # Adjust font size of the labels + ax.tick_params(axis='both', which='major', labelsize=24) + + # Manually set x-axis labels to ensure correct alignment + ax.set_xticklabels(ax.get_xticklabels(), rotation=45, horizontalalignment='right') + ax.get_figure().savefig(self.output, bbox_inches="tight") + # plt.savefig(self.output, bbox_inches="tight") diff --git a/src/oaklib/io/streaming_writer.py b/src/oaklib/io/streaming_writer.py index 1d142b73e..21a1eab8c 100644 --- a/src/oaklib/io/streaming_writer.py +++ b/src/oaklib/io/streaming_writer.py @@ -1,6 +1,7 @@ import atexit import logging import sys +from copy import copy from dataclasses import dataclass, field from typing import Any, ClassVar, Dict, Iterable, List, Mapping, Optional, Type, Union @@ -149,12 +150,9 @@ def _label(c: CURIE) -> str: label = self.ontology_interface.label( curie, lang=self.settings.preferred_language ) - obj_as_dict_new = {} - for k, v in obj_as_dict.items(): - obj_as_dict_new[k] = v + for k, v in copy(obj_as_dict).items(): if k == f: - obj_as_dict_new[col_name] = label - obj_as_dict = obj_as_dict_new + obj_as_dict[col_name] = label return obj_as_dict def emit_dict(self, obj: Mapping[str, Any], object_type: Type = None):