:param transformer: The MutationTransformer that takes in the original sequence and applies the SNP mutations. Mutation structures will vary with each transformer. """ xf = transformer e = None try: sequences = xf.sequence_variants(original, mutations, combination_width, strand) except ReturnWithCaveats, e: rc = e sequences = e.return_value sequences = [seq for seq in sequences if seq.positive_strand_sequence != original.positive_strand_sequence] if original.strand == strand: sequences.insert(0, TransformedGenomeSequence.from_sequence(original)) else: sequences.insert(0, TransformedGenomeSequence.from_sequence(original.reverse_complement())) if e: raise ReturnWithCaveats(e.explanations, sequences) else: return sequences def find_in_sequence(fragment, sequence): regex = base_regexp_expand(fragment, overlap=True) return __find_in_sequence_regex(regex, sequence, overlapped=True) def __find_in_sequence_regex(regex, sequence, overlapped=True): seq_matches = []
def duplicate(cls, sequence, name=None): return TransformedGenomeSequence.from_sequence(sequence, name=name)