mkt.databases.pssm.henikoff_weights

mkt.databases.pssm.henikoff_weights(sequences: list[str], gap_chars: str = '-X') ndarray[source]

Henikoff & Henikoff (1994) position-based sequence weights.

Down-weights redundant (near-duplicate) sequences so a few over-represented subfamilies do not dominate a column’s composition – the standard correction for phylogenetic non-independence in a large MSA. Each sequence’s weight is sum_columns 1 / (k_col * n_{col, residue}) over its non-gap positions, where k_col is the number of distinct residue types in the column and n_{col, residue} the count of this sequence’s residue there. Returned unnormalized (the scale cancels in any weighted frequency).

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

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

Returns:

Length-len(sequences) array of unnormalized sequence weights.

Return type:

np.ndarray