Skip to content

angelovangel/fastjac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastjac

A simple program for getting k-mer similarity metrics for two fastq/fasta files, written in Rust.

Description

This command line program takes as inputs two fastq/fasta files and a k-mer size and outputs the following k-mer similarity metrics for the two sets A and B:

  • Jaccard distance - the ratio of intersection over union for the two k-mer sets.

    $\Large \frac{ |A \cap B| }{ |A \cup B| }$

  • Sørensen-Dice coefficient - twice the number of common elements divided by the sum of the number of elements in each set.

    $\Large \frac{2 |A \cap B| }{ |A| + |B| }$

  • Containment - fraction of the k-mers in the query which are found in the reference.

    $\Large \frac{|A \cap B| }{ |A| }$

    If the cardinality of the k-mers in A is smaller than in B then this is the same as the overlap coefficient.

Install

I provide precompiled binaries for linux only here, but it is simple to compile and run:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
git clone https://github.com/angelovangel/fastjac.git

cd fastjac
cargo build --release

The executable file fastjac is now under ./target/release/

Usage

The main options are -k k-mer size to use, -q path to query sequence file and -r path to reference sequence file. Both fasta and fastq (also compressed) are supported. Try fastjac -h for all options.

The output is a tab-separated table with the lengths of the k-mer sets, intersection, union, Jaccard distance, Sørensen-Dice coefficient, and containment (fraction of k-mers of query found in reference).

About

k-mer similarity metrics for two fastx files

Topics

Resources

Stars

Watchers

Forks

Languages