Ejemplo n.º 1
0
def test_find_symbol():
    string = "ATACGCTTGCT"
    symbol = "T"
    dna = seq.NucleotideSequence(string)
    assert list(seq.find_symbol(dna, symbol)) == [1,6,7,10]
    assert seq.find_symbol_first(dna, symbol) == 1
    assert seq.find_symbol_last(dna, symbol) == 10
Ejemplo n.º 2
0
#
# Alternatively, a sequence can also be loaded from GenBank or GenPept
# files, using the :class:`GenBankFile` class (more on this later).
#
# Sequence search
# ---------------
#
# A sequence can be searched for the position of a subsequence or a
# specific symbol:

import biotite.sequence as seq

main_seq = seq.NucleotideSequence("ACCGTATCAAGTATTG")
sub_seq = seq.NucleotideSequence("TAT")
print("Occurences of 'TAT':", seq.find_subsequence(main_seq, sub_seq))
print("Occurences of 'C':", seq.find_symbol(main_seq, "C"))

########################################################################
# Sequence alignments
# -------------------
#
# .. currentmodule:: biotite.sequence.align
#
# When comparing two (or more) sequences, usually an alignment needs
# to be performed. Two kinds of algorithms need to be distinguished
# here:
# Heuristic algorithms do not guarantee to yield the optimal alignment,
# but instead they are very fast. On the other hand, there are
# algorithms that calculate the optimal (maximum similarity score)
# alignment, but are quite slow.
#