bioin.motif.profile_generated_string¶
-
bioin.motif.profile_generated_string(text, motif_profile, k)[source]¶ Return a randomly generated k-mer from Text whose probabilities are generated from profile.
Parameters: - text (string) – string dna.
- motif_profile (dict) – a profile matrix
- k (int) – length of the k-mer
Returns: String, a randomly chosen k-mer key with respect to the values in Probabilities.
Examples
Assemble this code into a function ProfileGeneratedString(Text, profile, k) that takes a string Text, a profile matrix profile , and an integer k as input. It should then return a randomly generated k-mer from Text whose probabilities are generated from profile, as described above.
>>> text = 'AAACCCAAACCC' >>> motif_profile = {'A': [0.5, 0.1], 'C': [0.3, 0.2], 'G': [0.2, 0.4], 'T': [0.0, 0.3]} >>> k = 2 >>> kmers = profile_generated_string(text, motif_profile, k) >>> kmers 'AC'