Package {ImmuneSigR}


Title: Immune Cell Signature Retrieval and Single-Cell Scoring
Version: 0.1.0
Description: Provides a literature-derived database of immune cell markers formatted as Gene Matrix Transposed (GMT) files. Users can search immune cell signatures, retrieve marker lists, export GMT files, create custom marker sets, and score gene-by-cell expression matrices with dependency-free rank-based or mean-expression methods. Cell subpopulations are distinguished by their source PMIDs. For the core curation of the lung cell atlas, see Travaglini et al. (2020) <doi:10.1038/s41586-020-2922-4>. For the pan-cancer B cell signatures, see Fitzsimons et al. (2024) <doi:10.1016/j.ccell.2024.09.011>.
License: GPL-3
Encoding: UTF-8
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
URL: https://github.com/YingYanLaing/ImmuneSigR
BugReports: https://github.com/YingYanLaing/ImmuneSigR/issues
Packaged: 2026-05-14 15:17:11 UTC; 梁颖妍
Author: Yingyan Liang [aut, cre], Peng Luo [aut]
Maintainer: Yingyan Liang <liangyingyan0625@163.com>
Repository: CRAN
Date/Publication: 2026-05-19 09:00:06 UTC

Create a Custom GMT File

Description

Converts a user-defined R list of markers into a standard GMT file format.

Usage

Create_Custom_GMT(
  marker_list,
  file_name = file.path(tempdir(), "My_Custom_Signatures.gmt")
)

Arguments

marker_list

A list where names are cell types and elements are character vectors of genes.

file_name

A character string specifying the output file name.

Value

Invisibly returns the created GMT file path.

Examples

my_markers <- list(Custom_T = c("CD3D", "CD8A"), Custom_B = c("CD19", "MS4A1"))
Create_Custom_GMT(my_markers, file_name = file.path(tempdir(), "custom.gmt"))

Export the built-in GMT file

Description

Copies the internal ImmuneSigR GMT database to a specified local directory.

Usage

Export_ImmuneSigR_GMT(out_dir = tempdir(), create_dir = TRUE)

Export_GMT(out_dir = tempdir(), create_dir = TRUE)

Arguments

out_dir

A character string specifying the output directory. Defaults to current working directory.

create_dir

Logical. If TRUE, creates out_dir when it does not exist.

Value

Invisibly returns the exported GMT file path.

Examples

Export_ImmuneSigR_GMT(out_dir = tempdir())

Get Marker Genes for Specific Cell Types

Description

Retrieve the marker gene lists for specified immune cell subpopulations.

Usage

Get_Markers(
  cell_type = NULL,
  ignore_case = TRUE,
  fixed = FALSE,
  min_genes = 1,
  gmt_file = NULL
)

Arguments

cell_type

A character vector specifying cell type keywords. If NULL, returns the entire database.

ignore_case

Logical. If TRUE, matching ignores case.

fixed

Logical. If TRUE, treats cell_type as plain text instead of a regular expression.

min_genes

Minimum number of genes required for a returned signature.

gmt_file

Optional path to a custom GMT file.

Value

A list containing the marker genes.

Examples

# Get all markers
all_markers <- Get_Markers()
# Get specific markers
t_cell_markers <- Get_Markers("T cell")

Score Expression Data using ImmuneSigR

Description

Scores expression matrices directly with dependency-free rank or mean methods.

Usage

Score_ImmuneSigR(
  expr,
  target_cells = NULL,
  min_genes = 5,
  gmt_file = NULL,
  score_name = "_score",
  method = c("auto", "rank", "mean"),
  max_rank = 1500,
  verbose = TRUE,
  ...
)

Score_CellSigR(
  expr,
  target_cells = NULL,
  min_genes = 5,
  gmt_file = NULL,
  score_name = "_score",
  method = c("auto", "rank", "mean"),
  max_rank = 1500,
  verbose = TRUE,
  ...
)

Arguments

expr

An expression matrix or data frame with genes in rows and cells in columns.

target_cells

A character vector of target cell subpopulations to score. If NULL, scores all signatures.

min_genes

Minimum number of genes required after filtering to genes present in the object.

gmt_file

Optional path to a custom GMT file.

score_name

Suffix used for generated score columns.

method

Scoring method. "rank" is a dependency-free UCell-like rank score; "mean" uses average expression; "auto" uses "rank".

max_rank

Maximum rank considered by the rank scoring method.

verbose

Logical. If TRUE, prints progress messages.

...

Reserved for future extensions.

Value

A data frame of scores with cells in rows and signatures in columns.

Examples

# Create a small toy expression matrix
set.seed(1)
toy_expr <- matrix(rpois(30, 2), nrow = 3,
                   dimnames = list(c("CD3D", "CD8A", "CD19"), paste0("cell_", 1:10)))
# Score the toy matrix (set min_genes = 2 because the toy matrix only has 3 genes)
scores <- Score_ImmuneSigR(toy_expr, target_cells = "T cell", min_genes = 2, method = "mean")

Search the ImmuneSigR Database

Description

Search for specific immune cell signatures based on metadata such as cell type, literature title, or PMID.

Usage

Search_ImmuneSigR(
  keyword = NULL,
  search_by = "Cell_Type",
  ignore_case = TRUE,
  fixed = FALSE,
  max_results = Inf,
  include_markers = FALSE
)

Search_CellSigR(
  keyword = NULL,
  search_by = "Cell_Type",
  ignore_case = TRUE,
  fixed = FALSE,
  max_results = Inf,
  include_markers = FALSE
)

Arguments

keyword

A character string specifying the search term (e.g., "Macrophage"). If NULL, returns all records.

search_by

A character string specifying the column to search. Options include "Cell_Type", "Title", "cell_name", "PMID".

ignore_case

Logical. If TRUE, matching ignores case.

fixed

Logical. If TRUE, treats keyword as plain text instead of a regular expression.

max_results

Maximum number of rows to return.

include_markers

Logical. If TRUE, includes all marker columns from the metadata CSV.

Value

A data frame containing the search results.

Examples

# Search for B cell signatures
b_cell_info <- Search_ImmuneSigR(keyword = "B cell", search_by = "Cell_Type")