bionty.core.BioRegistry¶
- class bionty.core.BioRegistry(*args, **kwargs)¶
Bases:
Registry
,HasParents
,CanValidate
Base Registry of bionty.
BioRegistry inherits all methods from
Registry
and provides additional methods includingpublic()
andfrom_public()
.Notes
For more info, see tutorials:
Fields
Methods
- classmethod from_public(*, mute=False, **kwargs)¶
Create a record or records from public reference based on a single field value.
- Return type:
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
Examples
>>> celltype_pub = bionty.CellType.public() >>> celltype_pub PublicOntology Entity: CellType Organism: all Source: cl, 2023-04-20 #terms: 2698
- save(parents=None, *args, **kwargs)¶
Save the record and its parents recursively.
- Parameters:
parents (
bool
|None
, default:None
) –bool = True
. Whether to save parents records.- Return type:
None
- classmethod sources(currently_used=None)¶
Default public source for the registry.
- Parameters:
currently_used (
bool
|None
, default:None
) – Only returns currently used sources- Return type:
Examples
>>> bionty.Gene.sources() >>> bionty.Gene.sources(currently_used=True)