| Title: | Queries the Human Cell Atlas |
|---|---|
| Description: | Provides access to a copy of the Human Cell Atlas, but with harmonised metadata. This allows for uniform querying across numerous datasets within the Atlas using common fields such as cell type, tissue type, and patient ethnicity. Usage involves first querying the metadata table for cells of interest, and then downloading the corresponding cells into one of several supported formats, including SingleCellExperiment, Seurat, or pseudobulk SummarizedExperiment objects. Note: The Human Cell Atlas data accessed through this package is subject to its own licensing terms (typically Creative Commons Attribution or similar open data licenses as specified by the Human Cell Atlas Data Use Agreement), which differ from the package license (GPL-3). See the package documentation for details. |
| Authors: | Stefano Mangiola [aut, rev, ctb] (ORCID: <https://orcid.org/0000-0001-7474-836X>), Mengyuan Shen [aut, cre, rev] (ORCID: <https://orcid.org/0009-0008-0057-8239>), Michael Milton [aut, rev, ctb] (ORCID: <https://orcid.org/0000-0002-8965-2595>), Jared Andrews [aut, rev, ctb], Juan Henao [aut, ctb], Edward Yang [aut, ctb], Julie Iskander [rev], Silicon Valley Foundation CZF2019-002443 [fnd], NIH NHGRI 5U24HG004059-18 [fnd], Victoria Cancer Agency ECRF21036 [fnd], NHMRC 1116955 [fnd] |
| Maintainer: | Mengyuan Shen <[email protected]> |
| License: | GPL-3 |
| Version: | 0.99.23 |
| Built: | 2026-06-10 07:13:07 UTC |
| Source: | https://github.com/bioc/cellNexus |
cellNexus provides a query interface for programmatic exploration
and retrieval of the harmonised, curated and reannotated CELLxGENE
single-cell Human Cell Atlas. The package allows users to query metadata
and download single-cell RNA sequencing data in various formats including
SingleCellExperiment, Seurat, and pseudobulk SummarizedExperiment objects.
The cellNexus package (invisibly).
To get started with cellNexus, first load the package and retrieve
the metadata:
library(cellNexus) metadata <- get_metadata()
Then filter the metadata to find cells of interest and download the data:
filtered_metadata <- metadata |>
dplyr::filter(
tissue == "lung parenchyma" &
cell_type %LIKE% "%CD4%"
)
sce <- get_single_cell_experiment(filtered_metadata)
get_metadataRetrieve and query the harmonised metadata
get_single_cell_experimentDownload data as SingleCellExperiment objects
get_seuratDownload data as Seurat objects
get_pseudobulkDownload aggregated pseudobulk data
Important: The Human Cell Atlas data accessed through this package
is subject to its own licensing terms, which differ from the package license.
The cellNexus package itself is licensed under GPL-3. However, the
underlying Human Cell Atlas data is typically licensed under Creative Commons
Attribution (CC-BY) or similar open data licenses as specified by the
Human Cell Atlas Data Use Agreement. Users should review the specific
licensing terms for any datasets they access through this package.
For more information, see the Human Cell Atlas Data Portal:
https://data.humancellatlas.org/about
See vignette("cellNexus", package = "cellNexus") for a comprehensive
introduction to using the package.
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
Create a Shiny app that allows users to generate filtering & retreival code for cellNexus
create_interface_app(ui_choices, return_as_list = FALSE)create_interface_app(ui_choices, return_as_list = FALSE)
ui_choices |
A list of pre-computed unique values for each filterable column in the metadata. |
return_as_list |
If TRUE, returns a list with 'ui' and 'server' components instead of a Shiny app object. |
A Shiny app that allows users to filter cellNexus metadata and generate code for retrieval in the selected format.
Jared Andrews
get_default_cache_dir() # Create the interface app with metadata metadata <- get_metadata(cloud_metadata = SAMPLE_DATABASE_URL) app <- create_interface_app(metadata) # Run the app shiny::runApp(app)get_default_cache_dir() # Create the interface app with metadata metadata <- get_metadata(cloud_metadata = SAMPLE_DATABASE_URL) app <- create_interface_app(metadata) # Run the app shiny::runApp(app)
Downloads the atlas_versions.parquet registry from the cellNexus metadata
store, caches it locally, and returns it as an in-memory tibble. Each row
describes one atlas data release and its relationship to a CellxGene Census
snapshot.
get_atlas_versions(cache = tempdir())get_atlas_versions(cache = tempdir())
cache |
Optional character scalar. A local directory used to cache the downloaded parquet file. Defaults to a temporary directory to separate from the main cache directory. |
The atlas_id column in this table corresponds directly to the atlas_id
column returned by get_metadata(), so you can join them to find which
Census snapshot any cell in your query came from.
A tibble with columns:
Atlas version identifier, e.g. "cellxgene_2024/0.1.0".
Matches the atlas_id column in get_metadata().
The CellxGene Census snapshot this atlas was built
from, e.g. "01-07-2024".
One of "initial", "patch", "minor", or
"major". See ATLAS_VERSIONS.md for the conventions standards.
Summary text of what changed in this release.
Modification date as a character scalar ("YYYY-MM-DD").
By default use Sys.Date()
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
CellxGene Census data releases (LTS): https://chanzuckerberg.github.io/cellxgene-census/cellxgene_census_docsite_data_release_info.html
get_atlas_versions()get_atlas_versions()
Downloads a parquet database of the cell communication strength to a local cache, and then opens it as a data frame. It can then be filtered.
get_cell_communication_strength( cloud_metadata = get_metadata_url("cellNexus_lr_signaling_pathway_strength_DEMO.parquet"), local_metadata = NULL, cache_directory = get_default_cache_dir(), use_cache = TRUE )get_cell_communication_strength( cloud_metadata = get_metadata_url("cellNexus_lr_signaling_pathway_strength_DEMO.parquet"), local_metadata = NULL, cache_directory = get_default_cache_dir(), use_cache = TRUE )
cloud_metadata |
Character vector of any length. HTTP URL/URLs pointing
to the name and location of parquet database/databases. By default, it points to
cell communication metadata in cellNexus ARDC Nectar Research Cloud.
Assign |
local_metadata |
Optional character vector of any length representing the local path of parquet database(s). |
cache_directory |
Optional character vector of length 1. A file path on
your local system to a directory (not a file) that will be used to store
|
use_cache |
Optional logical scalar. If |
The returned table integrates three levels of cell communication
inference from CellChat, for each sample:
(i) ligand–receptor–level communication (lr_prob, lr_pval),
(ii) pathway-level aggregated signaling (pathway_prob, pathway_pval),
(iii) cell-pair–level summaries of communication breadth
(interaction_count - number of significant LR interactions) and
intensity (interaction_weight - overall communication strength).
Together, these metrics allow simultaneous assessment of signaling specificity, pathway dominance, and global communication structure between cell populations.
A lazy data.frame subclass containing the metadata. You can interact
with this object using most standard dplyr functions. For string matching,
it is recommended that you use stringr::str_like to filter character
columns, as stringr::str_match will not work.
# For fast build purpose only, you do not need to specify anything in the function. communication_meta <- get_cell_communication_strength( cloud_metadata = get_metadata_url( "cellNexus_lr_signaling_pathway_strength_DEMO.parquet" ) )# For fast build purpose only, you do not need to specify anything in the function. communication_meta <- get_cell_communication_strength( cloud_metadata = get_metadata_url( "cellNexus_lr_signaling_pathway_strength_DEMO.parquet" ) )
Generating counts per million from a SingleCellExperiment object
get_counts_per_million(sce, output_file)get_counts_per_million(sce, output_file)
sce |
A SingleCellExperiment object |
output_file |
A character vector of CPM Anndata file path |
A directory stores counts per million Anndata
data(pbmc3k_sce) get_counts_per_million(pbmc3k_sce, tempfile(fileext = ".h5ad"))data(pbmc3k_sce) get_counts_per_million(pbmc3k_sce, tempfile(fileext = ".h5ad"))
Returns the default cache directory with a version number
get_default_cache_dir()get_default_cache_dir()
A length one character vector.
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
get_metadata(cloud_metadata = SAMPLE_DATABASE_URL, cache_directory = get_default_cache_dir())get_metadata(cloud_metadata = SAMPLE_DATABASE_URL, cache_directory = get_default_cache_dir())
Downloads a parquet database of the Human Cell Atlas metadata to a local
cache, and then opens it as a data frame. It can then be filtered and passed
into get_single_cell_experiment() to obtain a
SingleCellExperiment::SingleCellExperiment
get_metadata( cloud_metadata = get_metadata_url("cellnexus_metadata.2.3.0.parquet"), local_metadata = NULL, cache_directory = get_default_cache_dir(), use_cache = TRUE )get_metadata( cloud_metadata = get_metadata_url("cellnexus_metadata.2.3.0.parquet"), local_metadata = NULL, cache_directory = get_default_cache_dir(), use_cache = TRUE )
cloud_metadata |
Optional character vector of any length. HTTP URL/URLs pointing
to the name and location of parquet database/databases. By default, it points to
cellNexus ARDC Nectar Research Cloud. Assign |
local_metadata |
Optional character vector of any length representing the local path of parquet database(s). |
cache_directory |
Optional character vector of length 1. A file path on your local system to a directory (not a file) that will be used to store metadata. |
use_cache |
Optional logical scalar. If |
The metadata was collected from the Bioconductor package cellxgenedp.
vignette("using_cellxgenedp", package="cellxgenedp") provides an overview of the columns in the
metadata. The data for which the column organism_name included "Homo
sapiens" was collected collected from cellxgenedp.
The columns dataset_id and file_id_cellNexus_single_cell link the datasets explorable through
cellNexus and cellxgenedpto the CELLxGENE portal.
Our representation, harmonises the metadata at dataset, sample and cell levels, in a unique coherent database table.
Field definitions for the CELLxGENE schema follow the CELLxGENE schema 5.1.0.
Through harmonisation and curation we introduced custom columns not present in the original CELLxGENE metadata:
cell_count: Number of cells in a dataset.
feature_count: Number of genes in a dataset.
age_days: Donor age in days.
tissue_groups: Coarse tissue grouping for analysis.
empty_droplet: Whether a cell is called an empty droplet from expressed-gene count per sample (default threshold 200; targeted panels may differ).
alive: Whether a cell passes viability / mitochondrial QC.
scDblFinder.class: Doublet, singlet, or unknown (scDblFinder default parameters).
cell_type_unified_ensemble: Consensus immune identity from Azimuth and SingleR (Blueprint, Monaco).
cell_annotation_azimuth_l2: Azimuth cell annotation.
cell_annotation_blueprint_singler: SingleR annotation (Blueprint).
cell_annotation_blueprint_monaco: SingleR annotation (Monaco).
is_immune: Whether a cell is an immune cell.
sample_heuristic: Internal sample subdivision helper.
file_id_cellNexus_single_cell: Internal file id for single-cell layers.
file_id_cellNexus_pseudobulk: Internal file id for pseudobulk layers.
sample_id: Harmonised sample identifier.
nCount_RNA: Total RNA counts per cell (sample-aware).
nFeature_expressed_in_sample: Number of expressed features per cell.
ethnicity_flagging_score: Supporting score for ethnicity imputation.
low_confidence_ethnicity: Supporting flag for low-confidence ethnicity calls.
.aggregated_cells: Post-QC cells combined into each pseudobulk sample.
imputed_ethnicity: Imputed ethnicity label.
atlas_id: cellNexus atlas release identifier (internal use).
For all fields definitions, please refer to our documentation site
Possible cache path issues
If your default R cache path includes non-standard characters (e.g. dash because of your user or organisation name), the following error can occur.
Error in `db_query_fields.DBIConnection()`: ! Can't query fields. Caused by error: ! Parser Error: syntax error at or near "/" LINE 2: FROM /Users/bob/Library/Caches...
The solution is to choose a different cache, for example
get_metadata(cache_directory = path.expand('~'))
A lazy data.frame subclass containing the metadata. You can interact
with this object using most standard dplyr functions. For string matching,
it is recommended that you use stringr::str_like to filter character
columns, as stringr::str_match will not work.
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
library(dplyr) # For fast build purpose only, you do not need to specify anything in cloud_metadata. filtered_metadata <- get_metadata(cloud_metadata = SAMPLE_DATABASE_URL) |> filter( self_reported_ethnicity == "African" & assay %LIKE% "%10x%" & tissue == "lung parenchyma" & cell_type %LIKE% "%CD4%" )library(dplyr) # For fast build purpose only, you do not need to specify anything in cloud_metadata. filtered_metadata <- get_metadata(cloud_metadata = SAMPLE_DATABASE_URL) |> filter( self_reported_ethnicity == "African" & assay %LIKE% "%10x%" & tissue == "lung parenchyma" & cell_type %LIKE% "%CD4%" )
Returns the URLs for all metadata files
get_metadata_url( databases = c("cellnexus_metadata.2.3.0.parquet", "census_cell_metadata.2.3.0.parquet") )get_metadata_url( databases = c("cellnexus_metadata.2.3.0.parquet", "census_cell_metadata.2.3.0.parquet") )
databases |
A character vector specifying the names of the metadata files. Download the specific metadata by defining the metadata version. |
A character vector of URLs to parquet files to download
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
get_metadata_url("cellnexus_metadata.2.3.0.parquet")get_metadata_url("cellnexus_metadata.2.3.0.parquet")
Given a data frame of Curated Atlas metadata obtained from get_metadata(),
returns a SummarizedExperiment::SummarizedExperiment object
corresponding to the samples in that data frame
get_pseudobulk( data, assays = "counts", cell_aggregation = "pseudobulk", cache_directory = get_default_cache_dir(), repository = COUNTS_URL, features = NULL, as_SummarizedExperiment = FALSE )get_pseudobulk( data, assays = "counts", cell_aggregation = "pseudobulk", cache_directory = get_default_cache_dir(), repository = COUNTS_URL, features = NULL, as_SummarizedExperiment = FALSE )
data |
A data frame containing, at minimum, |
assays |
A character vector specifying the desired assay(s) to be requested. The default setting retrieves only the counts assay. |
cell_aggregation |
A character vector that specifies which cell aggregation strategy should be applied. This will create a corresponding subdirectory in the cache directory. |
cache_directory |
An optional character vector of length one. If provided, it should indicate a local file path where any remotely accessed files should be copied. |
repository |
A character vector of length one. If provided, it should be an HTTP URL pointing to the location where the single cell data is stored. |
features |
An optional character vector of features (ie genes) to return the counts for. By default counts for all features will be returned. When provided, the returned object will contain exactly the requested features (row order preserved), and any experiments/samples that do not contain all requested features are dropped. This preserves the full set of requested features at the cost of potentially fewer samples. A warning is emitted when samples are dropped. |
as_SummarizedExperiment |
If |
By default, a SingleCellExperiment object. If
as_SummarizedExperiment is TRUE, a SummarizedExperiment object.
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
# Use the lightweight sample database URL (for fast checks during development only) meta <- get_metadata(cloud_metadata = cellNexus::SAMPLE_DATABASE_URL) |> keep_quality_cells() |> dplyr::filter(cell_type_unified_ensemble == "epithelial") pseudobulk <- meta |> get_pseudobulk()# Use the lightweight sample database URL (for fast checks during development only) meta <- get_metadata(cloud_metadata = cellNexus::SAMPLE_DATABASE_URL) |> keep_quality_cells() |> dplyr::filter(cell_type_unified_ensemble == "epithelial") pseudobulk <- meta |> get_pseudobulk()
Given a data frame of HCA metadata, returns a Seurat object corresponding to the samples in that data frame
get_seurat(...)get_seurat(...)
... |
Arguments passed on to
|
A Seurat object containing the same data as a call to
get_single_cell_experiment()
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
# Use the lightweight sample database URL (for fast checks during development only) meta <- get_metadata(cloud_metadata = cellNexus::SAMPLE_DATABASE_URL) |> head(2) seurat <- get_seurat(meta)# Use the lightweight sample database URL (for fast checks during development only) meta <- get_metadata(cloud_metadata = cellNexus::SAMPLE_DATABASE_URL) |> head(2) seurat <- get_seurat(meta)
Given a data frame of Curated Atlas metadata obtained from get_metadata(),
returns a SingleCellExperiment::SingleCellExperiment object
corresponding to the samples in that data frame
get_single_cell_experiment( data, assays = "counts", cell_aggregation = "", cache_directory = get_default_cache_dir(), repository = COUNTS_URL, features = NULL )get_single_cell_experiment( data, assays = "counts", cell_aggregation = "", cache_directory = get_default_cache_dir(), repository = COUNTS_URL, features = NULL )
data |
A data frame containing, at minimum, |
assays |
A character vector specifying the desired assay(s) to be requested. Valid elements include "counts", "cpm", "rank", and "sct" for single-cell analyses The default setting retrieves only the counts assay. If your analysis involves a smaller set of genes, consider using the "cpm" assay. The "rank" assay is suited for signature calculations across millions of cells. |
cell_aggregation |
A character vector that specifies which cell aggregation strategy should be applied. This will create a corresponding subdirectory in the cache directory. Single cell level is applied by default. |
cache_directory |
An optional character vector of length one. If provided, it should indicate a local file path where any remotely accessed files should be copied. |
repository |
A character vector of length one. If provided, it should be an HTTP URL pointing to the location where the single cell data is stored. |
features |
An optional character vector of features (ie genes) to return the counts for. By default counts for all features will be returned. |
A SingleCellExperiment object.
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
# Use the lightweight sample database URL (for fast checks during development only) meta <- get_metadata(cloud_metadata = cellNexus::SAMPLE_DATABASE_URL) |> head(2) sce <- get_single_cell_experiment(meta)# Use the lightweight sample database URL (for fast checks during development only) meta <- get_metadata(cloud_metadata = cellNexus::SAMPLE_DATABASE_URL) |> head(2) sce <- get_single_cell_experiment(meta)
Given a data frame of Curated Atlas metadata obtained from get_metadata(),
returns a SingleCellExperiment::SingleCellExperiment object
corresponding to the samples in that data frame
get_SingleCellExperiment(...)get_SingleCellExperiment(...)
... |
Arguments passed on to
|
A SingleCellExperiment object.
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
# Use the lightweight sample database URL (for fast checks during development only) meta <- get_metadata(cloud_metadata = cellNexus::SAMPLE_DATABASE_URL) |> head(2) sce <- get_single_cell_experiment(meta)# Use the lightweight sample database URL (for fast checks during development only) meta <- get_metadata(cloud_metadata = cellNexus::SAMPLE_DATABASE_URL) |> head(2) sce <- get_single_cell_experiment(meta)
Downloads and joins the Census metadata with cellNexus metadata. This function creates indexed tables for efficient joining and returns a data frame.
join_census_table( tbl, cloud_metadata = get_metadata_url("census_cell_metadata.2.3.0.parquet"), cache_directory = get_default_cache_dir(), join_keys = c("sample_id", "dataset_id", "observation_joinid") )join_census_table( tbl, cloud_metadata = get_metadata_url("census_cell_metadata.2.3.0.parquet"), cache_directory = get_default_cache_dir(), join_keys = c("sample_id", "dataset_id", "observation_joinid") )
tbl |
A |
cloud_metadata |
HTTP URL/URLs pointing to the census parquet database name and location. |
cache_directory |
A character string specifying the local cache
directory where remote parquet files will be stored. Defaults to
|
join_keys |
A character vector of column names used for the join.
Defaults to |
A lazy SQL table with Census metadata joined to the cellNexus metadata.
library(dplyr) get_metadata(cloud_metadata = SAMPLE_DATABASE_URL) |> head(2) |> # You do not need to specify anything in cloud_metadata join_census_table( cloud_metadata = SAMPLE_DATABASE_URL, cache_directory = tempdir() )library(dplyr) get_metadata(cloud_metadata = SAMPLE_DATABASE_URL) |> head(2) |> # You do not need to specify anything in cloud_metadata join_census_table( cloud_metadata = SAMPLE_DATABASE_URL, cache_directory = tempdir() )
Keep high-quality cells based on QC columns
keep_quality_cells( data, empty_droplet_col = "empty_droplet", alive_col = "alive", doublet_col = "scDblFinder.class" )keep_quality_cells( data, empty_droplet_col = "empty_droplet", alive_col = "alive", doublet_col = "scDblFinder.class" )
data |
A data frame or tibble containing single-cell metadata. |
empty_droplet_col |
A string specifying the column name
that indicates empty droplets (default: |
alive_col |
A string specifying the column name
that indicates whether cells are alive (default: |
doublet_col |
A string specifying the column name
that indicates doublets (default: |
A filtered data frame containing only cells that pass all QC checks.
get_metadata(cloud_metadata = SAMPLE_DATABASE_URL, cache_directory = tempdir()) |> head(2) |> keep_quality_cells()get_metadata(cloud_metadata = SAMPLE_DATABASE_URL, cache_directory = tempdir()) |> head(2) |> keep_quality_cells()
Organize arbitrary Shiny inputs into a grid layout
organize_inputs( tag.list, id = NULL, title = NULL, tack = NULL, columns = NULL, rows = NULL )organize_inputs( tag.list, id = NULL, title = NULL, tack = NULL, columns = NULL, rows = NULL )
tag.list |
A tagList containing UI inputs or a named list containing multiple tagLists containing UI inputs. |
id |
An optional ID for the tabsetPanel if a named list is provided. |
title |
An optional title for the grid, should be a UI element, e.g. h3("Title"). |
tack |
An optional UI input to tack onto the end of the grid. |
columns |
Number of columns. |
rows |
Number of rows. |
A Shiny tagList with inputs organized into a grid, optionally nested inside a tabsetPanel.
Jared Andrews
library(shiny) # Example 1: Basic usage with a simple grid ui.inputs <- tagList( textInput("name", "Name"), numericInput("age", "Age", value = 30), selectInput("gender", "Gender", choices = c("Male", "Female", "Other")) ) organize_inputs(ui.inputs, columns = 2, rows = 2) # Example 2: Using a named list to create tabs ui.inputs.tabs <- list( Personal = tagList( textInput("firstname", "First Name"), textInput("lastname", "Last Name") ), Settings = tagList( checkboxInput("newsletter", "Subscribe to newsletter", value = TRUE), sliderInput("volume", "Volume", min = 0, max = 100, value = 50) ) ) organize_inputs(ui.inputs.tabs, columns = 2) # Example 3: Adding an additional UI element with 'tack' additional.ui <- actionButton("submit", "Submit") organize_inputs(ui.inputs, tack = additional.ui, columns = 3) # Example 4: Handling a case with more inputs than grid cells many.inputs <- tagList(replicate(10, textInput("input", "Input"))) organize_inputs(many.inputs, columns = 3) # Creates more than one rowlibrary(shiny) # Example 1: Basic usage with a simple grid ui.inputs <- tagList( textInput("name", "Name"), numericInput("age", "Age", value = 30), selectInput("gender", "Gender", choices = c("Male", "Female", "Other")) ) organize_inputs(ui.inputs, columns = 2, rows = 2) # Example 2: Using a named list to create tabs ui.inputs.tabs <- list( Personal = tagList( textInput("firstname", "First Name"), textInput("lastname", "Last Name") ), Settings = tagList( checkboxInput("newsletter", "Subscribe to newsletter", value = TRUE), sliderInput("volume", "Volume", min = 0, max = 100, value = 50) ) ) organize_inputs(ui.inputs.tabs, columns = 2) # Example 3: Adding an additional UI element with 'tack' additional.ui <- actionButton("submit", "Submit") organize_inputs(ui.inputs, tack = additional.ui, columns = 3) # Example 4: Handling a case with more inputs than grid cells many.inputs <- tagList(replicate(10, textInput("input", "Input"))) organize_inputs(many.inputs, columns = 3) # Creates more than one row
A sample SingleCellExperiment object created from the pbmc3k dataset for testing and demonstration purposes. The dataset contains 500 cells with gene expression data mapped to Ensembl gene IDs and formatted with cellNexus-compatible metadata structure.
An object of class SingleCellExperiment with:
Gene expression matrix with Ensembl gene IDs as rownames
Cell metadata including sample_id, cell_type_unified_ensemble, nCount_RNA, etc.
List containing 'data' field with cellNexus-formatted metadata including:
cell_id: Unique cell identifier
sample_id: Sample identifier
cell_type_unified_ensemble: Cell type annotation
nCount_RNA: Number of RNA molecules per cell
ident: Seurat cluster identity
dataset_id: Dataset identifier
file_id_cellNexus_single_cell: Generated file ID for cellNexus
atlas_id: Atlas identifier with date
See dev/create_pbmc3k_sce.R for the complete creation script.
Created from pbmc3k dataset (SeuratData package)
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
data(pbmc3k_sce) pbmc3k_sce # Access metadata S4Vectors::metadata(pbmc3k_sce)$datadata(pbmc3k_sce) pbmc3k_sce # Access metadata S4Vectors::metadata(pbmc3k_sce)$data
URL pointing to the sample metadata file, which is smaller and for test, demonstration, and vignette purposes only
SAMPLE_DATABASE_URLSAMPLE_DATABASE_URL
An object of class character of length 2.
Character scalar consisting of the URL/URLs
Mangiola, S., M. Milton, N. Ranathunga, C. S. N. Li-Wai-Suen, A. Odainic, E. Yang, W. Hutchison et al. "A multi-organ map of the human immune system across age, sex and ethnicity." bioRxiv (2023): 2023-06. doi:10.1101/2023.06.08.542671.
get_metadata(cloud_metadata = SAMPLE_DATABASE_URL["cellnexus"], cache_directory = tempdir())get_metadata(cloud_metadata = SAMPLE_DATABASE_URL["cellnexus"], cache_directory = tempdir())
A list of unique values for each filterable column used in the cellNexus Shiny interface app. Pre-computing these choices avoids slow metadata queries when the app starts.
data(ui_choices)data(ui_choices)
A named list where each element contains unique values for a column:
Character vector of unified cell type labels
Character vector of original cell type labels
Logical values for cell viability
Character vector of doublet classification results
Logical values for immune cell classification
Logical values for empty droplet detection
Character vector of developmental stages
Character vector of disease states
Character vector of ethnicity labels
Character vector of sex labels
Character vector of tissue types
Character vector of tissue group labels
See dev/generate_ui_choices.R for the creation script.
Run this script to regenerate the choices when metadata columns change.
Generated from cellNexus metadata