Infer CNAs and plot a heatmap

Infer cells’ CNA profiles with infercna()

Ordering cells in cnaPlot()

In cases where you can see the subclones in the heatmap but don’t yet have the subclone assignments to direct the cell clustering, you can instead give a set of chromosome and chromosome arms that you would like the clustering to use. In the example above, we probably want the cells belonging to the presumed subclones (chromosome 2, chromosome arm 4p, etc) to be grouped together. We can specify this using the order.with argument in infercna::cnaPlot:

Find malignant cells

In the above section, we filtered out the infercna::refCells that we know are normal prior to looking at the CNA heatmap. In reality, our reference normal cells will only comprise a subset of all normal cells in the data, and we will need to identify the remaining ones to exclude them from downstream analyses concerning the malignant cells only.

infercna defines two parameters, infercna::cnaCor and infercna::cnaSignal that quantify the extent of copy-number aberrations in individual cells and thus help to separate the malignant and non-malignant subsets.

Compute cnaSignal() and cnaCor()

cnaSignal()

CNA signal reflects the overall extent of CNAs. It’s defined as the mean of the squares of CNA values across the genome and should therefore accentuate genome-wide differences in CNA profiles between malignant and non-malignant cells.

cnaCor()

CNA corrleation refers to the correlation between the CNA profile of each cell and the average CNA profile of all cells. Best results are seen when correlating cells to the average CNA profile of cells from the corresponding tumour and, if possible, excluding from the average those already classified as non-malignant.

Visualise CNA Signal and Correlation with cnaScatterPlot()

Plotting cnaCor against cnaSignal for all cells is a good first approximation to the malignant and non-malignant groups. infercna::cnaScatterPlot simply integrates these two function calls and their respective parameters into one function, and plots the results.

Let’s quickly go over the note-worthy arguments:

  • <threshold> : of which genes to include in calculation; it determines what fraction of genes with top CNA signal to keep.
  • <cor.threshold> : inherits from <threshold>; can be supplied if the threshold intended is specific to infercna::cnaCor calculation.
  • <signal.threshold> : inherits from <threshold>; can be supplied if the threshold intended is specific to infercna::cnaSignal calculation.
  • <samples> : used to determine tumour-specific CNA profiles; can be one of:
    • names of tumour samples (unique)
    • vector of tumour samples of length equal to the number of columns and ordered correspondingly.
  • <excludeFromAvg> : names of the (normal) cells to be excluded from the average CNA profile(s).
cnaScatterPlot(cna = cna, signal.threshold = NULL, main = 'Default')

cnaScatterPlot(cna = cna, signal.threshold = 0.5, main = 'threshold: 0.5')

cnaScatterPlot(cna = cna, signal.threshold = 0.7, main = 'threshold: 0.7')

cnaScatterPlot(cna = cna, signal.threshold = 0.9, main = 'threshold: 0.9')

cnaScatterPlot(cna = cna, signal.threshold = 0.9, main = 'Default (signal.threshold = 0.9)')

cnaScatterPlot(cna = cna, threshold = 0.9, main = 'threshold: 0.9')

cnaScatterPlot(cna = cna, threshold = 0.9, samples = 'MGH125', excludeFromAvg = unlist(refCells), main = "threshold: 0.9, samples:'MGH125', excludeFromAvg")
cnaScatterPlot(cna = cna, threshold = 0.9, samples = 'MGH125', excludeFromAvg = unlist(refCells), main = "threshold: 0.9, samples:'MGH125', excludeFromAvg", group = unlist(refCells))

threshold finds top genes with cnaHotspotGenes()

When the <threshold> argument is set (to a value between 0 and 1) as above, infercna::cnaHotspotGenes() is called, and does two things:

  1. Compute CNA signal values for each gene

  2. Return genes with values of CNA signal in the top nth quantile

    • where n is the value in threshold

Find malignant cells with findMalignant()

infercna::findMalignant() provides a first attempt at identifying malignant (and non-malignant) cells in the data. It fits bimodal distributions to the cells’ cnaSignal() and cnaCor() values, respectively. If two modes are found for each parameter, these are cross-checked and – if compatible –, joined and returned. If any of these steps fail, the return value is FALSE.

Modes = findMalignant(cna, signal.threshold = .9, samples = 'MGH125')
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Found after 121 tries
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Success!
#> Found after 166 tries
#> removing 8 cells that were found in both modes

Find genetic subclones

out[[3]] = fitBimodal(L[[3]], assign = T, bySampling = T, nsamp = 300)
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Success!
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Success!
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Success!
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Success!
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Success!
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Success!
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Success!
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Success!
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Success!
#> Success!
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> At least one mode contains < 10 obs.
#> Success!
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Success!
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> At least one mode contains < 10 obs.
#> Success!
#> At least one mode contains < 10 obs.
#> Less than 80% of obs. could be assigned to a mode.
#> At least one mode contains < 10 obs.
#> Success!