Package: wormtable
Wormtable is a write-once read-many table for large scale datasets.
It provides Python programmers with a simple and efficient method of
storing, processing and searching datasets of essentially unlimited
size. A wormtable consists of a set of rows, each of which contains
values belonging to a fixed number of columns. Rows are encoded
in a custom binary format, designed to be flexible, compact and
portable. Rows are stored in a data file, and the offsets and lengths
of these rows are stored in a Berkeley DB database
to support efficient random access.  Wormtable also
supports efficient searching and retrieval of rows with particular
values through the use of indexes, also based on Berkeley DB.The Variant Call Format (VCF) is supported directly by wormtable
through a command line conversion program, vcf2wt. There is also a
command line utility wtadmin to manage wormtables, including the ability to
dump values and add, remove and view indexes.If you use wormtable in your work, please cite the BMC Bioinformaticsarticle. See
theCITATION.txtfile for details.DocumentationFull documentation forwormtableis available athttp://pythonhosted.org/wormtable.InstallationQuick install for Debian/UbuntuIf you are running Debian or Ubuntu, this should get you up and running quickly:$ sudo apt-get install python-dev libdb-dev
$ sudo pip install wormtableFor Python 3, usepython3-devandpip3.General instructionsOnce Berkeley DB has been installed (see below) we can build thewormtablemodule using the
standard Pythonmethods. For
example, using pip we have$ sudo pip install wormtableOr, we can manually download the package, unpack it and then run:$ python setup.py build
$ sudo python setup.py installMost of the time this will compile and install the module without difficulty.It is also possible to download the latest development version ofwormtablefromgithub.Python 2.6/3.1Wormtable requires theargparsepackage, which was introduced to the
standard library for version 3.2 (it is also included in 2.7). For users
of older Python versions, theargparsemodule must be installed for
the command line utilities to work:$ sudo pip install argparseThis is not necessary for recent versions of Python.Installing Berkeley DBWormtable requires Berkeley DB (version 4.8 or later),
which is available for all major platforms.LinuxInstalling Berkeley DB is very easy on Linux distributions.On Debian/Ubuntu use:$ sudo apt-get install libdb-devand on Red Hat/Fedora use:# yum install libdb-develOther distributions and package managers should provide a similarly easy
option to install the DB development files.Mac OS XBerkeley DB can be installed from source on a mac, viamacportsorhomebrew.For MacPorts, to install e.g. v5.3$ sudo port install db53Then, to build/install wormtable, we need to set the CFLAGS and LDFLAGS environment
variables to use the headers and libraries in /opt:$ CFLAGS=-I/opt/local/include/db53 LDFLAGS=-L/opt/local/lib/db53/ python setup.py build
$ sudo python setup.py installFor Homebrew, get the current Berkeley DB version and again build wormtable
after setting CFLAGS and LDFLAGS appropriately:$ brew install berkeley-db
$ CFLAGS=-I/usr/local/Cellar/berkeley-db/5.3.21/include/ LDFLAGS=-I/usr/local/Cellar/berkeley-db/5.3.21/lib/ python setup.py build
$ sudo python setup.py installFor more details of Berkely DB versions, see here:https://www.macports.org/ports.php?by=category&substr=databasesOther PlatformsOn platforms that Berkeley DB is not available as part of the native packaging
system (or DB was installed locally because of non-root access)
there can be issues with finding the correct headers and libraries
when compilingwormtable. For example,
if we add the DB 4.8 package on FreeBSD using:# pkg_add -r db48we get the following errors when we try to install wormtable:$ python setup.py build
... [Messages cut for brevity] ...
_wormtablemodule.c:3727: error: 'DB_NEXT_NODUP' undeclared (first use in this function)
_wormtablemodule.c:3733: error: 'DB_NOTFOUND' undeclared (first use in this function)
_wormtablemodule.c:3739: error: 'DistinctValueIterator' has no member named 'cursor'
_wormtablemodule.c:3739: error: 'DistinctValueIterator' has no member named 'cursor'
_wormtablemodule.c:3740: error: 'DistinctValueIterator' has no member named 'cursor'
error: command 'cc' failed with exit status 1This is because the compiler does not know where to find the headers and library
files for Berkeley DB.
To remedy this we must set theLDFLAGSandCFLAGSenvironment variables to
their correct values. Unfortunately there is no simple method to do this
and some knowledge of where your system keeps headers and libraries
is needed. To complete the installation for the FreeBSD example above,
we can do the following:$ CFLAGS=-I/usr/local/include/db48 LDFLAGS=-L/usr/local/lib/db48 python setup.py build
$ sudo python setup.py installInstallation without root accessIf you need to install wormtable on a system where Berkeley DB is not
installed (and your system administrator refuses to install it, for
some reason), we can still compile and install it locally.
Here is a recipe that worked on a Debian squeeze machine; however, this is not guaranteed
to work on any given system and you may need to tweak things a little to suit
your environment:$ mkdir -p $HOME/.local
$ wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
$ tar -zxf db-4.8.30.tar.gz
$ cd db-4.8.30/build_unix/
$ ../dist/configure --prefix=$HOME/.local
$ make installThis downloads a version of Berkeley DB from Oracle, compiles and
then installs it to the directory $HOME/.local. (The version of Berkeley DB
you use doesn’t really matter once it’s at least 4.8.)
Now, download
the latest version of wormtable, untar it andcdto the new directory.
We can then install it locally:$ CFLAGS=-I$HOME/.local/include LDFLAGS=-L$HOME/.local/lib/ python setup.py install --userNow we need to set up some paths so that we can use this at run time. Put the following
lines into your $HOME/.bashrc (or equivalent if you use another shell):export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
export PATH=$HOME/.local/bin:$PATHThen, log out, log back in, and you should be able to use wormtable.Test suiteWormtable has an extensive suite of tests to ensure that data
is stored correctly.
It is a good idea to run these immediately after installation:$ python tests.pyTested platformsWormtable is highly portable, and
has been successfully built and tested
on the following platforms:Operating systemPlatformPythonCompilerUbuntu 13.04x86-642.7.4gcc 4.7.3Ubuntu 13.04x86-643.3.1gcc 4.7.3Ubuntu 13.04x86-642.7.4clang 3.2.1Debian squeezex86-642.6.6gcc 4.4.5Debian squeezex86-643.1.3gcc 4.4.5Debian squeezex86-643.1.3clang 1.1Debian squeezeppc642.6.6gcc 4.4.5Debian squeezeppc643.1.3gcc 4.4.5Debian wheezyarmv6l2.7.3gcc 4.6.3Fedora 17i3862.7.3gcc 4.7.2Fedora 17i3863.2.3gcc 4.7.2FreeBSD 9.0i3863.2.2gcc 4.2.2FreeBSD 9.0i3862.7.2gcc 4.2.2FreeBSD 9.0i3863.1.4clang 3.0OS X 10.8.4x86-642.7.2clang 4.2Solaris 10SPARC3.3.2gcc 4.8.0Solaris 11.1SPARC2.6.8gcc 4.5.2Solaris 11.1SPARC2.6.8Sun C 5.12Scientific Linux 6.2x86-642.6.6icc 12.0.0