Skip to content

Transform

Track → Track pure functions. Thirteen functions in four families, all with the same contract: take a Track, return a new Track with modified scores.

No protocols, no isinstance. Every function calls Track primitives (map_scores, filter_entries, with_scores). This means they work on any Track implementation — IntervalTrack, TableTrack, or the output of bin_summarize.

Families

Family Functions When to use
Missing fill_missing, replace_zeros, drop_missing, drop_zeros Clean up NaN/zero scores before analysis
Scale add_pseudocount, log_transform, clamp, normalize, standardize, rank Normalize or rescale scores for comparison
Threshold binarize, filter_by_score Convert to presence/absence or filter by cutoff
Bin bin_summarize Convert SignalTrack to IntervalTrack in fixed-size bins

Example

from seqchain.transform import add_pseudocount, log_transform, normalize

# Chain: pseudocount → log2 → CPM normalize
result = normalize(
    log_transform(add_pseudocount(track, value=1.0), base=2),
    method="cpm",
)