make.reference: Make a ProjecTILs reference

View source: R/main.R

make.referenceR Documentation

Make a ProjecTILs reference

Description

Converts a Seurat object to a ProjecTILs reference atlas. You can preserve your low-dimensionality embeddings (e.g. UMAP) in the reference atlas by setting 'recalculate.umap=FALSE', or recalculate the UMAP using one of the two methods (umap::umap or uwot::umap). Recalculation allows exploting the 'predict' functionalities of these methods for embedding of new points; skipping recalculation will make the projection use an approximation for UMAP embedding of the query.

Usage

make.reference(
  ref,
  assay = NULL,
  assay.raw = "RNA",
  atlas.name = "custom_reference",
  annotation.column = "functional.cluster",
  recalculate.umap = FALSE,
  umap.method = c("umap", "uwot"),
  metric = "cosine",
  min_dist = 0.3,
  n_neighbors = 30,
  ndim = 20,
  dimred = "umap",
  nfeatures = 1000,
  color.palette = NULL,
  scGate.model.human = NULL,
  scGate.model.mouse = NULL,
  store.markers = FALSE,
  n.markers = 10,
  seed = 123,
  layer1_link = NULL
)

Arguments

ref

Seurat object with reference atlas

assay

The assay storing the reference expression data (e.g. "integrated")

assay.raw

The assay storing raw expression data (e.g. "RNA")

atlas.name

An optional name for your reference

annotation.column

The metadata column with the cluster annotations for this atlas

recalculate.umap

If TRUE, run the 'umap' or 'uwot' algorithm to generate embeddings. Otherwise use the embeddings stored in the 'dimred' slot.

umap.method

Which method to use for calculating the umap reduction

metric

Distance metric to use to find nearest neighbors for UMAP

min_dist

Effective minimum distance between UMAP embedded points

n_neighbors

Size of local neighborhood for UMAP

ndim

Number of PCA dimensions

dimred

Use the pre-calculated embeddings stored at 'Embeddings(ref, dimred)'

nfeatures

Number of variable features (only calculated if not already present)

color.palette

A (named) vector of colors for the reference plotting functions. One color for each cell type in 'functional.cluster'

scGate.model.human

A mouse scGate model to purify the cell types represented in the map.

store.markers

Whether to store the top differentially expressed genes in 'ref@misc$gene.panel'

n.markers

Store the top 'n.markers' for each subtype given by differential expression analysis

seed

Random seed

layer1_link

Broad cell type contained in this reference atlas (i.e. CD4T, CL:0000624...) to link with broad cell type annotation (layer1).

Value

A reference atlas compatible with ProjecTILs

Examples

custom_reference <- ProjecTILs::make.reference(myref, recalculate.umap=T)

carmonalab/ProjecTILs documentation built on April 13, 2025, 10:04 p.m.