def find_in_sequences(fragment, sequences): """ Find the position of the fragment in the specified sequences. @param the fragment (sequence of base pairs) @param sequences SimpleGenomeSequence[] """ regex = base_regexp_expand(fragment, overlap=True) matches = [] for seq in sequences: seq_matches = __find_in_sequence_regex(regex, seq, overlapped=True) if seq_matches: matches.append((seq, seq_matches)) return matches
def find_in_sequence_map(fragment, sequences): """ Like find_in_sequences, but returns only the matches themselves, essentially a mapping operation. Returns empty lists for a sequence slot if there are no matches. The length of the return value should always equal the length of the sequence array; this is a shortcut to [find_in_sequence(fragment, sequence) for sequence in sequences] """ regex = base_regexp_expand(fragment, overlap=True) return_list = [] for seq in sequences: return_list.append(__find_in_sequence_regex(regex, seq, overlapped=True)) return return_list
def find_in_sequence(fragment, sequence): regex = base_regexp_expand(fragment, overlap=True) return __find_in_sequence_regex(regex, sequence, overlapped=True)