bioin.motif.random_motifs¶
-
bioin.motif.random_motifs(dna, k, t)[source]¶ Return a list of random k-mers from each of t different strings dna.
Parameters: - dna (list) – matrix, has t rows.
- k (int) – k-mer.
- t (int) – t is the number of k-mers in dna to return, also equal to the row number of dna 2D matrix.
Returns: List, a list of t k-mers strings, each k-mer from each of t different strings dna.
Examples
RandomMotifs(Dna, k, t) that uses random.randint to choose a random k-mer from each of t different strings Dna, and returns a list of t strings.
>>> dna = ['TTACCTTAAC', 'GATGTCTGTC', 'ACGGCGTTAG', 'CCCTAACGAG', 'CGTCAGAGGT'] >>> k = 3 >>> t = 5 >>> random_t_kmers = random_motifs(dna, k, t) >>> random_t_kmers ['TTA', 'GTC', 'ACG', 'ACG', 'GAG']