Skip to content
项目

dnbaker/bonsai has 69 GitHub stars and 10 forks. GitHot measured 0 stars in 24 hours, 0 in 7 days, and 0 in 15 days. Last checked 2026-11-23 05:28 UTC. Last push 2026-10-23.

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

关于

Bonsai: Fast, flexible taxonomic analysis and classification

数据

README.md

原文

Bonsai: Flexible Taxonomic Analysis and Extension Build Status Language grade: C/C++

Bonsai contains varied utilities for taxonomic analysis and classification using exact subsequence matches. These include:

  • A high-performance, generic taxonomic classifier
    • Efficient classification
      • 20x as fast, single-threaded, as Kraken in our benchmarks, while demonstrating significantly better threadscaling.
    • Arbitrary, user-defined spaced-seed encoding.
      • Reference compression by windowing/minimization schemes.
      • Generic minimization including by taxonomic depth, lexicographic value, subsequence specificity, or Shannon entropy.
    • Parallelized pairwise Jaccard Distance estimation using HyperLogLog sketches, which has recently migrated to dashing.
  • An unsupervised method for taxonomic structure discovery and correction. (metatree)
  • A threadsafe, SIMD-accelerated HyperLogLog implementation, which has migrated to hll.
  • Scripts for downloading reference genomes from new (post-2014) and old RefSeq.

Tools have been compiled using both zlib and zstd, which means that they can transparently consume zlib-, zstd-, and uncompressed files.

All of these tools are experimental. Use at your own risk.

Build Instructions

cd bonsai && make bonsai

The Makefile honors CXX/CC. Some default environment compilers cannot build this tree (for example an LLVM clang without the platform SDK headers on macOS); use a GCC-compatible toolchain, e.g. make bonsai CXX=g++.

Unit Tests

We use the Catch testing framework. You can build and run the tests by:

cd bonsai && make unit CXX=g++ && ./unit

Dependencies

Primary dependency is sketch, stored in hll, which handles sketching + bit math requirements. In addition, we require zlib, ntHash, and zstd.

Usage

Encoding: Use Encoder from include/bonsai/encoder.h to directly encode k-mers or RollingHasher to encode k-mers with a rolling hash to enable unbounded length. These are then called via for_each and for_each_hash functions.

Executables:

Usage instructions are available in each executable by executing it with no options or providing the -h flag.

For classification purposes, the commands involved are bonsai prebuild, bonsai build, and bonsai classify. prebuild is only required for taxonomic or feature minimization strategies, for which case database building requires double the memory requirements. Unless you're very sure you know what you're doing, we recommend simply bonsai build with either Entropy or Lexicographic minimization. Lexicographic (the default) builds write the compact k-mer -> taxon database (sketch cht_map_t, uncompressed); -L writes the legacy khash database instead, which is also what the other modes build. bonsai classify detects either format.

To build a database with k = 31, window size = 50, minimized by entropy, from a taxonomy in ref/nodes.dmp and a nameidmap in ref/nameidmap.txt and store it in in bns.db

bonsai build -e -w50 -k31 -p20 -T ref/nodes.dmp -M ref/nameidmap.txt bns.db `find ref/ -name '*.fna.gz'`

To prepare the above, the script in python/download_genomes.py can be used. The default of downloading all available genomes can be run by python python/download_genomes.py --threads 20 all. This places downloaded genomes by default into the paths listed above in the bonsai build command. These paths can be altered; see python/download_genomes.py -h/--help for details.

探索相关项目

加载中…