bqtools
A command-line utility for working with BINSEQ files.
Overview
bqtools provides tools to encode, decode, manipulate, and analyze BINSEQ files.
It supports both (*.bq) and (*.vbq) files and makes use of the binseq library.
BINSEQ is a binary file format family designed for high-performance processing of DNA sequences. It currently has two variants: BQ and VBQ.
- BQ (*.bq): Optimized for fixed-length DNA sequences without quality scores.
- VBQ (*.vbq): Optimized for variable-length DNA sequences with optional quality scores.
Both support single and paired sequences and make use of two-bit encoding for efficient nucleotide packing using the bitnuc library.
For more information about BINSEQ, see our preprint where we describe the format family and its applications.
Features
- Encode: Convert FASTA or FASTQ files to a BINSEQ format
- Decode: Convert a BINSEQ file back to FASTA, FASTQ, or TSV format
- Cat: Concatenate multiple BINSEQ files
- Count: Count records in a BINSEQ file
- Grep: Search for fixed-string or regex patterns in BINSEQ files.
Installation
From Cargo
bqtools can be installed using cargo, the Rust package manager:
To install cargo you can follow the instructions on the official Rust website.
From Source
# Clone the repository
# Install
# Check installation
Usage
# Get help information
# Get help for specific commands
Encoding
Convert FASTA/FASTQ files to BINSEQ format:
# Encode a single file to binseq
# Encode a single file to vbinseq
# Encode paired-end reads
# Encode paired-end reads to vbinseq
# Specify a policy for handling non-ATCG nucleotides
# Use multiple threads for parallel processing
Available policies for handling non-ATCG nucleotides:
i: Ignore sequences with non-ATCG charactersp: Break on invalid sequencesr: Randomly draw a nucleotide for each N (default)a: Set all Ns to Ac: Set all Ns to Cg: Set all Ns to Gt: Set all Ns to T
Note: Input FASTQ files may be compressed.
Decoding
Convert BINSEQ files back to FASTA/FASTQ/TSV:
# Decode to FASTQ (default)
# Decode to FASTA
# Decode paired-end reads into separate files
# Creates output_R1.fastq and output_R2.fastq
# Specify which read of a pair to output
# Specify output format
Concatenating
Combine multiple BINSEQ files:
Counting
Count records in a BINSEQ file:
Grep
You can easily search for specific subsequences or regular expressions within BINSEQ files:
# See full options list
# Search for a specific subsequence (in primary sequence)
# Search for a regular expression (in primary)
# Search for both a subsequence (in extended sequence) and a regular expression (in either)