Understand the inferCNV computation steps
mainThe infercnvpy.tl.infercnv function implements a computationally efficient version of the inferCNV algorithm using numpy, scipy, and sparse matrices. The pipeline follows these steps:
- Log Fold Change Calculation: Subtracts reference gene expression from all cells. If multiple reference categories are provided via
reference_cat, the log fold change is 'bounded' to prevent false positives caused by cell-type specific expression (e.g., HLA or Immunoglobulin genes). - Clipping: Clips fold changes at
-lfc_capand+lfc_cap. - Genomic Smoothing: Smooths expression by genomic position using a running window of length
window_sizeand a stride ofstep. - Centering: Centers smoothed expression by subtracting the median of each cell.
- Noise Filtering: Sets values to 0 if they are less than
dynamic_threshold * STDDEV(whereSTDDEVis the standard deviation of the smoothed expression). - Median Filtering: Applies a final median filter to the result.