Perform CNV Clustering with Seurat Object
CNVcluster.Rd
The CNVcluster
function performs hierarchical clustering on a genomic score matrix extracted from a Seurat object.
It provides options for plotting a dendrogram, an elbow plot for optimal cluster determination,
and cluster visualization on the dendrogram. The resulting cluster assignments are stored in the Seurat object.
Usage
CNVcluster(
seuratObj,
referenceVar = NULL,
tumorLabel = NULL,
k = NULL,
h = NULL,
plotDendrogram = F,
plotClustersOnDendrogram = F,
plotElbowPlot = F
)
Arguments
- seuratObj
A Seurat object containing a "genomicScores" assay with a matrix of genomic scores for clustering.
- referenceVar
The name of the metadata column in the Seurat object containing reference annotations.
- tumorLabel
The label within
referenceVar
that specifies the tumor/malignant population (can be any type of annotation).- k
Optional. The number of clusters to cut the dendrogram into. If
NULL
, the optimal number of clusters is determined automatically using the elbow method.- h
Optional. The height at which to cut the dendrogram for clustering. If both
k
andh
are provided,k
takes precedence.- plotDendrogram
Logical. If
TRUE
, plots the dendrogram. Defaults toFALSE
.- plotClustersOnDendrogram
Logical. If
TRUE
, highlights the clusters on the dendrogram. Defaults toFALSE
.- plotElbowPlot
Logical. If
TRUE
, plots the elbow plot used for determining the optimal number of clusters. Defaults toFALSE
.
Value
A Seurat object with an additional metadata column, cnv_clusters
, containing the cluster assignments.
Details
The function computes a Manhattan distance matrix and performs hierarchical clustering using the Ward.D2 method.
If k
is not provided, the elbow method is applied to determine the optimal number of clusters based on the within-cluster sum of squares (WSS).
The clusters are assigned to the Seurat object under the metadata column cnv_clusters
.