BioSQL.Loader module

Load biopython objects into a BioSQL database for persistent storage.

This code makes it possible to store biopython objects in a relational database and then retrieve them back. You shouldn’t use any of the classes in this module directly. Rather, call the load() method on a database object.

class BioSQL.Loader.DatabaseLoader(adaptor, dbid, fetch_NCBI_taxonomy=False)

Bases: object

Object used to load SeqRecord objects into a BioSQL database.

__init__(adaptor, dbid, fetch_NCBI_taxonomy=False)

Initialize with connection information for the database.

Creating a DatabaseLoader object is normally handled via the BioSeqDatabase DBServer object, for example:

from BioSQL import BioSeqDatabase
server = BioSeqDatabase.open_database(driver="MySQLdb",
                                      user="gbrowse",
                                      passwd="biosql",
                                      host="localhost",
                                      db="test_biosql")
try:
    db = server["test"]
except KeyError:
    db = server.new_database("test",
    description="For testing GBrowse")
load_seqrecord(record)

Load a Biopython SeqRecord into the database.

class BioSQL.Loader.DatabaseRemover(adaptor, dbid)

Bases: object

Complement the Loader functionality by fully removing a database.

This probably isn’t really useful for normal purposes, since you can just do a:

DROP DATABASE db_name

and then recreate the database. But, it’s really useful for testing purposes.

__init__(adaptor, dbid)

Initialize with a database id and adaptor connection.

remove()

Remove everything related to the given database id.