Title: | CZ CELLxGENE Discover Cell Census |
---|---|
Description: | API to facilitate the use of the CZ CELLxGENE Discover Census. For more information about the API and the project visit https://github.com/chanzuckerberg/cellxgene-census/ |
Authors: | Chan Zuckerberg Initiative Foundation [aut, cre, cph, fnd] |
Maintainer: | Chan Zuckerberg Initiative Foundation <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.16.1 |
Built: | 2024-10-07 20:20:06 UTC |
Source: | https://github.com/chanzuckerberg/cellxgene-census |
Download source H5AD to local file name.
download_source_h5ad( dataset_id, file, overwrite = FALSE, census_version = "stable", census = NULL )
download_source_h5ad( dataset_id, file, overwrite = FALSE, census_version = "stable", census = NULL )
dataset_id |
The dataset_id of interest. |
file |
Local file name to store H5AD file. |
overwrite |
TRUE to allow overwriting an existing file. |
census_version |
The desired Census version. |
census |
An open Census handle for |
download_source_h5ad("0895c838-e550-48a3-a777-dbcd35d30272", "/tmp/data.h5ad", overwrite = TRUE)
download_source_h5ad("0895c838-e550-48a3-a777-dbcd35d30272", "/tmp/data.h5ad", overwrite = TRUE)
Get locator information about a Census mirror
get_census_mirror(mirror)
get_census_mirror(mirror)
mirror |
Name of the mirror. |
List with mirror information
get_census_mirror("AWS-S3-us-west-2")
get_census_mirror("AWS-S3-us-west-2")
Get the directory of Census mirrors currently available
get_census_mirror_directory()
get_census_mirror_directory()
Nested list with information about available mirrors
get_census_mirror_directory()
get_census_mirror_directory()
Get release description for a Census version
get_census_version_description(census_version)
get_census_version_description(census_version)
census_version |
The census version name. |
List with the release location and metadata
as.data.frame(get_census_version_description("stable"))
as.data.frame(get_census_version_description("stable"))
Get the directory of Census releases currently available
get_census_version_directory()
get_census_version_directory()
Data frame of available cell census releases, including location and metadata.
get_census_version_directory()
get_census_version_directory()
Read the feature dataset presence matrix.
get_presence_matrix(census, organism, measurement_name = "RNA")
get_presence_matrix(census, organism, measurement_name = "RNA")
census |
The census object from |
organism |
The organism to query, usually one of |
measurement_name |
The measurement object to query. Defaults to |
A tiledbsoma::matrixZeroBasedView
object with dataset join id & feature
join id dimensions, filled with 1s indicating presence. The sparse matrix
is accessed with zero-based indexes since the join id's may be zero.
census <- open_soma() on.exit(census$close(), add = TRUE) print(get_presence_matrix(census, "Homo sapiens")$dim())
census <- open_soma() on.exit(census$close(), add = TRUE) print(get_presence_matrix(census, "Homo sapiens")$dim())
Seurat
Convenience wrapper around SOMAExperimentAxisQuery
, to build and execute a
query, and return it as a Seurat
object.
get_seurat( census, organism, measurement_name = "RNA", X_layers = c(counts = "raw", data = NULL), obs_value_filter = NULL, obs_coords = NULL, obs_column_names = NULL, obsm_layers = FALSE, var_value_filter = NULL, var_coords = NULL, var_column_names = NULL, var_index = "feature_id" )
get_seurat( census, organism, measurement_name = "RNA", X_layers = c(counts = "raw", data = NULL), obs_value_filter = NULL, obs_coords = NULL, obs_column_names = NULL, obsm_layers = FALSE, var_value_filter = NULL, var_coords = NULL, var_column_names = NULL, var_index = "feature_id" )
census |
The census object, usually returned by |
organism |
The organism to query, usually one of |
measurement_name |
The measurement object to query. Defaults to |
X_layers |
A named character of |
obs_value_filter |
A SOMA |
obs_coords |
A set of coordinates on the obs dataframe index, expressed in any type or format supported by SOMADataFrame's read() method. |
obs_column_names |
Columns to fetch for the |
obsm_layers |
Names of arrays in obsm to add as the cell embeddings; pass FALSE to suppress loading in any dimensional reductions. |
var_value_filter |
Same as |
var_coords |
Same as |
var_column_names |
Columns to fetch for the |
var_index |
Name of column in ‘var’ to add as feature names. |
A Seurat
object containing the sensus slice.
## Not run: census <- open_soma() seurat_obj <- get_seurat( census, organism = "Homo sapiens", obs_value_filter = "cell_type == 'leptomeningeal cell'", var_value_filter = "feature_id %in% c('ENSG00000107317', 'ENSG00000106034')" ) seurat_obj census$close() ## End(Not run)
## Not run: census <- open_soma() seurat_obj <- get_seurat( census, organism = "Homo sapiens", obs_value_filter = "cell_type == 'leptomeningeal cell'", var_value_filter = "feature_id %in% c('ENSG00000107317', 'ENSG00000106034')" ) seurat_obj census$close() ## End(Not run)
SingleCellExperiment
Convenience wrapper around SOMAExperimentAxisQuery
, to build and execute a
query, and return it as a SingleCellExperiment
object.
get_single_cell_experiment( census, organism, measurement_name = "RNA", X_layers = c(counts = "raw"), obs_value_filter = NULL, obs_coords = NULL, obs_column_names = NULL, obsm_layers = FALSE, var_value_filter = NULL, var_coords = NULL, var_column_names = NULL, var_index = "feature_id" )
get_single_cell_experiment( census, organism, measurement_name = "RNA", X_layers = c(counts = "raw"), obs_value_filter = NULL, obs_coords = NULL, obs_column_names = NULL, obsm_layers = FALSE, var_value_filter = NULL, var_coords = NULL, var_column_names = NULL, var_index = "feature_id" )
census |
The census object, usually returned by |
organism |
The organism to query, usually one of |
measurement_name |
The measurement object to query. Defaults to |
X_layers |
A character vector of X layers to add as assays in the main experiment; may optionally be named to set the name of the resulting assay (eg. ‘X_layers = c(counts = "raw")’ will load in X layer “‘raw’” as assay “‘counts’”); by default, loads in all X layers |
obs_value_filter |
A SOMA |
obs_coords |
A set of coordinates on the obs dataframe index, expressed in any type or format supported by SOMADataFrame's read() method. |
obs_column_names |
Columns to fetch for the |
obsm_layers |
Names of arrays in obsm to add as the cell embeddings; pass FALSE to suppress loading in any dimensional reductions. |
var_value_filter |
Same as |
var_coords |
Same as |
var_column_names |
Columns to fetch for the |
var_index |
Name of column in ‘var’ to add as feature names. |
A SingleCellExperiment
object containing the sensus slice.
## Not run: census <- open_soma() sce_obj <- get_single_cell_experiment( census, organism = "Homo sapiens", obs_value_filter = "cell_type == 'leptomeningeal cell'", var_value_filter = "feature_id %in% c('ENSG00000107317', 'ENSG00000106034')" ) sce_obj census$close() ## End(Not run)
## Not run: census <- open_soma() sce_obj <- get_single_cell_experiment( census, organism = "Homo sapiens", obs_value_filter = "cell_type == 'leptomeningeal cell'", var_value_filter = "feature_id %in% c('ENSG00000107317', 'ENSG00000106034')" ) sce_obj census$close() ## End(Not run)
Locate source h5ad file for a dataset.
get_source_h5ad_uri(dataset_id, census_version = "stable", census = NULL)
get_source_h5ad_uri(dataset_id, census_version = "stable", census = NULL)
dataset_id |
The dataset_id of interest. |
census_version |
The desired Census version. |
census |
An open Census handle for |
A list with uri
and optional s3_region
.
get_source_h5ad_uri("0895c838-e550-48a3-a777-dbcd35d30272")
get_source_h5ad_uri("0895c838-e550-48a3-a777-dbcd35d30272")
SOMATileDBContext
for CensusCreate a SOMATileDBContext suitable for using with open_soma()
.
Typically open_soma()
creates a context automatically, but one can be created
separately in order to set custom configuration options, or to share it between
multiple open Census handles.
new_SOMATileDBContext_for_census( census_version_description, mirror = "default", ... )
new_SOMATileDBContext_for_census( census_version_description, mirror = "default", ... )
census_version_description |
The result of |
mirror |
The name of the intended census mirror (or |
... |
Custom configuration options. |
SOMATileDBContext object for open_soma()
.
census_desc <- get_census_version_description("stable") ctx <- new_SOMATileDBContext_for_census(census_desc, "soma.init_buffer_bytes" = paste(4 * 1024**3)) census <- open_soma("stable", tiledbsoma_ctx = ctx) census$close()
census_desc <- get_census_version_description("stable") ctx <- new_SOMATileDBContext_for_census(census_desc, "soma.init_buffer_bytes" = paste(4 * 1024**3)) census <- open_soma("stable", tiledbsoma_ctx = ctx) census$close()
Open the Census
open_soma( census_version = "stable", uri = NULL, tiledbsoma_ctx = NULL, mirror = NULL )
open_soma( census_version = "stable", uri = NULL, tiledbsoma_ctx = NULL, mirror = NULL )
census_version |
The version of the Census, e.g., "stable". |
uri |
A URI containing the Census SOMA objects to open instead of a
released version. (If supplied, takes precedence over
|
tiledbsoma_ctx |
A |
mirror |
The Census mirror to access; one of |
Top-level tiledbsoma::SOMACollection
object. After use, the census
should be closed to release memory and other resources, usually with
on.exit(census$close(), add = TRUE)
. Closing the top-level census
will also close all SOMA objects accessed through it.
census <- open_soma() as.data.frame(census$get("census_info")$get("summary")$read()$concat()) census$close()
census <- open_soma() as.data.frame(census$get("census_info")$get("summary")$read()$concat()) census$close()