8 Merging CopyKit Objects
CopyKit objects can be merged into one object with the cbind()
function.
Example:
# gain of chromosome 7 and deletion of chromosome 10
<- mock_bincounts(
ck1 ncells = 50,
ncells_diploid = 0,
position_gain = 4900:5493,
position_del = 6523:7056,
genome = "hg38",
resolution = "220kb"
)
## Running variance stabilization transformation: ft
## Smoothing outlier bins.
## Running segmentation algorithm: CBS for genome hg38
## Merging levels.
## Done.
# adding an identifier to colData
colData(ck1)$info <- 'object1'
# gain of chromosome 7 and deletion of chromosome 10
# additional gain of chromosome 1
<- mock_bincounts(
ck2 ncells = 50,
ncells_diploid = 0,
position_gain = c(1:906, 4900:5493),
position_del = 6523:7056,
genome = "hg38",
resolution = "220kb"
)
## Running variance stabilization transformation: ft
## Smoothing outlier bins.
## Running segmentation algorithm: CBS for genome hg38
## Merging levels.
## Done.
# adding an identifier to colData
colData(ck2)$info <- 'object2'
# merging objects
<- cbind(ck1, ck2) merged_copykit
Following merge a standard CopyKit analysis can be applied
# UMAP and clustering
<- runUmap(merged_copykit) merged_copykit
## Using assay: logr
## Embedding data with UMAP. Using seed 17
## Warning in .check_reddim_names(x, value, withDimnames): non-NULL 'rownames(value)' should be the same as
## 'colnames(x)' for 'reducedDim<-'. This will be an
## error in the next release of Bioconductor.
## Access reduced dimensions slot with: reducedDim(scCNA, 'umap').
## Done.
<- findSuggestedK(merged_copykit) merged_copykit
## Calculating jaccard similarity for k range: 10
##
## Suggested k = 10 with median jaccard similarity of: 1
<- findClusters(merged_copykit) merged_copykit
## Using suggested k_subclones = 10
## Finding clusters, using method: hdbscan
## Found 2 subclones.
## Done.
plotUmap(merged_copykit, label = 'subclones')
## Plotting Umap.
## Coloring by: subclones.
# plotting
plotHeatmap(merged_copykit, label = 'info', order_cells = 'hclust')
## Ordering cells by:hclust
## No distance matrix detected in the scCNA object.
## Calculating distance matrix with metric: euclidean
## Using 1 cores.
## Access distance matrix with copykit::distMat()
## Done.
## Plotting Heatmap.