Title: | Client for 'LaminDB' |
---|---|
Description: | Interact with 'LaminDB'. 'LaminDB' is an open-source data framework for biology. This package allows you to query and download data from 'LaminDB' instances. |
Authors: | Robrecht Cannoodt [aut, cre] |
Maintainer: | Robrecht Cannoodt <[email protected]> |
License: | Apache License (>= 2) |
Version: | 1.0.0 |
Built: | 2025-03-10 17:20:09 UTC |
Source: | https://github.com/laminlabs/laminr |
Get the currently connected LaminDB instance
get_current_lamin_instance()
get_current_lamin_instance()
This is done via a system call to lamin settings
to avoid importing Python
lamindb
The slug of the current LaminDB instance, or NULL
invisibly if no
instance is found
Get the currently logged in LaminDB user
get_current_lamin_user()
get_current_lamin_user()
This is done via a system call to lamin settings
to avoid importing Python
lamindb
The handle of the current LaminDB user, or NULL
invisibly if no
user is found
This function can be used to import LaminDB Python modules with additional checks and nicer error messages.
import_module(module)
import_module(module)
module |
The name of the Python module to import |
An object representing a Python package
## Not run: # Import lamindb to start interacting with an instance ln <- import_module("lamindb") # Import other LaminDB modules bt <- import_module("bionty") wl <- import_module("wetlab") cc <- import_module("clincore") # Import any Python module np <- import_module("numpy") ## End(Not run)
## Not run: # Import lamindb to start interacting with an instance ln <- import_module("lamindb") # Import other LaminDB modules bt <- import_module("bionty") wl <- import_module("wetlab") cc <- import_module("clincore") # Import any Python module np <- import_module("numpy") ## End(Not run)
Create a Python environment containing lamindb or install lamindb into an existing environment.
install_lamindb( ..., envname = "r-lamindb", extra_packages = NULL, new_env = identical(envname, "r-lamindb"), use = TRUE )
install_lamindb( ..., envname = "r-lamindb", extra_packages = NULL, new_env = identical(envname, "r-lamindb"), use = TRUE )
... |
Additional arguments passed to |
envname |
String giving the name of the environment to install packages into |
extra_packages |
A vector giving the names of additional Python packages to install |
new_env |
Whether to remove any existing |
use |
Whether to attempt use the new environment |
See vignette("setup", package = "laminr")
for further details on setting up
a Python environment
NULL
, invisibly
## Not run: install_lamindb() # Add additional packages to the environment install_lamindb(extra_packages = c("bionty", "wetlab")) # Install into a different environment install_lamindb(envvname = "your-env") ## End(Not run)
## Not run: install_lamindb() # Add additional packages to the environment install_lamindb(extra_packages = c("bionty", "wetlab")) # Install into a different environment install_lamindb(envvname = "your-env") ## End(Not run)
Connect to a LaminDB instance by calling lamin connect
on the command line
lamin_connect(instance)
lamin_connect(instance)
instance |
Either a slug giving the instance to connect to
( |
Running this will set the LaminDB auto-connect option to True
so you
auto-connect to instance
when importing Python lamindb
.
## Not run: lamin_connect("laminlabs/cellxgene") ## End(Not run)
## Not run: lamin_connect("laminlabs/cellxgene") ## End(Not run)
Delete a LaminDB entity. Currently only supports instances.
lamin_delete(instance, force = FALSE)
lamin_delete(instance, force = FALSE)
instance |
Identifier for the instance to delete (e.g. "owner/name") |
force |
Whether to force deletion without asking for confirmation |
## Not run: lamin_init("to-delete") lamin_delete("to-delete") ## End(Not run)
## Not run: lamin_init("to-delete") lamin_delete("to-delete") ## End(Not run)
Disconnect from the current LaminDB instance by calling lamin connect
on
the command line
lamin_disconnect()
lamin_disconnect()
## Not run: lamin_disconnect() ## End(Not run)
## Not run: lamin_disconnect() ## End(Not run)
Initialise a new LaminDB instance
lamin_init(storage, name = NULL, db = NULL, modules = NULL) lamin_init_temp( name = "laminr-temp", db = NULL, modules = NULL, add_timestamp = TRUE, envir = parent.frame() )
lamin_init(storage, name = NULL, db = NULL, modules = NULL) lamin_init_temp( name = "laminr-temp", db = NULL, modules = NULL, add_timestamp = TRUE, envir = parent.frame() )
storage |
A local directory, AWS S3 bucket or Google Cloud Storage bucket |
name |
A name for the instance |
db |
A Postgres database connection URL, use |
modules |
A vector of modules to include (e.g. "bionty") |
add_timestamp |
Whether to append a timestamp to |
envir |
An environment passed to |
For lamin_init_temp()
, a time stamp is appended to name
(if
add_timestamp = TRUE
) and then a new instance is initialised with
lamin_init()
using a temporary directory. A lamin_delete()
call is
registered as an exit handler with withr::defer()
to clean up the instance
when envir
finishes.
The lamin_init_temp()
function is mostly for internal use and in most cases
users will want lamin_init()
.
## Not run: lamin_init("mydata", modules = c("bionty", "wetlab")) ## End(Not run)
## Not run: lamin_init("mydata", modules = c("bionty", "wetlab")) ## End(Not run)
Log in as a LaminDB user
lamin_login(user = NULL, api_key = NULL)
lamin_login(user = NULL, api_key = NULL)
user |
Handle for the user to login as |
api_key |
API key for a user |
Depending on the input, one of these commands will be run (in this order):
If user
is set then lamin login <user>
Else if api_key
is set then set the LAMIN_API_KEY
environment variable
temporarily with withr::with_envvar()
and run lamin login
Else if there is a stored user handle run lamin login <handle>
Else if the LAMIN_API_KEY
environment variable is set run lamin login
Otherwise, exit with an error
Save a file or folder to a LaminDB instance by calling lamin save
on the
command line
lamin_save(filepath, key = NULL, description = NULL, registry = NULL)
lamin_save(filepath, key = NULL, description = NULL, registry = NULL)
filepath |
Path to the file or folder to save |
key |
The key for the saved item |
description |
The description for the saved item |
registry |
The registry for the saved item |
See lamin save --help
for details of what database entries are created for
different file types
## Not run: my_file <- tempfile() lamin_save(my_file) ## End(Not run)
## Not run: my_file <- tempfile() lamin_save(my_file) ## End(Not run)