Subsetting

A query language for constructing subsets.

Retrieve all diseases from the Unified Medical Language System (UMLS) by combining several branches identified by their UMLS Semantic Types Ontology (STY) identifiers:

from curies.subsetting import Union, Descendants, Subsetter

expression = Union.from_args(
    Descendants(reference="sty:T049", source="umls"),  # cell or molecular dysfunction
    Descendants(reference="sty:T047", source="umls"),  # disease or syndrome
    Descendants(reference="sty:T191", source="umls"),  # neoplastic process
    Descendants(reference="sty:T050", source="umls"),  # experimental model of disease
    Descendants(reference="sty:T048", source="umls"),  # mental or behavioral dysfunction
)

# The curies package doesn't implement a concrete evaluation
# protocol for expressions, but gives an abstract class, e.g.,
# that PyOBO implements
subsetter: Subsetter = ...
references: set[Reference] = subsetter.query(expression)

Retrieve all anatomical terms from the A branch in the Medical Subject Headings (MeSH), while skipping the A11 branch, which corresponds to cell types:

from curies.subsetting import Descendants, Subsetter

expression = Descendants(reference="obo:mesh#A", source="mesh") - Descendants(
    reference="obo:mesh#A11", source="mesh"
)

# The curies package doesn't implement a concrete evaluation
# protocol for expressions, but gives an abstract class, e.g.,
# that PyOBO implements
subsetter: Subsetter = ...
references: set[Reference] = subsetter.query(expression)

Classes

Descendants(*[, type, inclusive, source])

An expression for the descendants from a given entity.

Difference(*[, type])

The difference of two expressions.

Expression(*, type)

An expression for subsetting.

GraphSubsetter(graphs)

An implementation for hydrating an expression.

Intersection(*[, type])

The intersection of two or more expressions.

Subsetter()

An implementation for hydrating an expression.

Union(*[, type])

The union of two or more expressions.