Exemplo n.º 1
0
def test_multi_file():
    multi_file = gb.MultiFile.read(join(data_dir("sequence"), "multifile.gp"))
    accessions = [gb.get_accession(f) for f in multi_file]
    assert accessions == ["1L2Y_A", "3O5R_A", "5UGO_A"]
Exemplo n.º 2
0
# Similar to the other file classes we have encountered, a
# :class:`GenBankFile` provides a low-level interface.
# In contrast, the :mod:`biotite.sequence.io.genbank` module contains
# high-level functions to directly obtain useful objects from a
# :class:`GenBankFile` object.

import biotite.sequence.io.genbank as gb

file_path = entrez.fetch("AJ311647",
                         biotite.temp_dir(),
                         suffix="gb",
                         db_name="nuccore",
                         ret_type="gb")
file = gb.GenBankFile()
file.read(file_path)
print("Accession:", gb.get_accession(file))
print("Definition:", gb.get_definition(file))

########################################################################
#
# .. currentmodule:: biotite.sequence
#
# Now that we have loaded the file, we want to have a look at the
# sequence features.
# Therefore, we grab the annotation from the file.
# An annotation is the collection of features corresponding to one
# sequence (the sequence itself is not included, though).
# In case of *Biotite* we can get an :class:`Annotation` object from the
# :class:`GenBankFile`.
# This :class:`Annotation` can be iterated in order to obtain single
# :class:`Feature` objects.