troutpy.tl.quantify_overexpression#
- troutpy.tl.quantify_overexpression(sdata, codeword_key, control_codewords, gene_key='gene', layer='transcripts', copy=False)#
Quantify gene overexpression relative to a Poisson noise model derived from control codewords.
For each gene, computes the observed count, log fold-change over the noise baseline (mean control count), a one-sided Poisson survival-function p-value, and Benjamini–Hochberg FDR correction. Results are stored in
sdata["xrna_metadata"].var.- Parameters:
sdata (spatialdata.SpatialData) – SpatialData object containing a points layer with transcripts and an
"xrna_metadata"table (created if absent).codeword_key (str) – Column in the transcript points layer that holds the codeword category used to identify control probes.
control_codewords (list of str) – Codeword category values that identify control (noise) probes.
gene_key (str, optional) – Column in the transcript points layer containing gene identifiers. Defaults to
"gene".layer (str, optional) – Key in
sdata.pointsholding the transcript data. Defaults to"transcripts".copy (bool, optional) – If
True, return the updated SpatialData object; otherwise modify in place and returnNone. Defaults toFalse.
- Return type:
- Returns:
spatialdata.SpatialData or None Updated SpatialData with columns
"count","logfoldchange_over_noise","p_val_noise","is_control", and"fdr_noise"added tosdata["xrna_metadata"].varifcopy=True; otherwiseNone.