skbio.sequence.DNA.find_motifs¶
- DNA.find_motifs(motif_type, min_length=1, ignore=None)[source]¶
Search the biological sequence for motifs.
Options for motif_type:
- ‘purine-run’
Identifies purine runs
- ‘pyrimidine-run’
Identifies pyrimidine runs
- Parameters
- Yields
slice – Location of the motif in the biological sequence.
- Raises
ValueError – If an unknown motif_type is specified.
Examples
>>> from skbio import DNA >>> s = DNA('ACGGGGAGGCGGAG') >>> for motif_slice in s.find_motifs('purine-run', min_length=2): ... motif_slice ... str(s[motif_slice]) slice(2, 9, None) 'GGGGAGG' slice(10, 14, None) 'GGAG'
Gap characters can disrupt motifs:
>>> s = DNA('GG-GG') >>> for motif_slice in s.find_motifs('purine-run'): ... motif_slice slice(0, 2, None) slice(3, 5, None)
Gaps can be ignored by passing the gap boolean vector to ignore:
>>> s = DNA('GG-GG') >>> for motif_slice in s.find_motifs('purine-run', ignore=s.gaps()): ... motif_slice slice(0, 5, None)