Run expression-based single-cell or spatial copy-number alteration backends and store the results in a unified SCOP schema.
Usage
RunCNV(
srt,
method = c("copykat", "fastCNV", "scevan", "infercnv", "numbat", "casper"),
assay = NULL,
layer = "counts",
group.by = NULL,
reference.by = NULL,
reference = NULL,
genome = c("hg38", "hg19", "mm10"),
gene_order = NULL,
sample.by = NULL,
allele_counts = NULL,
reference_counts = NULL,
loh = NULL,
loh_name_mapping = NULL,
cytoband = NULL,
output_dir = NULL,
prefix = "CNV",
tool_name = "CNV",
store_matrix = TRUE,
verbose = TRUE,
...
)Arguments
- srt
A
Seuratobject.- method
CNA/CNV backend. Supported backends are
"copykat","fastCNV","scevan","infercnv","numbat", and"casper".- assay
Which assay to use. If
NULL, the default assay of the Seurat object will be used. When the object also containsChromatinAssay, the default assay and additionalChromatinAssaywill be preprocessed sequentially.- layer
Assay layer used as the expression matrix.
- group.by
Optional metadata column forwarded to supported backends and stored as cell annotation.
- reference.by
Metadata column identifying reference/normal cells. Required for
"infercnv"and"fastCNV".- reference
Reference labels in
reference.by.- genome
Reference genome label.
- gene_order
Gene coordinate table or a path to one. The table should contain gene, chromosome, start, and end columns. If
NULL, SCOP tries to resolve these columns from assay feature metadata.- sample.by
Optional sample metadata column.
- allele_counts
Allele count table for
"numbat". This is forwarded tonumbat::run_numbat()asdf_allele.- reference_counts
Reference expression profile for
"numbat". This is forwarded tonumbat::run_numbat()aslambdas_ref.- loh
B-allele frequency/LOH signal for
"casper".- loh_name_mapping
Optional CaSpER LOH-to-cell mapping table.
- cytoband
Cytoband table for
"casper".- output_dir
Optional backend output directory.
- prefix
Prefix for metadata columns.
- tool_name
Name used for
srt@tools.- store_matrix
Whether to store the normalized CNV matrix in
srt@tools[[tool_name]].- verbose
Whether to print the message. Default is
TRUE.- ...
Additional parameters forwarded to the selected backend.
Examples
if (FALSE) { # \dontrun{
# copykat uses raw counts and can infer diploid/aneuploid cells directly.
srt <- RunCNV(
srt,
method = "copykat",
genome = "hg38"
)
# fastCNV and inferCNV require a normal/reference cell annotation.
srt <- RunCNV(
srt,
method = "fastCNV",
reference.by = "celltype",
reference = "Normal",
genome = "hg38"
)
gene_order <- data.frame(
gene = rownames(srt),
chr = "chr1",
start = seq_len(nrow(srt)) * 1000,
end = seq_len(nrow(srt)) * 1000 + 999
)
srt <- RunCNV(
srt,
method = "infercnv",
reference.by = "celltype",
reference = "Normal",
gene_order = gene_order
)
# Numbat and CaSpER can also be run when allele-aware preprocessing
# outputs are available.
CNVPlot(srt, plot_type = "heatmap", group.by = "CNV_prediction")
CNVPlot(srt, plot_type = "dim", value = "CNV_prediction")
} # }