torchcell.sequence.mismatch_positions
- mismatch_positions(seq1: str, seq2: str) list[int][source]
Computes the positions at which two sequences differ.
This function takes two sequences, seq1 and seq2, represented as strings and returns a list of positions at which the two sequences have different characters. The sequences must be of the same length, else a ValueError is raised.
- Parameters:
- Returns:
A list containing the positions at which the two sequences differ. An empty list is returned if the sequences are identical.
- Return type:
- Raises:
ValueError – If the lengths of seq1 and seq2 are not equal.
Example
>>> mismatch_positions("ATGC", "ATCC") [2]