skbio.sequence.DNASequence.regex_iter

DNASequence.regex_iter(regex, retrieve_group_0=False)[source]

Find patterns specified by regular expression

Parameters:

regex : SRE_Pattern

A compiled regular expression (e.g., from re.compile) with finditer method

retrieve_group_0 : bool, optional

Defaults to False. If True, group(0) will be included in each list of tuples, which represents the shortest possible substring of the full sequence that contains all the other groups

Returns:

generator

yields lists of 3-tuples. Each 3-tuple represents a group from the matched regular expression, and contains the start of the hit, the end of the hit, and the substring that was hit