Repository navigation
Malignant Classification Logic
The algorithm to identify malignant cells begins by identifying hotspot chromosome arms by sample from the chromosome-arm-level CNV matrix (cells x chr. arms). These hotspot arms are used to define malignant and normal reference cells, which are later used to calculate the malignancy scores.
Hotspot arms are defined as chromosome arms deviating by more than 3 median absolute deviations (MADs) from the reference (normal) group for gains and 2 MADs for losses.
Left plot shows the CNV heatmap with signal smoothed by chromosome arms. On the right, a boxplot comparing CNV values by reference and query groups, where hotspot chromosome arms are highlighted in bold.
Taking only the hotspot chromosome arms, a set of "canonical" malignant and normal reference cells is defined. This is done by calculating a total CNV burden for each cell by taking the absolute value of the CNV values across the selected hotspot arms. Absolute values ensure that both copy-number gains and losses contribute positively. Reference cells are selected if they are above or below the 95th or 5th percentile respectively. For clarity, these cells are selected from the CNV matrix and are not related to the reference and query group from SwiftCNV. Using the selected canonical cells, malignant and normal reference signatures are created by averaging the CNV values across cells.
To identify malignant cells, three independent scores are calculated to generate a CNV-based classification.
- Weighted correlation score
- Distance to centroids
- KNN cosine distance
To calculate the weighted correlation score, the value of each chromosome arm in the malignant reference signature is used as the weight in the Pearson correlation.
Malignant reference signature used for weighted Pearson correlation. At the end every cell gets a correlation score.
For the normal and malignant reference cells, a centroid is calculated by averaging CNV values across the hotspot arms matrix. A distance is obtained by substracting the reference values to the query. However, if the distance of a cell in a chr arm exceeds the reference value, it is set to 0. A total distance value for each cell is obtained by adding up all the values from each chr arm.
Distance to centroids calculation. Malginant and normal centroids (left). For each cell (lightblue), the clipped distaance to each centroid is calculated (right).
To get a scaled score between 0 and 1, a distance ratio is calculated for each cell by dividing the distance to the normal centroid by the total distance, as shown in the formula below:
To calculate the cosine distance score, a PCA is performed on the chromosome-arm-level matrix, and the average cosine distance to the k nearest malignant and normal reference cells is calculated.
Similarly as before, a scaled score is obtained:
To generate a preliminary malignant cell classification, a threshold is determined for each score distribution using a cutoff-finder algorithm with a specified strictness value. Cells that have a high correlation score (above the threshold) and high distance ratio will be defined as high confidence malignant cells. A cell will be classified as malignant-like if it has high distance ratio and cosine distance scores but low correlation. Moreover, if the cell has high correlation but low values in the other 2 scores it will also be classified as malignant-like.
The preliminary classification is further refined using a k-nearest neighbors (KNN) algorithm. The rationale behind is that, due to transcriptional heterogeneity, tumor cells will form separate clusters from normal cells. By looking at the CNV classification of a cell's neighbors, the algorithm determines the KNN-based classification as malignant or normal.