mkt.databases.pssm.consurf_grades
- mkt.databases.pssm.consurf_grades(scores: list[float | None], n_bins: int = 9, bool_ascending: bool = True) list[int | None][source]
Assign ConSurf-style discrete conservation grades to continuous scores.
Bins the finite scores into
n_binsequal-frequency (quantile) grades – the scheme ConSurf uses to turn a continuous conservation score into a small ordinal scale. Withbool_ascending(higher score = more conserved, e.g. information content or percent identity) the most-conserved bin is graden_binsand the most-variable is grade 1; passbool_ascending=Falsefor rate-type scores where lower = more conserved (e.g. Rate4Site). Graden_binsis always the most conserved end regardless.- Parameters:
scores (list[float | None]) – Per-position conservation scores;
None/NaN entries get gradeNone.n_bins (int) – Number of grades (default 9, the ConSurf convention).
bool_ascending (bool) – Whether a higher score means more conserved (default True).
- Returns:
One grade in
1..n_binsper input score (Nonewhere the score was missing).- Return type:
list[int | None]