Crate sigalign

source ·
Expand description

SigAlign

SigAlign is a library designed to handle gap-affine pairwise sequence alignment tasks guided by easy-to-understand similarity cutoffs.

Quick Start Example

use sigalign::wrapper::{
    DefaultAligner,
    DefaultReference,
};

// (1) Build `Reference`
let fasta =
br#">target_1
ACACAGATCGCAAACTCACAATTGTATTTCTTTGCCACCTGGGCATATACTTTTTGCGCCCCCTCATTTA
>target_2
TCTGGGGCCATTGTATTTCTTTGCCAGCTGGGGCATATACTTTTTCCGCCCCCTCATTTACGCTCATCAC"#;
let reference = DefaultReference::from_fasta_bytes(fasta).unwrap();

// (2) Instantiate `Aligner`
let mut aligner = DefaultAligner::new(
    4,   // Mismatch penalty
    6,   // Gap-open penalty
    2,   // Gap-extend penalty
    50,  // Minimum aligned length
    0.2, // Maximum penalty per length
).unwrap();

// (3) Perform alignment
let query = b"CAAACTCACAATTGTATTTCTTTGCCAGCTGGGCATATACTTTTTCCGCCCCCTCATTTAACTTCTTGGA";
let result = aligner.align_query(&reference, query).unwrap();
println!("{:#?}", result);

Core Structures

The core of SigAlign is built around two central structures: Reference and Aligner. The Reference serves as a database for multiple target sequences, while the Aligner is responsible for executing the alignment tasks. The basic workflow is as follows:

  1. Instantiate Reference and Aligner
  2. Pass the Reference and query sequence to the Aligner.

Inputs and Outputs

Inputs

  • Sequences
    • Target sequences
    • Query sequence
  • Regulators
    • Penalties
      • Mismatch penalty
      • Gap-open penalty
      • Gap-extend penalty
    • Cutoffs
      • Minimum length (ML)
      • Maximum penalty per length (MPL)

Outputs

  • Alignment Results
    • Penalty score
    • Length of alignment
    • Alignment position
    • Operation history

Module Navigation

Modules

  • Provides the Aligner struct, an alignment worker that performs sequence alignment.
  • Provides the Reference struct, a database for multiple targeted sequences.
  • Alignment results.
  • Utilities.
  • Easy to use wrappers.