Limitations of the default cache
Strap saves results of time consuming computations like 3D superpositions and Blast in a local file cache.
The files are stored in the file directory ~/.StrapAlign/cached/.
The main advantage is, that this approach does not require any additional infrastructure.
However, if two different program instances try to store data on the
cache, then it may happen, that entries are lost. As a
consequence, the computation has to be performed again and time is
SQL database as cache
A cache in a Postgres database, can be used simultaneously by many
Strap instances even running on different computers by different users.
The following quick guide explains how a database is created on Linux:
For testing, temporarily move the directory ~/.StrapAlign/cached/ which holds the file based cache to another place.
If the SQL based cache is working properly, no files will be stored there.
Then start Strap with an additional command line option:-cacheUrl=jdbc:postgresql://localhost/strap_cache/.
To populate the cache, align some sequences or superimposed some structures. Quit Strap.
- Installing Postgres: Install two libraries libeditline-dev libreadline-dev. Then installed Postgres from source
code following the instructions of the file INSTALL.
As the user who will be running Strap:
initdb -D ~/.postgresql/data
postmaster -D ~/.postgresql/data -i
The last command starts the database back-end. The database is ready to be used.
Inspect the cache
There should be no entries in ~/.StrapAlign/cached/. Instead the table "cache" in the database "strap_cache" should have entries.
Switch to the database command line mode with the command
The following psql command lists all tables in the database.
There should be a table "cache" in the list.
With the follwowin SQL line, all entries are written out.
SELECT * FROM cache;
Using the cache from different computers and users
The cache can be shared by many computers. The advantage is,
that if a certain time consuming computation such as Blast or
3D-alignment has already been performed on somewhere, the result
would show up immediately. However, this is more complicated to set up.
First, a new postgres user needs to
be created. Get into the psql shell
CREATE USER strap WITH PASSWORD 'anyPassword';
GRANT ALL PRIVILEGES ON DATABASE strap_cache to strap;
GRANT ALL PRIVILEGES ON table cache to strap;
In the configuration of postgres, the other computer need permission to acces postgres.
Strap needs to be started with the additional program parameters
10.39.28.149 should be replaced by the IP number of the computer