nucleic.sequence module¶
-
nucleic.sequence.
dna_kmers
(k: int = 3) → Generator[[str, None], None][source]¶ Return the cartesian product of all DNA substrings of length k.
Parameters: k – Length of of the DNA substring. Yields: Cartesian product of all DNA substrings of length k. Examples
>>> list(dna_kmers(1)) ['A', 'C', 'G', 'T'] >>> len(list(dna_kmers(3))) 64
-
nucleic.sequence.
hamming_circle
(string: str, n: int, alphabet: List[str]) → Generator[[str, None], None][source]¶ Find strings, of a given alphabet, with a distance of n away from a string.
Examples
>>> sorted(hamming_circle('abc', n=0, alphabet='abc')) ['abc'] >>> sorted(hamming_circle('abc', n=1, alphabet='abc')) ['aac', 'aba', 'abb', 'acc', 'bbc', 'cbc'] >>> sorted(hamming_circle('aaa', n=2, alphabet='ab')) ['abb', 'bab', 'bba']