Schematic representation of the KNFP encoding scheme. We consider a tumor bulk split into spatial compartments based on cell proximity to a central reference point. The expression profiles of cells within each compartment are then averaged to obtain a single gene expression signature per compartment. The expression fold-change is subsequently calculated against the average gene expression of all cells within the tumor bulk. The resulting gene expression matrix is then encoded based on whether the fold change is significantly increased, significantly decreased, or not significant in the compartment, relative to the tumor bulk. This results in the KNFP representation which is a spatially resolved, discrete representation of gene expression across the tumor bulk.