bionty.dev.BioRegistry#

class bionty.dev.BioRegistry(*args, **kwargs)#

Bases: Registry, HasParents, CanValidate

Base Registry of bionty.

BioRegistry inherits all methods from Registry and provides additional methods including public() and from_public().

Notes

For more info, see tutorials:

Fields

Methods

classmethod from_public(**kwargs)#

Create a record or records from public reference based on a single field value.

Return type:

Union[BioRegistry, List[BioRegistry], None]

Notes

For more info, see tutorial bionty

Bulk create protein records via from_values.

Examples

Create a record by passing a field value:

>>> record = bionty.Gene.from_public(symbol="TCF7", organism="human")

Create a record from non-default source:

>>> public_source = bionty.PublicSource.filter(entity="CellType", source="cl", version="2022-08-16").one()  # noqa
>>> record = bionty.CellType.from_public(name="T cell", public_source=public_source)
classmethod public(organism=None, public_source=None, **kwargs)#

The corresponding PublicOntology object.

Note that the public source is auto-configured and tracked via bionty.PublicSource(). :rtype: PublicOntology

See also

PublicOntology

Examples

>>> celltype_pub = bionty.CellType.public()
>>> celltype_pub
PublicOntology
Entity: CellType
Organism: all
Source: cl, 2023-04-20
#terms: 2698
...
📖 .df(): ontology reference table
🔎 .lookup(): autocompletion of terms
🎯 .search(): free text search of terms
🧐 .inspect(): check if identifiers are mappable
👽 .standardize(): map synonyms to standardized names
🔗 .to_pronto(): Pronto.Ontology object
save(parents=None, *args, **kwargs)#

Save the record and its parents recursively.

Parameters:

parents (Optional[bool], default: None) – bool = True. Whether to save parents records.

Return type:

None