Package org.biojava.bio.seq.db.biosql
This package is Deprecated!!
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.
Introduction
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:
- A DBMS server (currently, PostgreSQL and MySQL are supported)
- A JDBC driver for connecting to that database (if in doubt, contact your database vendor)
- A BioSQL schema file, suitable for your database. Currently, these can be downloaded here
createdb thomasd_biosql psql thomasd_biosql -f biosqldb-schema-pg.sqlWhen accessing the database from Java programs, you will need to:
- Add the JDBC driver .jar file to your CLASSPATH
- Set the
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.MyProgramYou 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 seqDB.removeSequence("AL121903");If, however, the variable
seq
is set to null
before calling removeSequence
, the call will succeed.
Limitations
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:
- Only
Feature
andStrandedFeature
are currently supported. Other sub-interfaces ofFeature
are silently converted to one of these basic types. - Objects and binary data stored in
Annotation
bundles of sequences and feature may be lost -- only Strings and Collections of strings are safe (this may be fixed in the future) - Currently, only the MySQL amd PostgreSQL databases are supported. Porting to other databases should, however, be quite easy.
-
Class Summary Class Description BioSQLSequenceDB Deprecated. Use hibernate and org.biojavax.bio.dbBioSQLSequenceDBProvider Deprecated. Use hibernate and org.biojavax.bio.dbDBHelper Deprecated. Use hibernate and org.biojavax.bio.dbDBHelper.BioSequenceStyle DBHelper.DeleteStyle DBHelper.JoinStyle HypersonicDBHelper Deprecated. Use hibernate and org.biojavax.bio.dbMySQLDBHelper Deprecated. Use hibernate and org.biojavax.bio.dbOracleDBHelper Deprecated. Use hibernate and org.biojavax.bio.dbPostgreSQLDBHelper TaxonSQL Deprecated. Use hibernate and org.biojavax.bio.dbUnknownDBHelper Deprecated. Use hibernate and org.biojavax.bio.db