Skip to main content

🧬 BioCheck

The ruff of Bioinformatics — Blazingly Fast Linter & Auto-Fixer for Genomics Files

License: MIT Platform: Linux | macOS | Windows Dependencies: Zero Speed: 1.5–3.0 GB/s

Catch syntax errors, delimiter corruption, and chromosome mismatches in 0.1s before wasting an 8-hour Slurm job.


Why BioCheck?

In bioinformatics, over 50% of pipeline failures on HPC clusters are caused by formatting errors:

  • Delimiter corruption: A VCF, BED, or GTF file has spaces instead of tabs on line 14,200.
  • Chromosome style mismatch: Reference index uses chr1, but your file uses 1, resulting in zero matches.
  • FASTQ desynchronization: Sequence length does not match quality string length (len(seq) != len(qual)).
  • Windows line endings: Invisible carriage returns (\r\n) breaking Linux tools.
  • Inverted or negative coordinates: 0-based vs 1-based bounds errors (start > end or start < 0).

Existing validators are fragmented across multiple programming languages, require complex compilation, and cannot fix anything.

BioCheck is a single standalone binary (~1.8 MB) with zero dependencies. It inspects files at 1.5–3.0 GB/s, displays clear diagnostics with line pointers, and automatically repairs formatting errors with biocheck fix.


Quick Start

BioCheck is distributed as a single standalone executable. It requires no Python setup, no compiler, and zero dependencies.

Download the pre-compiled binary for your system:

# Linux (x86_64)
curl -L -o biocheck https://gitee.com/l1zhe/bio-check/releases/download/v0.1.0/biocheck-linux-x86_64
chmod +x biocheck
sudo mv biocheck /usr/local/bin/

# Verify installation
biocheck --version

Option 2: Python (pip)

# Installs the standalone 'biocheck' binary into your PATH
pip install biocheck-cli

# Verify installation
biocheck --version
Building from source (for developers)

If you have the Rust toolchain installed:

git clone https://gitee.com/l1zhe/bio-check.git
cd bio-check
cargo build --release
# Executable is located at ./target/release/biocheck

CLI Usage

1. Check Files or Directories

BioCheck automatically detects file formats and transparently handles .gz / .bgz compressed files:

# Check a single file
biocheck check sample.vcf

# Check an entire directory
biocheck check data/

# Fast pre-flight check on massive files (default) or full byte scan
biocheck check --full cohort.vcf.gz

Diagnostic Output:

error[VCF001]: Inconsistent delimiter: spaces detected instead of tab ('\t')
  --> data/cohort.vcf:142:5
      |
  142 | chr1    10050    rs123    A    G    .    PASS    DP=20
      |     ^^^^
      |
  = help: Run `biocheck fix --delimiters <file>` to replace spaces with tabs

warning[VCF005]: Inconsistent chromosome naming convention
  --> data/cohort.vcf:305:1
      |
  305 | 1	15000	rs456	C	T	.	PASS	DP=18
      | ^^^^
      |
  = help: Run `biocheck fix --chr-style ucsc <file>` to standardize contig names

Checked 2 files: 1 error, 1 warning in 0.02s

2. Auto-Fix Formatting Errors (biocheck fix)

Unlike legacy validators that only complain and crash, BioCheck automatically repairs common formatting issues:

# Convert spaces to tabs and strip CRLF line endings
biocheck fix corrupted.vcf -o clean.vcf

# Standardize chromosome contigs (force UCSC 'chr1' or Ensembl '1')
biocheck fix sample.bed --chr-style ucsc -o clean.bed

# Coordinate-sort the file
biocheck fix unsorted.vcf --sort -o sorted.vcf

# Drop incomplete trailing reads from truncated FASTQ downloads
biocheck fix truncated.fastq -o fixed.fastq

# Clean and format FASTA sequence lines
biocheck fix genome.fasta --clean-fasta -o cleaned.fasta

# Modify in-place atomically
biocheck fix --in-place data/sample.vcf

3. Pipeline & CI/CD Integration

# Quiet mode: returns exit code (0 = clean, 1 = errors)
biocheck check -q input.fastq.gz

# Machine-readable JSON output
biocheck check --output-format json data/ > report.json

# Compact single-line output (IDE & editor friendly)
biocheck check --output-format compact data/

Performance Comparison

Benchmarked scanning a 3.2 GB Human Reference FASTA (GRCh38.fa):

Tool Language Scan Time Memory Usage Auto-Fix?
BioCheck Rust 0.82s 18 MB Yes (biocheck fix)
SeqKit (seqkit fq2fa) Go 1.95s 42 MB No
BioPython (SeqIO.parse) Python 48.6s 280 MB No
Custom Python script Python 32.1s 65 MB No

Supported Formats & Rules

Run biocheck rules to inspect the interactive rule index:

Code Format Rule Description Auto-Fixable?
VCF001 VCF Inconsistent delimiter (spaces detected instead of tabs) Yes
VCF002 VCF Missing or malformed #CHROM header line No
VCF003 VCF Invalid 1-based coordinate (POS <= 0) No
VCF004 VCF Unsorted genomic coordinates within contig Yes (--sort)
VCF005 VCF Inconsistent chromosome naming (chr1 vs 1 mixed) Yes (--chr-style)
VCF006 VCF Invalid REF allele (empty or non-IUPAC bases) No
VCF007 VCF Missing ##fileformat=VCFv4.x declaration No
VCF008 VCF Record contains fewer than 8 mandatory fields No
VCF009 VCF Blank line inside VCF data section Yes
FQ001 FASTQ Line 1 of record does not start with @ No
FQ002 FASTQ Line 3 of record does not start with + No
FQ003 FASTQ Sequence length and quality score string length mismatch No
FQ004 FASTQ Invalid nucleotide character in sequence No
FQ005 FASTQ Quality score byte outside standard Phred+33 range No
FQ006 FASTQ Truncated FASTQ record at EOF Yes (--strip-incomplete)
FA001 FASTA File does not begin with header > No
FA002 FASTA Empty sequence identifier on header line No
FA003 FASTA Duplicate sequence identifier found No
FA004 FASTA Empty sequence body No
FA005 FASTA Internal whitespace or tab in sequence Yes (--clean-fasta)
FA006 FASTA Invalid character in sequence No
BED001 BED Delimiter violation: spaces instead of tabs Yes
BED002 BED Fewer than 3 required columns (chrom, start, end) No
BED003 BED Non-integer coordinates No
BED004 BED Negative start coordinate (start < 0) No
BED005 BED Inverted or empty interval (start >= end) No
BED006 BED Inconsistent chromosome naming convention Yes (--chr-style)
BED007 BED Invalid strand character (must be +, -, or .) No
BED008 BED Unsorted BED records Yes (--sort)
GFF001 GFF/GTF Record does not have exactly 9 fields No
GFF002 GFF/GTF Delimiter violation: spaces instead of tabs Yes
GFF003 GFF/GTF Non-integer coordinates No
GFF004 GFF/GTF Start coordinate < 1 (GFF is 1-based) No
GFF005 GFF/GTF Inverted interval (start > end) No
GFF006 GFF/GTF Invalid strand value (+, -, ., ?) No
GFF007 GFF/GTF Invalid phase for CDS (0, 1, 2, .) No
GFF008 GFF/GTF Inconsistent chromosome naming Yes (--chr-style)
SAM001 SAM Record has fewer than 11 mandatory fields No
SAM003 SAM Non-integer POS coordinate No
SAM004 SAM SEQ and QUAL length mismatch No
SAM005 SAM Inconsistent chromosome naming in RNAME No
GLB001 ALL Windows CRLF (\r\n) line endings detected Yes (--newlines)
GLB003 ALL Invalid non-UTF-8 character detected No
GLB004 ALL Unknown or unsupported file format No

Pre-Commit Hook Integration

Add BioCheck to your .pre-commit-config.yaml to prevent invalid files from being committed:

repos:
  - repo: https://gitee.com/l1zhe/bio-check
    rev: v0.1.0
    hooks:
      - id: biocheck

Nextflow Pre-Flight Recipe

Add BioCheck as a fast pre-flight validation step in Nextflow pipelines:

process PREFLIGHT_CHECK {
    tag "$meta.id"
    
    input:
    tuple val(meta), path(reads)

    script:
    """
    biocheck check -q ${reads}
    """
}

License

Licensed under the MIT License.

Release files for biocheck-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for biocheck-cli 0.1.0
File Size Uploaded
biocheck_cli-0.1.0.tar.gz 34.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for biocheck-cli 0.1.0
File Interpreter ABI Platform
biocheck_cli-0.1.0-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details

Total release size: 686.5 kB

Release files / biocheck_cli-0.1.0.tar.gz

Download URL biocheck_cli-0.1.0.tar.gz
Size 34.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4e154368a16a1a344839c537fe18385e0bf6c4851e350d9faedf14a9cfb85c2a
BLAKE2b-256 checksum
How to use checksums
05736d822d62e016f85a83d9747cdd4fa01b823d039f40d13ed5e9b4e3c59434
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / biocheck_cli-0.1.0-py3-none-manylinux_2_34_x86_64.whl

Download URL biocheck_cli-0.1.0-py3-none-manylinux_2_34_x86_64.whl
Size 651.6 kB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
f51881d024f0d2f1bf9c4ac6a6fac15b7b317448680fa5e3e3d26f1424067975
BLAKE2b-256 checksum
How to use checksums
d7f9b988a86a3ed9c1f1b0c8eb29f8aa9df17faee48f681dd211df601b1bbf00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page