JELLYFISH(1) | k-mer counter | JELLYFISH(1) |
jellyfish1 - count k-mers in DNA sequences
jellyfish count [-oprefix]
[-mmerlength] [-tthreads]
[-shashsize] [--both-strands] fasta [fasta
... ]
jellyfish merge hash1 hash2 ...
jellyfish dump hash
jellyfish stats hash
jellyfish histo [-hhigh] [-llow]
[-iincrement] hash
jellyfish query hash
jellyfish cite
Plus equivalent version for Quake mode: qhisto, qdump and qmerge.
Jellyfish is a k-mer counter based on a multi-threaded hash table implementation.
To count k-mers, use a command like:
jellyfish count -m 22 -o output -c 3 -s 10000000 -t 32 input.fasta
This will count the the 22-mers in input.fasta with 32 threads. The counter field in the hash uses only 3 bits and the hash has at least 10 million entries.
The output files will be named output_0, output_1, etc. (the prefix is specified with the -o switch). If the hash is large enough (has specified by the -s switch) to fit all the k-mers, there will be only one output file named output_0. If the hash filled up before all the mers were read, the hash is dumped to disk, zeroed out and reading in mers resumes. Multiple intermediary files will be present on the disks, named output_0, output_1, etc.
To obtain correct results from the other sub-commands (such as histo, stats, etc.), the multiple output files, if any, need to be merged into one with the merge command. For example with the following command:
jellyfish merge -o output.jf output\_*
Should you get many intermediary output files (say hundreds), the size of the hash table is too small. Rerunning Jellyfish with a larger size (option -s) is probably faster than merging all the intermediary files.
When the orientation of the sequences in the input fasta file is not known, e.g. in sequencing reads, using --both-strands (-C) makes the most sense.
For any k-mer m, its canonical representation is m itself or its reverse-complement, whichever comes first lexicographically. With the option -C, only the canonical representation of the mers are stored in the hash and the count value is the number of occurrences of both the mer and its reverse-complement.
To achieve the best performance, a minimum number of intermediary files should be written to disk. So the parameter -s should be chosen to fit as many k-mers as possible (ideally all of them) while still fitting in memory.
We consider to examples: counting mers in sequencing reads and in a finished genome.
First, suppose we count k-mers in short sequencing reads: there are n reads and there is an average of 1 error per reads where each error generates k unique mers. If the genome size is G, the size of the hash (option -s) to fit all k-mers at once is estimated to: $(G + k*n)/0.8$. The division by 0.8 compensates for the maximum usage of approximately $80%$ of the hash table.
On the other hand, when counting k-mers in an assembled sequence of length G, setting -s to G is appropriate.
As a matter of convenience, Jellyfish understands ISO suffixes for the size of the hash. Hence '-s 10M' stands 10 million entries while '-s 50G' stands for 50 billion entries.
The actual memory usage of the hash table can be computed as follow. The actual size of the hash will be rounded up to the next power of 2: s=2^l. The parameter r is such that the maximum reprobe value (-p) plus one is less than 2^r. Then the memory usage per entry in the hash is (in bits, not bytes) 2k-l+r+1. The total memory usage of the hash table in bytes is: 2^l*(2k-l+r+1)/8.
To save space, the hash table supports variable length counter, i.e. a k-mer occurring only a few times will use a small counter, a k-mer occurring many times will used multiple entries in the hash.
Important: the size of the couting field does NOT change the result, it only impacts the amount of memory used. In particular, there is no maximum value in the hash. Even if the counting field uses 5 bits, a k-mer occuring 2 million times will have a value reported of 2 million (i.e., it is not capped at 2^5).
The -c specify the length (in bits) of the counting field. The trade off is as follows: a low value will save space per entry in the hash but can potentially increase the number of entries used, hence maybe requiring a larger hash.
In practice, use a value for -c so that most of you k-mers require only 1 entry. For example, to count k-mers in a genome, where most of the sequence is unique, use -c1 or -c2. For sequencing reads, use a value for -c large enough to counts up to twice the coverage. For example, if the coverage is 10X, choose a counter length of 5 (-c5) as $2^5 > 20$.
Usage: jellyfish count [options] file:path+
Count k-mers or qmers in fasta or fastq files
Options (default value in (), *required):
Usage: jellyfish stats [options] db:path
Statistics
Display some statistics about the k-mers in the hash:
Unique: Number of k-mers which occur only once. Distinct: Number of k-mers, not counting multiplicity. Total: Number of k-mers, including multiplicity. Max_count: Maximum number of occurrence of a k-mer.
Options (default value in (), *required):
Usage: jellyfish histo [options] db:path
Create an histogram of k-mer occurrences
Create an histogram with the number of k-mers having a given count. In bucket 'i' are tallied the k-mers which have a count 'c' satisfying 'low+i*inc <= c < low+(i+1)*inc'. Buckets in the output are labeled by the low end point (low+i*inc).
The last bucket in the output behaves as a catchall: it tallies all k-mers with a count greater or equal to the low end point of this bucket.
Options (default value in (), *required):
Usage: jellyfish dump [options] db:path
Dump k-mer counts
By default, dump in a fasta format where the header is the count and the sequence is the sequence of the k-mer. The column format is a 2 column output: k-mer count.
Options (default value in (), *required):
Usage: jellyfish merge [options] input:string+
Merge jellyfish databases
Options (default value in (), *required):
Usage: jellyfish query [options] db:path
Query from a compacted database
Query a hash. It reads k-mers from the standard input and write the counts on the standard output.
Options (default value in (), *required):
Usage: jellyfish qhisto [options] db:string
Create an histogram of k-mer occurences
Options (default value in (), *required):
Usage: jellyfish qdump [options] db:path
Dump k-mer from a qmer database
By default, dump in a fasta format where the header is the count and the sequence is the sequence of the k-mer. The column format is a 2 column output: k-mer count.
Options (default value in (), *required):
Usage: jellyfish merge [options] db:string+
Merge quake databases
Options (default value in (), *required):
Usage: jellyfish cite [options]
How to cite Jellyfish's paper
Citation of paper
Options (default value in (), *required):
Version: 1.1.4 of 2010/10/1
Guillaume Marcais
University of Maryland
gmarcais@umd.edu
Carl Kingsford
University of Maryland
carlk@umiacs.umd.edu
2010/10/1 | k-mer counter |