Fairy computes multi-sample contig coverage for metagenome-assembled genome (MAG) binning.
Fairy is used after metagenomic assembly and before binning. It can
- Calculate coverage 100x-1000x faster than read alignment (e.g. BWA) for coverage calculation
- Give comparable bins for multi-sample binning and short read or nanopore reads
- Output formats that are compatible with MetaBAT2, MaxBin2, and more
Caveats:
- Don't use fairy for single-sample binning
- Don't use fairy for PacBio HiFi
mamba install -c bioconda fairy
# conda install -c bioconda fairy
Warning
If you're using linux, AVX512 instructions (e.g. a newer CPU) may be required for conda. Source install (option 2) and the static binary (option 3) will work for any CPU.
Requirements:
- rust (version > 1.63) programming language and associated tools such as cargo are required and assumed to be in PATH.
- A c compiler (e.g. GCC)
- make
- cmake
Building takes a few minutes (depending on # of cores).
git clone https://github.com/bluenote-1577/fairy
cd fairy
# If default rust install directory is ~/.cargo
cargo install --path .
fairy -h
If you're on an x86-64 Linux system, you can download the binary and use it without any installation.
wget https://github.com/bluenote-1577/fairy/releases/download/latest/fairy
chmod +x fairy
./fairy -h
Note: the binary is compiled with a different set of libraries (musl instead of glibc), probably impacting performance.
# sketch/index short reads
fairy sketch -1 *_1.fastq.gz -2 *_2.fastq.gz -d sketch_dir
# sketch/index long reads
fairy sketch -r long_reads.fq -d sketch_dir
# rename the sketches if filenames are identical
fairy sketch -r dir1/reads.fq dir2/reads.fq -S sample1 sample2 -d sketch_dir
# calculate coverage
fairy coverage sketch_dir/*.bcsp contigs1.fa -t 10 -o coverage1.tsv
fairy coverage sketch_dir/*.bcsp contigs2.fa -t 10 -o coverage2.tsv
# default format is compatible with metabat2
metabat2 -i contigs1.fa -a coverage1.tsv ...
metabat2 -i contigs2.fa -a coverage2.tsv ...
# maxbin2 (requires different options; see below)
maxbin2 ...
# SemiBin2 (requires different options; see below)
SemiBin2 single_easy_bin -i contigs1.fa -a cov_aemb_1.tsv cov_aemb_2.tsv ...
The default output is compatible with the jgi_summarize_bam_contig_depths
script from MetaBAT2 (the column names are different, however).
contigName contigLen totalAvgDepth reads1.fq reads1.fq-var reads2.fq reads2.fq-var ...
contig_1 38370 1.4 1.4 1.1100 0 0
...
- First three columns give the name, the length, and average coverage.
- The next columns are
mean coverage
andcoverage variance
for each sample.
The above output can be fed directly into MetaBAT2 with default parameters.
Since fairy v0.5.5 and SemiBin v2.1, you can use SemiBin as follows
fairy coverage contigs1.fa reads1.bcsp --aemb-format -o cov_aemb1.tsv
fairy coverage contigs1.fa reads2.bcsp --aemb-format -o cov_aemb2.tsv
...
SemiBin2 single_easy_bin -i contigs.fa cov_aemb*.tsv -o results
Tip
Fairy usage for SemiBin2 is different than other tools: SemiBin2 requires separate coverage files for each read sample -- other tools require a single coverage matrix.
Alternatively, --maxbin-format
works directly with MaxBin2 and is also available. This removes the variance columns as well as the contigLen
and totalAvgDepth
columns.
Jim Shaw, Yun William Yu. Fairy: fast approximate coverage for multi-sample metagenomic binning (2024). bioRxiv.