10 unstable releases (3 breaking)

new 0.4.2 Nov 19, 2024
0.4.1 Nov 18, 2024
0.3.1 Nov 6, 2024
0.2.2 Oct 11, 2024
0.1.2 Sep 26, 2024

#441 in Algorithms

Download history 362/week @ 2024-09-24 41/week @ 2024-10-01 356/week @ 2024-10-08 55/week @ 2024-10-15 55/week @ 2024-10-29 216/week @ 2024-11-05 185/week @ 2024-11-12

459 downloads per month
Used in sufr

BSD-3-Clause

83KB
2K SLoC

Parallel Construction of Suffix Arrays in Rust

This is a Rust library crate for creating suffix arrays.

The basic ideas are as follow:

  • Read the input file as u8 (unsigned 8-bit integer values).
  • Select the suffixes, which are normally 0 to the length of the text but there is the option to skip suffixes that don't start with A/C/G/T if the input is DNA. Note: Following the C++ implementation, we use 32-bit integers if the input text length is less than 2^32 and 64-bit integers, otherwise.
  • Create partitions by randomly choosing suffixes and copying the suffixes to the highest possible partition bounded by any pivot.
  • Sort the partitions in parallel.
  • Merge the partitions. Because the values fall into nonoverlapping ranges, these subarrays can be appended in order to produce the final SA.
  • Produce a binary-encoded output file with the suffix/LCP arrays and other metadata.

Some advantages to this algorithm:

  • The various partitioned subarrays can be processed independently by separate threads, and no thread will ever have to merge the entire input.
  • Suffix comparisons are made faster by caching LCPs.
  • Using u8 for the input text and 32-bits (when possible) for SA/LCP results in lower memory usage.

See the repository for documentation: https://github.com/TravisWheelerLab/sufr

See Also

Use cargo install sufr for a CLI.

Authors

Dependencies

~6–16MB
~226K SLoC