fastCNV_10XHD calls all of the internal functions needed to compute the putative CNV on a Seurat Visium HD object or a list of Seurat Visium HD objects
fastCNV_10XHD.Rd
This function orchestrates the CNV analysis on a Seurat Visium HD object (or multiple objects). It calls internal functions such as
CNVAnalysis
and PlotCNVResults
to compute the CNVs and generate heatmaps. The results are saved in the metadata of the Seurat object(s), with options for
generating and saving plots.
Usage
fastCNV_10XHD(
seuratObjHD,
sampleName,
referenceVar = NULL,
referenceLabel = NULL,
assay = "Spatial.016um",
pooledReference = TRUE,
denoise = TRUE,
scaleOnReferenceLabel = TRUE,
thresholdPercentile = 0.01,
geneMetadata = getGenes(),
windowSize = 150,
windowStep = 10,
saveGenomicWindows = FALSE,
topNGenes = 7000,
chrArmsToForce = NULL,
genesToForce = NULL,
regionToForce = NULL,
getCNVPerChromosomeArm = TRUE,
getCNVClusters = FALSE,
tumorLabel = NULL,
k_clusters = NULL,
h_clusters = NULL,
plotDendrogram = FALSE,
plotClustersOnDendrogram = FALSE,
plotElbowPlot = FALSE,
doPlot = TRUE,
printPlot = FALSE,
savePath = ".",
outputType = "png",
clustersVar = "cnv_clusters",
splitPlotOnVar = clustersVar,
referencePalette = "default"
)
Arguments
- seuratObjHD
Seurat object or list of Seurat objects to perform the CNV analysis on.
- sampleName
Name of the sample or a list of names corresponding to the samples in the
seuratObj
.- referenceVar
The variable name of the annotations in the Seurat metadata to be used as reference.
- referenceLabel
The label given to the observations you want as reference (can be any type of annotation).
- assay
Name of the assay to run the CNV on. Takes the results of
prepareCountsForCNVAnalysis
by default if available.- pooledReference
Default is
TRUE
. Will build a pooled reference across all samples ifTRUE
.- denoise
If
TRUE
, the data will be denoised (default =TRUE
).- scaleOnReferenceLabel
If
TRUE
, scales the results depending on the normal observations (default =TRUE
).- thresholdPercentile
Which quantiles to take (default 0.01). For example,
0.01
will take quantiles between 0.01-0.99. Background noise appears with higher numbers.- geneMetadata
List of genes and their metadata (default uses genes from Ensembl version 113).
- windowSize
Size of the genomic windows for CNV analysis (default = 150).
- windowStep
Step between the genomic windows (default = 10).
- saveGenomicWindows
If
TRUE
, saves the information of the genomic windows in the current directory (default =FALSE
).- topNGenes
Number of top expressed genes to keep (default = 7000).
- chrArmsToForce
A chromosome arm (e.g.,
"8p"
,"3q"
) or a list of chromosome arms (e.g.,c("3q", "8p", "17p")
) to force into the analysis.- genesToForce
A list of genes to force into the analysis (e.g.
c("FOXP3","MUC16","SAMD15")
).- regionToForce
Chromosome region to force into the analysis (vector containing chr, start, end).
- getCNVPerChromosomeArm
If
TRUE
, will save the CNV per chromosome arm into the metadata.- getCNVClusters
If
TRUE
, will perform clustering on the CNV scores and save them in the metadata of the Seurat object ascnv_clusters
.- tumorLabel
The label within
referenceVar
that specifies the tumor/malignant population (can be any type of annotation).- k_clusters
Optional. Number of clusters to cut the dendrogram into. If
NULL
, the optimal number of clusters is determined automatically using the elbow method.- h_clusters
Optional. The height at which to cut the dendrogram for clustering. If both
k
andh
are provided,k
takes precedence.- plotDendrogram
Logical. Whether to plot the dendrogram (default =
FALSE
).- plotClustersOnDendrogram
Logical. Whether to highlight clusters on the dendrogram (default =
FALSE
).- plotElbowPlot
Logical. Whether to plot the elbow plot used for determining the optimal number of clusters (default =
FALSE
).- doPlot
If
TRUE
, will build a heatmap for each of the samples (default =TRUE
).- printPlot
If
TRUE
, the heatmap will be printed in the console (default =FALSE
, the plot will only be saved in a PDF).- savePath
Path to save the heatmap plot. If
NULL
, the plot won't be saved (default =.
).- outputType
Specifies the file format for saving the plot, either
"png"
or"pdf"
(default ="png"
).- clustersVar
The name of the metadata column containing cluster information (default =
"cnv_clusters"
).- splitPlotOnVar
The name of the metadata column to split the observations during the
plotCNVResults
step, if different fromreferenceVar
.- referencePalette
A color palette for
referenceVar
. You can provide a custom palette as a vector of color codes (e.g.,c("#FF0000", "#00FF00")
).- clusters_palette
A color palette for
clustersVar
. You can provide a custom palette as a vector of color codes (e.g.,c("#F8766D", "#A3A500", "#00BF7D")
).