This package has been deprecated by the package org.biojavax.bio.db.biosql 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.
To use BioSQL, you will need:
createdb thomasd_biosql
psql thomasd_biosql -f biosqldb-schema-pg.sql
When accessing the database from Java programs, you will need to:
jdbc.drivers system property to the class
name of the driver (if in doubt, contact your database vendor).
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.
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
seqDB.removeSequence("AL121903");
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:
Feature and StrandedFeature are
currently supported. Other sub-interfaces of Feature are
silently converted to one of these basic types.Annotation
bundles of sequences and feature may be lost -- only Strings and
Collections of strings are safe (this may be fixed in the future)