This package allows you to query and download data from LaminDB instances.
Install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("laminlabs/laminr")
You will also need to install lamindb
:
pip install lamindb[aws]
To connect to a LaminDB instance, you will first need to run
lamin login
OR lamin load <instance>
in the terminal. This will
create a directory in your home directory called .lamin
with the
necessary credentials.
lamin login
lamin connect laminlabs/cellxgene
Then, you can connect to the instance using the laminr::connect()
function:
library(laminr)
db <- connect("laminlabs/cellxgene")
db
cellxgene
Core registries
$Run
$User
$Param
$ULabel
$Feature
$Storage
$Artifact
$Transform
$Collection
$FeatureSet
$ParamValue
$FeatureValue
Core link tables
runparamvalue
artifactulabel
collectionulabel
featuresetfeature
artifactfeatureset
artifactparamvalue
collectionartifact
artifactfeaturevalue
Additional modules
bionty
You can use the db
object to query the instance:
artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu")
You can print the record:
artifact
Artifact(uid='KBW89Mf7IGcekja2hADu', description='Myeloid compartment', key='cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad', storage_id=2, _accessor='AnnData', version='2024-07-01', id=3659, size=691757462, transform_id=22, is_latest=TRUE, type='dataset', n_observations=51552, created_by_id=1, _hash_type='md5-n', created_at='2024-07-12T12:34:10.345829+00:00', suffix='.h5ad', updated_at='2024-07-12T12:40:48.837026+00:00', _key_is_virtual=FALSE, visibility=1, run_id=27, hash='SZ5tB0T4YKfiUuUkAL09ZA')
Or call the $describe()
method to get a summary:
artifact$describe()
Artifact(uid='KBW89Mf7IGcekja2hADu', description='Myeloid compartment', key='cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad', storage_id=2, _accessor='AnnData', version='2024-07-01', id=3659, size=691757462, transform_id=22, is_latest=TRUE, type='dataset', n_observations=51552, created_by_id=1, _hash_type='md5-n', created_at='2024-07-12T12:34:10.345829+00:00', suffix='.h5ad', updated_at='2024-07-12T12:40:48.837026+00:00', _key_is_virtual=FALSE, visibility=1, run_id=27, hash='SZ5tB0T4YKfiUuUkAL09ZA')
Provenance
$storage = 's3://cellxgene-data-public'
$transform = 'Census release 2024-07-01 (LTS)'
$run = '2024-07-16T12:49:41.81955+00:00'
$created_by = 'sunnyosun'
You can access its fields as follows:
artifact$id
: 3659artifact$uid
: KBW89Mf7IGcekja2hADuartifact$key
:
cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5adYou can also fetch related fields:
artifact$root
: s3://cellxgene-data-publicartifact$created_by
: sunnyosunYou can directly load the artifact to access its data:
artifact$load()
ℹ 's3://cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad' already exists at '/home/rcannood/.cache/lamindb/cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad'
AnnData object with n_obs × n_vars = 51552 × 36398
obs: 'donor_id', 'Predicted_labels_CellTypist', 'Majority_voting_CellTypist', 'Manually_curated_celltype', 'assay_ontology_term_id', 'cell_type_ontology_term_id', 'development_stage_ontology_term_id', 'disease_ontology_term_id', 'self_reported_ethnicity_ontology_term_id', 'is_primary_data', 'organism_ontology_term_id', 'sex_ontology_term_id', 'tissue_ontology_term_id', 'suspension_type', 'tissue_type', 'cell_type', 'assay', 'disease', 'organism', 'sex', 'tissue', 'self_reported_ethnicity', 'development_stage', 'observation_joinid'
var: 'gene_symbols', 'feature_is_filtered', 'feature_name', 'feature_reference', 'feature_biotype', 'feature_length'
uns: 'cell_type_ontology_term_id_colors', 'citation', 'default_embedding', 'schema_reference', 'schema_version', 'sex_ontology_term_id_colors', 'title'
obsm: 'X_umap'