ntCard is a streaming algorithm for cardinality estimation in genomics datasets. As input it takes file(s) in fasta, fastq, sam, or bam formats and computes the total number of distinct k-mers, F0, and also the k-mer coverage frequency histogram, fi, i>=1.
$ ./configure --prefix=/opt/ntCard
$ make
$ make install
ntCard uses OpenMP for parallelization, which requires a modern compiler such as GCC 4.2 or greater. If you have an older compiler, it is best to upgrade your compiler if possible. If you have multiple versions of GCC installed, you can specify a different compiler:
$ ./configure CC=gcc-xx CXX=g++-xx
For the best performance of ntCard, pass -O3 flag:
$ ./configure CFLAGS='-g -O3' CXXFLAGS='-g -O3'
To run ntCard, its executables should be found in your PATH. If you installed ntCard in /opt/ntCard, add /opt/ntCard/bin to your PATH:
$ PATH=/opt/ntCard/bin:$PATH
Run ntCard
ntcard [OPTIONS] ... FILE(S) ...
Parameters:
-t, --threads=N: use N parallel threads [1] (N>=2 should be used when input files are >=2)
-k, --kmer=N: the length of k-mer
-c, --cov=N: the maximum coverage of k-mer in output [1000]
-p, --pref=STRING: the prefix for output file names
-o, --output=STRING: the name for single output file name (can be used only for single compact output file)
FILE(S): input file or set of files seperated by space, in fasta, fastq, sam, and bam formats. The files can also be in compressed (.gz, .bz2, .xz) formats . A list of files containing file names in each row can be passed with @ prefix.
For example to run ntcard on a test file reads.fastq with k=50 and output the histogram in a file with prefix freq:
$ ntcard -k50 -p freq reads.fastq
To run ntcard on a test file reads.fastq with multiple k’s k=32,64,96,128 and output the histograms in files with prefix freq use:
$ ntcard -k32,64,96,128 -p freq reads.fastq
As another example, to run ntcard on 5 input files file_1.fq.gz, file_2.fa, file_3.sam, file_4.bam, file_5.fq with k=64 and 6 threads and maximum frequency of c=100 on output file with prefix freq:
Hamid Mohamadi, Hamza Khan, and Inanc Birol.
ntCard: a streaming algorithm for cardinality estimation in genomics data.
Bioinformatics (2017) 33 (9): 1324-1330.
10.1093/bioinformatics/btw832
ntCard
ntCard is a streaming algorithm for cardinality estimation in genomics datasets. As input it takes file(s) in fasta, fastq, sam, or bam formats and computes the total number of distinct k-mers, F0, and also the k-mer coverage frequency histogram, fi, i>=1.
Install ntCard on macOS
Install Homebrew, and run the command
Install ntCard on Linux
Install Linuxbrew, and run the command
Compiling ntCard from GitHub
When installing ntCard from GitHub source the following tools are required:
To generate the configure script and make files:
Compiling ntCard from source
To compile and install ntCard in /usr/local:
To install ntCard in a specified directory:
ntCard uses OpenMP for parallelization, which requires a modern compiler such as GCC 4.2 or greater. If you have an older compiler, it is best to upgrade your compiler if possible. If you have multiple versions of GCC installed, you can specify a different compiler:
For the best performance of ntCard, pass
-O3flag:To run ntCard, its executables should be found in your PATH. If you installed ntCard in /opt/ntCard, add /opt/ntCard/bin to your PATH:
Run ntCard
Parameters:
-t,--threads=N: use N parallel threads [1] (N>=2 should be used when input files are >=2)-k,--kmer=N: the length of k-mer-c,--cov=N: the maximum coverage of k-mer in output[1000]-p,--pref=STRING: the prefix for output file names-o,--output=STRING: the name for single output file name (can be used only for single compact output file)FILE(S): input file or set of files seperated by space, in fasta, fastq, sam, and bam formats. The files can also be in compressed (.gz,.bz2,.xz) formats . A list of files containing file names in each row can be passed with@prefix.For example to run ntcard on a test file
reads.fastqwithk=50and output the histogram in a file with prefixfreq:To run ntcard on a test file
reads.fastqwith multiple k’sk=32,64,96,128and output the histograms in files with prefixfrequse:As another example, to run ntcard on
5input files file_1.fq.gz, file_2.fa, file_3.sam, file_4.bam, file_5.fq withk=64and 6 threads and maximum frequency ofc=100on output file with prefixfreq:If we have a list of input files
lib.in, to run ntCard withk=144and12threads and output file with prefixfreq:Output:
Fkprovide useful statistics on the input sequences. By default, F0 and F1 are output to stdout along with runtime.F0denotes the number of distinct k-mers appearing in the stream sequencesF1is the total number of k-mers in the input datasetsF2is the Gini index of variation that can be used to show the diversity of k-mers andF∞results in the most frequent k-mer in the input reads.k,f, andn.kk-mer sizefthe frequency of a k-mernthe number of k-mers with frequencyfPublications
ntCard
Hamid Mohamadi, Hamza Khan, and Inanc Birol. ntCard: a streaming algorithm for cardinality estimation in genomics data. Bioinformatics (2017) 33 (9): 1324-1330. 10.1093/bioinformatics/btw832