Skip navigation links


General purpose Sequence storage in a relational database.

See: Description

Package Description

General purpose Sequence storage in a relational database.

This package is Deprecated!!

This package has been deprecated by the package which uses hibernate to persist objects to biosql and maintain transaction control. We strongly recommend you use that package.


BioSQL is a general-purpose relational database schema for the storage of biological sequence data and annotation. It evolved from the bioperl-db system.

Using BioSQL

To use BioSQL, you will need:

You will need to create a new database and all the tables specified in the schema file. For example (for PostgreSQL users):
    createdb thomasd_biosql
    psql thomasd_biosql -f biosqldb-schema-pg.sql
When accessing the database from Java programs, you will need to: For example:
    export CLASSPATH=biojava.jar:xerces.jar:bytecode.jar:pgjdbc2.jar
    java -Djdbc.drivers=org.postgresql.Driver demos.MyProgram
You should now be able to connect to the database by simply constructing a new BioSQLSequenceDB object, passing your database connection details to the constructor.

Each physical BioSQL database may contain multiple namespaces (sometimes called biodatabases). In BioJava, each SequenceDB only reflects a single namespace.

Working with BioSQL sequences

The BioJava-BioSQL objects are transparently persistent. This means that you don't need to do anything special to write data back to the database, and that any changes you make to BioSQL sequences will be immediately reflected in the database. If you don't want this to happen, consider using a ViewSequence.

It is possible to completely remove sequences (and all their annotation) from the database. However, an exception will be thrown if any references still exist to that sequence. The following code will fail:

    SequenceDB seqDB = new BioSQLSequenceDB(...);
    Sequence seq = seqDB.getSequence("AL121903");
    // do things with sequence
If, however, the variable seq is set to null before calling removeSequence, the call will succeed.


In general, the behaviour of BioSQL sequences and features is very similar to that of the standard in-memory interfaces. However, the current version has a few limitations:

Skip navigation links

Copyright © 2020 BioJava. All rights reserved.