This package provides an interface to the LaminDB database. It allows you to query the database and download data from it.
You can install the development version from GitHub with:
# install.packages("remotes")
remotes::install_github("laminlabs/laminr")
For this package to work, we first need to run the following commands in the terminal:
pip install lamindb
lamin load laminlabs/cellxgene
This should create an .env
file at ~/.lamin/current_instance.env
and
~/.lamin/instance--laminlabs--cellxgene.env
containing (amongst
others) the following data:
lamindb_instance_id=0123456789abcdefghijklmnopqrstuv
lamindb_instance_owner=laminlabs
lamindb_instance_name=cellxgene
lamindb_instance_schema_id=0123456789abcdefghijklmnopqrstuv
lamindb_instance_api_url=https://us-west-2.api.lamin.ai
Note
The .env
files don’t store the schema_id
and api_url
yet, so
instead we pass these settings via
options(lamindb_current_instance = ...)
(see below).
library(laminr)
options(
lamindb_current_instance = list(
owner = "lamin",
name = "example",
id = "0123456789abcdefghijklmnopqrstuv",
api_url = "https://us-west-2.api.lamin.ai",
schema_id = "0123456789abcdefghijklmnopqrstuv"
)
)
db <- laminr::connect()
db
Instance 'lamin/cellxgene'
core classes:
Run
User
Param
ULabel
Feature
Storage
Artifact
Transform
Collection
FeatureSet
ParamValue
FeatureValue
bionty classes:
Gene
Source
Tissue
Disease
Pathway
Protein
CellLine
CellType
Organism
Ethnicity
Phenotype
CellMarker
DevelopmentalStage
ExperimentalFactor
artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu")
artifact
Artifact(updated_at = '2024-07-12T12:40:48.837026+00:00', run_id = '27', suffix = '.h5ad', visibility = '1', _key_is_virtual = 'FALSE', n_objects = 'KBW89Mf7IGcekja2hADu', uid = 'SZ5tB0T4YKfiUuUkAL09ZA', hash = 'Myeloid compartment', description = '2', storage_id = '2024-07-01', version = 'AnnData', _accessor = '3659', id = 'cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad', key = 'dataset', type = '22', transform_id = '691757462', size = 'TRUE', is_latest = '51552', n_observations = '1', created_by_id = 'md5-n', _hash_type = '2024-07-12T12:34:10.345829+00:00', created_at = '2024-07-12T12:40:48.837026+00:00')
artifact$id
[1] 3659
artifact$uid
[1] "KBW89Mf7IGcekja2hADu"
artifact$key
[1] "cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad"
artifact$storage
Warning: Data is missing expected fields: run_id, created_by_id
Storage(id = '2', uid = 'oIYGbD74', root = 's3://cellxgene-data-public', type = 's3', region = 'us-west-2', created_at = '2023-09-19T13:17:56.273068+00:00', updated_at = '2023-10-16T15:04:08.998203+00:00', description = '2', instance_uid = 'oIYGbD74')
artifact$created_by
User(id = '1', uid = 'kmvZDIX9', name = 'Sunny Sun', handle = 'sunnyosun', created_at = '2023-09-19T12:02:50.76501+00:00', updated_at = '2023-12-13T16:23:44.195541+00:00')
Note
Only S3 storage is supported at the moment.
artifact$cache()
Warning: Data is missing expected fields: run_id, created_by_id
ℹ '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'
Note
Only S3 storage and AnnData accessors are supported at the moment.
artifact$load()
Warning: Data is missing expected fields: run_id, created_by_id
ℹ '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'