mkt.databases.pssm.column_counts

mkt.databases.pssm.column_counts(sequences: list[str], gap_chars: str = '-X', weights: list[float] | None = None) ndarray[source]

Per-column (weighted) residue counts for a set of aligned sequences.

The counts primitive underlying background-relative scoring: builds one length-20 count vector per alignment column (in STR_AA20 order) from any subset of aligned sequences, without instantiating a stateful analyzer. Gap/unknown characters in gap_chars (and any residue outside STR_AA20) are excluded. Optional per-sequence weights (e.g. henikoff_weights()) generalize the raw counts to weighted counts; None reproduces the unweighted counts.

Parameters:
  • sequences (list[str]) – Aligned sequence strings of equal length.

  • gap_chars (str) – Characters treated as gap/unknown and excluded (default: STR_GAP_CHARS).

  • weights (list[float] | None) – Optional per-sequence weights (same length as sequences); None weights every sequence equally (default: None).

Returns:

(n_columns, 20) array of (weighted) residue counts in STR_AA20 order.

Return type:

np.ndarray