No description
Find a file
2025-10-26 10:09:16 +00:00
.github/workflows update action? 2025-04-25 15:23:54 +01:00
benchmark add-benchmark-data 2025-04-24 15:48:10 +01:00
docs update documentation 2025-07-23 16:08:37 +01:00
src Fix big-endian int32 decoding for large offsets 2025-10-26 09:24:08 +00:00
tests Add tables import for regression test 2025-10-26 09:45:40 +00:00
.gitignore bugfixes 2025-04-28 11:47:59 +01:00
abif.nimble Fix documentation 2025-04-29 11:46:15 +01:00
chromatograms.md update-markdown 2025-04-25 15:09:43 +01:00
CLAUDE.md update claude prompt to reflect manual changes 2025-04-24 22:42:22 +01:00
LICENSE (C) Quadram Institute Bioscience 2025-04-24 10:27:21 +01:00
Makefile Update docs, Automate pdf and html regeneration 2025-04-26 11:00:37 +01:00
README.md add links to bioconda 2025-04-28 13:47:09 +01:00

Nim ABIF library logo

ABIF Parser for Nim

ABIF Tests Conda Version Conda Platform

A Nim library to parse ABIF (Applied Biosystems Information Format) files from DNA sequencing machines, commonly used in Sanger capillary sequencing.

Installation

To install the CLI packages:

conda install -c bioconda nim-abif

If you have Nim installed, you can install binaries and library with:

nimble install abif

Usage

Basic Usage

import abif

# Parse a trace file
let trace = newABIFTrace("path/to/trace.ab1")

# Get sequence and quality information
let sequence = trace.getSequence()
let qualityValues = trace.getQualityValues()
let sampleName = trace.getSampleName()

# Export sequence to FASTA format
trace.exportFasta("output.fa")

# Export sequence to FASTQ format
trace.exportFastq("output.fq")

# Don't forget to close the trace when done
trace.close()

Accessing Raw Data

# Get all tag names in the file
let tagNames = trace.getTagNames()

# Access data for a specific tag
let data = trace.getData("PBAS2")  # Base calls
let rawData = trace.getData("DATA1")  # Raw channel data

Command-line Usage

The library provides three command-line tools:

FASTQ converter with quality trimming

abi2fq trace.ab1 output.fq

The abi2fq tool provides quality-based sequence trimming:

abi2fq --help                    # Show help message
abi2fq --window=15 --quality=25 trace.ab1  # Trim with window size 15, quality threshold 25
abi2fq --no-trim trace.ab1       # Skip quality trimming
abi2fq --verbose trace.ab1       # Show additional information
abi2fq trace.ab1                 # Output to STDOUT

Merging paired (forward/reverse) traces

abimerge forward.ab1 reverse.ab1 merged.fq

The abimerge tool combines forward and reverse Sanger reads using Smith-Waterman alignment:

abimerge --help                          # Show help message
abimerge --min-overlap=30 fwd.ab1 rev.ab1 # Require at least 30bp overlap
abimerge --score-match=10 --score-mismatch=-8 --score-gap=-10 fwd.ab1 rev.ab1  # Custom alignment scores
abimerge --join=10 fwd.ab1 rev.ab1       # Join seqs with 10 Ns if no overlap found
abimerge --pct-id=90 fwd.ab1 rev.ab1     # Require 90% identity in overlap region
abimerge --verbose fwd.ab1 rev.ab1       # Show alignment details

Render traces

Convert a trace (or part of it) into SVG

rendered chromas

abichromatogram tests/A_forward.ab1 -o A.svg -s 500 -e 1000 --width 1600

Data Types

The ABIF format supports various data types, all of which are properly handled by this parser:

  • Numeric types (byte, word, short, long, float, double)
  • String types (char, pString, cString)
  • Date and time values
  • Boolean values

Development

Running Tests

nimble test

Building Documentation

nimble docs

License

This library is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This Nim implementation is based on: