biotite.sequence.find_subsequence

biotite.sequence.find_subsequence(sequence, query)[source]

Find a subsequence in a sequence.

Parameters
sequenceSequence

The sequence to find the subsequence in.

querySequence

The potential subsequence. Its alphabet must extend the sequence alphabet.

Returns
match_indicesndarray

The starting indices in sequence, where query has been found. The array is empty if no match has been found.

Raises
ValueError

If the query alphabet does not extend the sequence alphabet.

Examples

>>> main_seq = NucleotideSequence("ACTGAATGA")
>>> sub_seq = NucleotideSequence("TGA")
>>> print(find_subsequence(main_seq, sub_seq))
[2 6]