Usage

sssom_pydantic.api Module

This is a placeholder for putting the main code for your module.

Functions

hash_mapping(mapping, converter)

Hash the entire SSSOM semantic mapping record.

hash_mapping_to_reference(mapping, converter)

Hash a mapping into a reference.

hash_triple(mapping, converter)

Return a triples sameness identifier.

hash_triple_to_reference(mapping, converter)

Return a mapping sameness identifier as a reference.

standardize_mappings(mappings, *[, converter])

Standardize mappings against the Bioregistry.

Classes

ExtensionDefinition(*, slot_name[, ...])

A processed extension definition.

ExtensionDefinitionRecord(*, slot_name[, ...])

An extension definition that can be readily dumped to SSSOM.

MappingSet(*, id[, confidence, description, ...])

A processed representation of a mapping set.

MappingSetRecord(*[, curie_map, ...])

Represents a mapping set, readily serializable for usage in SSSOM TSV.

MappingTool(*[, reference, name, version])

Represents metadata about a mapping tool.

SemanticMapping(*, subject, predicate, ...)

Represents most fields for SSSOM.

Class Inheritance Diagram

digraph inheritancec5334dff0f { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Helper class that provides a standard way to create an ABC using"]; "BaseModel" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="!!! abstract \"Usage Documentation\""]; "ExtensionDefinition" [URL="api/sssom_pydantic.api.ExtensionDefinition.html#sssom_pydantic.api.ExtensionDefinition",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A processed extension definition."]; "BaseModel" -> "ExtensionDefinition" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ExtensionDefinitionRecord" [URL="api/sssom_pydantic.api.ExtensionDefinitionRecord.html#sssom_pydantic.api.ExtensionDefinitionRecord",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An extension definition that can be readily dumped to SSSOM."]; "BaseModel" -> "ExtensionDefinitionRecord" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MappingSet" [URL="api/sssom_pydantic.api.MappingSet.html#sssom_pydantic.api.MappingSet",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A processed representation of a mapping set."]; "BaseModel" -> "MappingSet" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MappingSetRecord" [URL="api/sssom_pydantic.api.MappingSetRecord.html#sssom_pydantic.api.MappingSetRecord",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents a mapping set, readily serializable for usage in SSSOM TSV."]; "BaseModel" -> "MappingSetRecord" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MappingTool" [URL="api/sssom_pydantic.api.MappingTool.html#sssom_pydantic.api.MappingTool",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents metadata about a mapping tool."]; "BaseModel" -> "MappingTool" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SemanticMapping" [URL="api/sssom_pydantic.api.SemanticMapping.html#sssom_pydantic.api.SemanticMapping",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents most fields for SSSOM."]; "Triple" -> "SemanticMapping" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SemanticallyStandardizable" -> "SemanticMapping" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SemanticallyStandardizable" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="An object that can be standardized."]; "ABC" -> "SemanticallyStandardizable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Triple" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A Pydantic model for a subject-predicate-object triple."]; "BaseModel" -> "Triple" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

sssom_pydantic.io Module

I/O operations for SSSOM.

Functions

append(mappings, path, *[, metadata, ...])

Append processed records.

append_unprocessed(records, path, *[, ...])

Append records to the end of an existing file.

format(path, *[, metadata_path, metadata, ...])

Lint a file.

lint(*args, **kwargs)

Run the formatter.

read(...)

Read and process SSSOM from TSV.

read_iterable(path_or_url, *[, ...])

Read and process SSSOM from TSV in an iterable way.

read_unprocessed(path_or_url, *[, ...])

Read SSSOM TSV into unprocessed records.

record_to_semantic_mapping(record, converter, *)

Parse a record into a mapping.

row_to_record(row, *[, propagatable])

Parse a row from a SSSOM TSV file, unprocessed.

row_to_semantic_mapping(row, converter, *[, ...])

Get a semantic mapping from a row.

to_dataframe(mappings)

Construct a pandas dataframe that represents the SSSOM TSV format.

write(mappings, path, *[, metadata, ...])

Write semantic mappings as SSSOM TSV.

write_metadata(metadata, file)

Write SSSOM metadata for the top of a TSV.

write_unprocessed(records, path, *[, ...])

Write unprocessed records.

Classes

CachedSemanticMappings(path, *[, force, cache])

Make a function lazily cache SSSOM.

ParseError(line_number, exception, stage)

An error during SSSOM parsing and processing that causes a row to be unrecoverable.

SemanticMappingPack(mappings, converter, ...)

The results of reading and processing a SSSOM TSV file.

Class Inheritance Diagram

digraph inheritancededc68d0da { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Helper class that provides a standard way to create an ABC using"]; "Cached" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Caching decorator."]; "Generic" -> "Cached" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "Cached" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CachedSemanticMappings" [URL="api/sssom_pydantic.io.CachedSemanticMappings.html#sssom_pydantic.io.CachedSemanticMappings",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Make a function lazily cache SSSOM."]; "Cached" -> "CachedSemanticMappings" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" [URL="https://docs.python.org/3/library/typing.html#typing.Generic",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for generic types."]; "ParseError" [URL="api/sssom_pydantic.io.ParseError.html#sssom_pydantic.io.ParseError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An error during SSSOM parsing and processing that causes a row to be unrecoverable."]; "SemanticMappingPack" [URL="api/sssom_pydantic.io.SemanticMappingPack.html#sssom_pydantic.io.SemanticMappingPack",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The results of reading and processing a SSSOM TSV file."]; }

sssom_pydantic.models Module

Models for SSSOM.

Classes

ExpandedRecord(*[, record_id, ...])

Represents an SSSOM record (i.e., a row in a SSSOM TSV file) expanded with URIs.

Record(*[, record_id, subject_label, ...])

Represents an SSSOM record (i.e., a row in a SSSOM TSV file).

Class Inheritance Diagram

digraph inheritance6e24279fca { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BaseModel" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="!!! abstract \"Usage Documentation\""]; "ExpandedRecord" [URL="api/sssom_pydantic.models.ExpandedRecord.html#sssom_pydantic.models.ExpandedRecord",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents an SSSOM record (i.e., a row in a SSSOM TSV file) expanded with URIs."]; "BaseModel" -> "ExpandedRecord" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Record" [URL="api/sssom_pydantic.models.Record.html#sssom_pydantic.models.Record",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents an SSSOM record (i.e., a row in a SSSOM TSV file)."]; "BaseModel" -> "Record" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

sssom_pydantic.process Module

Utilities for working with semantic mappings.

Functions

curate(mapping, /, authors, mark[, ...])

Curate a mapping.

estimate_confidence(mappings, *[, ...])

Estimate the confidence of a subject-predicate-triple based on multiple evidences.

exclude_negative(mappings)

Exclude negative mappings.

exclude_unsure(mappings)

Exclude usunre mappings.

filter_by_confidence(mappings, cutoff)

Filter by confidence.

get_canonical_tuple(mapping)

Get the canonical tuple from a mapping entry.

invert(mapping, *, converter[, ...])

Invert a mapping.

invert_broad_matches(mappings, *, converter)

Invert broad matches into narrow matches.

invert_by_object_prefix(mappings, ...[, ...])

Invert mappings with the given object prefix.

invert_by_prefix_pair(mappings, ...[, ...])

Invert mappings with the given subject and object (SO) prefixes.

invert_by_subject_prefix(mappings, ...[, ...])

Invert mappings with the given subject prefix.

invert_narrow_matches(mappings, *, converter)

Invert narrow matches into broad matches.

merge_manual_curations(mappings, *, converter)

Merge manually curated mappings.

publish(mapping, /, *[, exists_action, date])

Add a publication date to the mapping.

remove_redundant_external(mappings, *others)

Remove mappings with same S/O pairs in other given mappings.

remove_redundant_internal(mappings, *[, ...])

Remove redundant mappings.

review(mapping, reviewers, *[, score, date, ...])

Review a mapping and produce a new record.

Classes

InvalidExistsActionError(value)

An error for an invalid exists action.

Class Inheritance Diagram

digraph inheritance1194b8ffc3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "InvalidExistsActionError" [URL="api/sssom_pydantic.process.InvalidExistsActionError.html#sssom_pydantic.process.InvalidExistsActionError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An error for an invalid exists action."]; }

sssom_pydantic.query Module

Tools for filtering mappings.

Functions

count_entities(mappings)

Count appearances of subjects and objects.

count_prefix_pairs(mappings)

Count subject/object prefix pairs.

count_unique_entities(mappings)

Count the number of unique entities appearing in the subjects and objects of mappings.

filter_mappings(mappings, query, *[, ...])

Filter mappings based on a query.

get_mappings(mappings[, query, limit, ...])

Get a sequence of mappings.

paginate_mappings(mappings, *[, sort, ...])

Paginate mappings with sort, offset, and limit operations.

sort_mappings(mappings, sort)

Sort mappings.

Classes

Query(*[, triple_id, query, subject_query, ...])

A query over semantic mappings.

Class Inheritance Diagram

digraph inheritance123793d5e2 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BaseModel" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="!!! abstract \"Usage Documentation\""]; "Query" [URL="api/sssom_pydantic.query.Query.html#sssom_pydantic.query.Query",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A query over semantic mappings."]; "BaseModel" -> "Query" [arrowsize=0.5,style="setlinewidth(0.5)"]; }