Package 'HDStIM'

Title: High Dimensional Stimulation Immune Mapping ('HDStIM')
Description: A method for identifying responses to experimental stimulation in mass or flow cytometry that uses high dimensional analysis of measured parameters and can be performed with an end-to-end unsupervised approach. In the context of in vitro stimulation assays where high-parameter cytometry was used to monitor intracellular response markers, using cell populations annotated either through automated clustering or manual gating for a combined set of stimulated and unstimulated samples, 'HDStIM' labels cells as responding or non-responding. The package also provides auxiliary functions to rank intracellular markers based on their contribution to identifying responses and generating diagnostic plots.
Authors: Rohit Farmer [aut, cre] , Richard Apps [aut] , John Tsang [aut, pdr]
Maintainer: Rohit Farmer <[email protected]>
License: CC0 | file LICENSE
Version: 1.0.0
Built: 2024-11-11 06:02:22 UTC
Source: https://github.com/niaid/hdstim

Help Index


Sample data set for CyTOF Stimulation Assay

Description

A list with the CyTOF stimulation assay data.

Usage

chi11

Format

A list with one tibble containig CyTOF expression data. And four character vectors for arguments in the HDStIM function.

chi11$expr_data

A 7,000 X 36 tibble. Cells are on the rows and variables on the columns. The first 6 columns contain for each cell cluster_id (from FlowSOM clustering), sample_id (unique for each FSC file), condition (comparison groups), patient_id (unique for each subject), stim_type (labels for types of stimulation assays including the unstim), merging1 (meta culster labels from ConsensusClusterPlus). The last 30 columns contain the archsinh transformed CyTOF expression values for the 30 markers (20 type and 10 state) used in the sitmulation panel.

chi11$type_markers

A character vector with the labels for type markers used in the stimulation panel.

chi11$state_markers

A character vector with the labels for state markers used in the stimulation panel.

chi11$cluster_col

A character label of the meta-cluster/cluster ID column in chi11$expr_dat tibble.

chi11$stim_label

A character vector with the label(s) for the stimulation types corresponding to the labels in thestim_type column in chi11$expr_data.

chi11$unstim_label

A character label for the unstim cells corresponding to the labels in thestim_type column in chi11$expr_data.


HDStIM: High Dimensional Stimulation Immune Mapping

Description

Function to select cells from the stimulated samples that have likely responded to the stimulant.

Usage

HDStIM(
  dat,
  state_markers,
  cellpop_col,
  stim_lab,
  unstim_lab,
  p_value = 0.05,
  seed_val = NULL,
  umap = FALSE,
  umap_cells = NULL,
  verbose = FALSE
)

Arguments

dat

A tibble with the single cell data. Cells on rows and variables/markers on columns.

state_markers

A character vector with the labels of state markers from the stimulation panel.

cellpop_col

Column in the tibble with the cell population IDs.

stim_lab

A character vector of stim label(s).

unstim_lab

A character of unstim label(s).

p_value

The P-value for Fisher's exact test. Default is 0.05.

seed_val

Seed value (integer) for kmeans clustering. Default is NULL for no seed value.

umap

Boolean (T/F) to carry out UMAP on the selected cells. Default is FALSE to skip UMAP calculation.

umap_cells

An integer; for calculating UMAPs take a minimum of umap_cells per cluster or the total number of cells if the cluster size is smaller than umap_cells. Default is NULL.

verbose

Logical. To make function more verbose. Default is FALSE.

Value

A list with tibbles for expression data for the selected cells, data to plot stacked bar plots, data to plot UMAP plots, and parameters passed to the function.

Examples

mapped_data <- HDStIM(chi11$expr_data, chi11$state_markers,
                  chi11$cluster_col, chi11$stim_label,
                  chi11$unstim_label, seed_val = 123, umap = FALSE, umap_cells = NULL,
                  verbose = FALSE)

Marker Ranking by Boruta

Description

Function to run Boruta on the stimulation - cell population combinations that passed the Fisher's exact test to rank the markers according to their contribution to the response.

Usage

marker_ranking_boruta(
  mapped_data,
  path = NULL,
  n_cells = NULL,
  max_runs = 100,
  seed_val = 123,
  verbose = 0
)

Arguments

mapped_data

Returned list from the HDStIM function.

path

Path to the folder to save figures generated by this function.

n_cells

Number of cells to down sample the data. Default is NULL to include all the cells.

max_runs

Maximum number of runs for the random forest algorithm. Default is 100.

seed_val

Seed value for Boruta. Default is 123.

verbose

0, 1, or 2. Default is 0.

Value

A list with a tibble containing attribute statistics calculated by Boruta and ggplot objects. If the path is not NULL, plots are also rendered and saved in the specified folder in PNG format.

Examples

mapped_data <- HDStIM(chi11$expr_data, chi11$state_markers,
                      chi11$cluster_col, chi11$stim_label,
                      chi11$unstim_label, seed_val = 123, umap = FALSE, umap_cells = NULL,
                      verbose = FALSE)

marker_ranking <- marker_ranking_boruta(mapped_data, path = NULL, n_cells = NULL,
                                        max_runs = 1000, seed_val = 123,
                                        verbose = 0)

Diagnostic plots showing individual marker distribution before and after mapping by HDStIM

Description

Diagnostic plots showing individual marker distribution before and after mapping by HDStIM

Usage

plot_exprs(mapped_data, path = NULL, verbose = FALSE)

Arguments

mapped_data

List output of the HDStIM function.

path

Path to the folder to save figures generated by this function.

verbose

Logical. To make function more verbose. Default is FALSE.

Value

A list of ggplot objects. If the path is not NULL, PNG files of the plots are saved in the specified folder.

Examples

mapped_data <- HDStIM(chi11$expr_data, chi11$state_markers,
                  chi11$cluster_col, chi11$stim_label,
                  chi11$unstim_label, seed_val = 123, umap = FALSE, umap_cells = NULL,
                  verbose = FALSE)

pe <- plot_exprs(mapped_data, path = NULL, verbose = FALSE)

Diagnostic plots explaining K-means clustering and Fisher's exact test carried out by HDStIM

Description

Diagnostic plots explaining K-means clustering and Fisher's exact test carried out by HDStIM

Usage

plot_K_Fisher(mapped_data, path = NULL, verbose = FALSE)

Arguments

mapped_data

Returned list from the HDStIM function.

path

Path to the folder to save figures generated by this function NULL by default.

verbose

Logical. To make function more verbose. Default is FALSE.

Value

A list of ggplot objects. If the path is not NULL, PNG files of the plots are saved in the specified folder.

Examples

mapped_data <- HDStIM(chi11$expr_data, chi11$state_markers,
                  chi11$cluster_col, chi11$stim_label,
                  chi11$unstim_label, seed_val = 123, umap = FALSE, umap_cells = NULL,
                  verbose = FALSE)

pk <- plot_K_Fisher(mapped_data, path = NULL, verbose = FALSE)

Marker ranking heatmap

Description

A consolidated heatmap showing the importance scores of all the state markers (X-axis) from all the stimulation-cell population combinations that passed the Fisher's exact test (Y-axis).

Usage

plot_marker_ranking_heatmap(marker_ranking)

Arguments

marker_ranking

Returned list from the marker_ranking_boruta function.

Value

A ComplexHeatmap object

Examples

mapped_data <- HDStIM(chi11$expr_data, chi11$state_markers,
                      chi11$cluster_col, chi11$stim_label,
                      chi11$unstim_label, seed_val = 123, umap = TRUE,
                      umap_cells = 50, verbose = FALSE)

marker_ranking <- marker_ranking_boruta(mapped_data, path = NULL, n_cells = NULL,
                                        max_runs = 1000, seed_val = 123,
                                        verbose = 0)

pht <- plot_marker_ranking_heatmap(marker_ranking)

Diagnostic UMAP plots showing the partitioning of cells into responding and non-responding groups by HDStIM

Description

Diagnostic UMAP plots showing the partitioning of cells into responding and non-responding groups by HDStIM

Usage

plot_umap(mapped_data, path = NULL, verbose = FALSE)

Arguments

mapped_data

Returned list from the HDStIM function.

path

Path to the folder to save figures generated by this function.

verbose

Logical. To make function more verbose. Default is FALSE.

Value

A list of ggplot objects. If the path is not NULL, PNG files of the plots are saved in the specified folder.

Examples

mapped_data <- HDStIM(chi11$expr_data, chi11$state_markers,
                      chi11$cluster_col, chi11$stim_label,
                      chi11$unstim_label, seed_val = 123, umap = TRUE, 
                      umap_cells = 50, verbose = FALSE)

pu <- plot_umap(mapped_data, path = NULL, verbose = FALSE)