Skip to main content
Concrete omics preprocessing transforms.

Log1pTransform

Element-wise log(1 + x) ↔ expm1(x). Entries equal to NON_MEASURED_GENE (the missing-gene sentinel) are preserved verbatim rather than transformed, since log1p(-1) = -inf. The model is trained to receive the sentinel unchanged in its input space, so it must survive the transform.

process

Applies element-wise log1p, preserving the missing-gene sentinel. Entries equal to NON_MEASURED_GENE are left unchanged; all other entries are log1p-transformed.
Input counts array.
Returns: Log1p-transformed array with sentinels preserved.

reverse

Applies element-wise expm1 (inverse of log1p). Entries equal to NON_MEASURED_GENE are preserved unchanged so the transform remains a true inverse of process.
Log1p-transformed array.
Returns: Array in original counts space.

Expm1Transform

Element-wise expm1(x) ↔ log1p(x). Inverse of Log1pTransform. Useful as a standalone post-processor to convert log1p-space model output back to raw counts.

process

Applies element-wise expm1.
Log-space array.
Returns: Array in counts space.

reverse

Applies element-wise log1p (inverse of expm1).
Counts-space array.
Returns: Log1p-transformed array.

TPMNormaliser

Transcripts Per Million normalisation (row-wise). Forward: counts → (counts / row_sum) * 1e6 Not reversible without storing original totals. Entries equal to NON_MEASURED_GENE (the missing-gene sentinel) are excluded from the row total and preserved verbatim in the output, so a partially or fully unmeasured sample is not scaled by a meaningless negative sum and the sentinel survives for downstream transforms.

process

Normalises each row to sum to factor (default 1e6). All-zero rows remain all zeros (division is skipped). Entries equal to NON_MEASURED_GENE are excluded from the row sum and left unchanged in the output.
Raw counts array.
Returns: TPM-normalised array with missing-gene sentinels preserved.

ZScoreNormaliser

Gene-wise z-score normalisation. Forward: (x - mean) / std Reverse: x * std + mean

process

Applies gene-wise z-score normalisation.
Raw expression array.
Returns: Z-scored array.

reverse

Reverses z-score normalisation to recover original scale.
Z-scored array.
Returns: Array in original expression scale.

SubsetColumns

Selects and reorders columns by index. Not reversible (information is discarded).

process

Selects columns at the stored indices.
Input array with columns to subset.
Returns: Array with only the selected columns. Raises:
  • ValueError - If any index is out of range for the matrix’s last-axis size.