For each column (eigenvector) of a gene-by-eigenvector matrix, z-transforms the loadings (using median/MAD for robustness) and applies locfdr to identify significantly loaded genes. Returns a binary indicator matrix.

SelectSignificantGenes(V, lfdr_thresh = 0.2, min_genes = 3, max_genes = 50)

Arguments

V

A numeric matrix with genes as rows and eigenvectors as columns. Row names should be gene names.

lfdr_thresh

Numeric. Local FDR threshold for significance. Default is 0.2. Automatically capped at the empirical FDR of the first bin.

min_genes

Integer. Minimum number of significant genes required in a direction (positive or negative) to retain them. Default is 3.

max_genes

Integer. Maximum number of significant genes to keep per direction per eigenvector. Default is 50.

Value

A binary matrix of the same dimensions as V (genes × eigenvectors), where 1 indicates the gene is significantly loaded on that eigenvector.

Examples

if (FALSE) {
gene_indicator <- SelectSignificantGenes(V, lfdr_thresh = 0.2)
}