| 1 |
* Copyright |
| 2 |
|
| 3 |
FFindex was written by Andreas Hauser <[email protected]>. |
| 4 |
Please add your name here if you distribute modified versions. |
| 5 |
|
| 6 |
FFindex is provided under the Create Commons license "Attribution-ShareAlike 4.0", |
| 7 |
which basically captures the spirit of the Gnu Public License (GPL). |
| 8 |
|
| 9 |
See: |
| 10 |
http://creativecommons.org/licenses/by-sa/4.0/ |
| 11 |
|
| 12 |
* Thanks |
| 13 |
|
| 14 |
Thanks to Laszlo Kajan for creating and maintaining Debian packages |
| 15 |
and many suggestions to improve the build and user experience. |
| 16 |
|
| 17 |
|
| 18 |
* Overview |
| 19 |
|
| 20 |
FFindex is a very simple index/database for huge amounts of small files. The |
| 21 |
files are stored concatenated in one big data file, seperated by '\0'. A second |
| 22 |
file contains a plain text index, giving name, offset and length of of the |
| 23 |
small files. The lookup is currently done with a binary search on an array made |
| 24 |
from the index file. |
| 25 |
|
| 26 |
|
| 27 |
* Installation |
| 28 |
|
| 29 |
$ cd src |
| 30 |
$ make |
| 31 |
$ make test |
| 32 |
|
| 33 |
If you have MPI and want to compile ffindex_apply_mpi: |
| 34 |
$ make HAVE_MPI=1 |
| 35 |
|
| 36 |
On OS X use for the first make line: |
| 37 |
$ make -f Makefile.osx |
| 38 |
|
| 39 |
# Please use a sensible value for INSTALL_DIR, e.g. /usr/local or /opt/ffindex |
| 40 |
# or $HOME/ffindex instead of "..". |
| 41 |
$ make install INSTALL_DIR=.. |
| 42 |
|
| 43 |
and with MPI: |
| 44 |
|
| 45 |
$ make install INSTALL_DIR=.. HAVE_MPI=1 |
| 46 |
|
| 47 |
|
| 48 |
* Usage |
| 49 |
|
| 50 |
Please note that before querying or unlinking entries a ffindex must be |
| 51 |
sorted, although you can add to it without. So either specify -s with |
| 52 |
ffindex_build or sorted later with ffindex_modify -s. |
| 53 |
Also the length of the entry names is restricted. See the usage output of |
| 54 |
the ffindex_build program. |
| 55 |
|
| 56 |
Setup environment: |
| 57 |
$ export PATH="$INSTALL_DIR/bin:$PATH" |
| 58 |
$ export LD_LIBRARY_PATH="$INSTALL_DIR/lib:$LD_LIBRARY_PATH" |
| 59 |
On OS X set DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH. |
| 60 |
|
| 61 |
Build index from files in test/data and test/data2. |
| 62 |
$ ffindex_build -s /tmp/test.data /tmp/test.ffindex test/data test/data2 |
| 63 |
|
| 64 |
Retrieve three entries: |
| 65 |
$ ffindex_get /tmp/test.data /tmp/test.ffindex a b foo |
| 66 |
|
| 67 |
Unlink (Remove reference from index) an entry: |
| 68 |
$ ffindex_modify -u /tmp/test.ffindex b |
| 69 |
|
| 70 |
Retrieve three entries, "b" should now be missing: |
| 71 |
$ ffindex_get /tmp/test.data /tmp/test.ffindex a b foo |
| 72 |
|
| 73 |
Convert a Fasta file to ffindex, entry names are incerental IDs starting from 1: |
| 74 |
$ ffindex_from_fasta -s fasta.ffdata fasta.ffindex NC_007779.ffn |
| 75 |
|
| 76 |
Get first entry by name: |
| 77 |
$ ffindex_get fasta.ffdata fasta.ffindex 1 |
| 78 |
|
| 79 |
Get first and third entry by entry index, this a little faster: |
| 80 |
$ ffindex_get fasta.ffdata fasta.ffindex -n 1 3 |
| 81 |
|
| 82 |
Count the characters including header in each entry: |
| 83 |
$ ffindex_apply fasta.ffdata fasta.ffindex wc -c |
| 84 |
|
| 85 |
Count the number of characters in each sequence, without the header: |
| 86 |
$ ffindex_apply fasta.ffdata fasta.ffindex perl -ne '$x += length unless(/^>/); END{print "$x\n"}' |
| 87 |
|
| 88 |
Parallel version for counting the characters including header in each entry: |
| 89 |
$ mpirun -np 4 ffindex_apply_mpi fasta.ffdata fasta.ffindex -- wc -c |
| 90 |
|
| 91 |
Parallel version for counting the characters including header in each entry and |
| 92 |
saving the output to a new ffindex: |
| 93 |
$ mpirun -np 4 ffindex_apply_mpi fasta.ffdata fasta.ffindex -i out-wc.ffindex -d out-wc.ffdata -- wc -c |