3 Quick-Start

This section provides a basic CopyKit workflow.

# Load library
library(copykit)

# Run pre-processing module
tumor <- runVarbin("/path/to/marked/bam/files/",
                 remove_Y = TRUE)

# Mark euploid cells if they exist
tumor <- findAneuploidCells(tumor)

# Mark low-quality cells for filtering
tumor <- findOutliers(tumor)

# Visualize cells labeled by filter and aneuploid status
plotHeatmap(tumor, label = c('outlier', 'is_aneuploid'), row_split = 'outlier')

# Remove cells marked as low-quality and/or aneuploid from the copykit object
tumor <- tumor[,SummarizedExperiment::colData(tumor)$outlier == FALSE]
tumor <- tumor[,SummarizedExperiment::colData(tumor)$is_aneuploid == TRUE]

# kNN smooth profiles
tumor <- knnSmooth(tumor)

# Create a umap embedding 
tumor <- runUmap(tumor)

# Search for the K value that maximizes jaccard similarity for clustering of subclones 
# Plot the results
# This step is optional. A fixed K value can be provided later to findClusters()
tumor <- findSuggestedK(tumor)
plotSuggestedK(tumor)

# Find clusters of similar copy number profiles and plot the results
# If no k_subclones value is provided, automatically detect it from findSuggestedK()
tumor  <- findClusters(tumor)
plotUmap(tumor, label = 'subclones')

# Calculate consensus profiles for each subclone, 
# and order cells by cluster for visualization with plotHeatmap
tumor <- calcConsensus(tumor)
tumor <- runConsensusPhylo(tumor)

# Plot a copy number heatmap with clustering annotation
plotHeatmap(tumor, label = 'subclones')

The following sections explain all functions in detail.