Registry {laminr} | R Documentation |
Registry
Description
A registry in a module.
Active bindings
module
(Module)
The instance the registry belongs to.name
(
character(1)
)
The API for the instance.class_name
(
character(1)
)
The class name for the registry.is_link_table
(
logical(1)
)
Whether the registry is a link table.
Methods
Public methods
Method new()
Creates an instance of this R6 class. This class should not be instantiated directly,
but rather by connecting to a LaminDB instance using the connect()
function.
Usage
Registry$new(instance, module, api, registry_name, registry_schema)
Arguments
instance
The instance the registry belongs to.
module
The module the registry belongs to.
api
The API for the instance.
registry_name
The name of the registry.
registry_schema
The schema for the registry.
Method get()
Get a record by ID or UID.
Usage
Registry$get(id_or_uid, include_foreign_keys = FALSE, verbose = FALSE)
Arguments
id_or_uid
The ID or UID of the record.
include_foreign_keys
Logical, whether to include foreign keys in the record.
verbose
Logical, whether to print verbose output.
Returns
A Record object.
Method df()
Get a data frame summarising records in the registry
Usage
Registry$df(limit = 100, verbose = FALSE)
Arguments
limit
Maximum number of records to return
verbose
Boolean, whether to print progress messages
Returns
A data.frame containing the available records
Method from_df()
Create a record from a data frame
Usage
Registry$from_df(dataframe, key = NULL, description = NULL, run = NULL)
Arguments
dataframe
The
data.frame
to create a record fromkey
A relative path within the default storage
description
A string describing the record
run
A
Run
object that creates the record
Details
Creating records is only possible for the default instance, requires the
Python lamindb
module and is only implemented for the core Artifact
registry.
Returns
A TemporaryRecord
object containing the new record. This is not
saved to the database until temp_record$save()
is called.
Method from_path()
Create a record from a path
Usage
Registry$from_path(path, key = NULL, description = NULL, run = NULL)
Arguments
path
Path to create a record from
key
A relative path within the default storage
description
A string describing the record
run
A
Run
object that creates the record
Details
Creating records is only possible for the default instance, requires the
Python lamindb
module and is only implemented for the core Artifact
registry.
Returns
A TemporaryRecord
object containing the new record. This is not
saved to the database until temp_record$save()
is called.
Method from_anndata()
Create a record from an AnnData
Usage
Registry$from_anndata(adata, key = NULL, description = NULL, run = NULL)
Arguments
adata
The anndata::AnnData object to create a record from
key
A relative path within the default storage
description
A string describing the record
run
A
Run
object that creates the record
Details
Creating records is only possible for the default instance, requires the
Python lamindb
module and is only implemented for the core Artifact
registry.
Returns
A TemporaryRecord
object containing the new record. This is not
saved to the database until temp_record$save()
is called.
Method get_fields()
Get the fields in the registry.
Usage
Registry$get_fields()
Returns
A list of Field objects.
Method get_field()
Get a field by name.
Usage
Registry$get_field(field_name)
Arguments
field_name
The name of the field.
Returns
A Field object.
Method get_field_names()
Get the field names in the registry.
Usage
Registry$get_field_names()
Returns
A character vector of field names.
Method get_record_class()
Get the record class for the registry.
Note: This method is intended for internal use only and may be removed in the future.
Usage
Registry$get_record_class()
Returns
A Record class.
Method get_temporary_record_class()
Get the temporary record class for the registry.
Note: This method is intended for internal use only and may be removed in the future.
Usage
Registry$get_temporary_record_class()
Returns
A TemporaryRecord
class.
Method print()
Print a Registry
Usage
Registry$print(style = TRUE)
Arguments
style
Logical, whether the output is styled using ANSI codes
Returns
A character vector
Method to_string()
Create a string representation of a Registry
Usage
Registry$to_string(style = FALSE)
Arguments
style
Logical, whether the output is styled using ANSI codes
Returns
A cli::cli_ansi_string
if style = TRUE
or a character vector