#bioinformatics #alignment #dna #protein #msa

multi-seq-align

Manipulate multiple sequence alignments (DNA/protein)

2 unstable releases

0.2.0 Sep 2, 2020
0.1.0 Sep 2, 2020

#199 in Biology

Download history 3/week @ 2023-11-10 2/week @ 2023-11-17 4/week @ 2023-11-24 8/week @ 2023-12-01 2/week @ 2023-12-15 4/week @ 2023-12-22 2/week @ 2024-01-05 4/week @ 2024-01-19 2/week @ 2024-01-26 2/week @ 2024-02-02 4/week @ 2024-02-09 31/week @ 2024-02-16 63/week @ 2024-02-23

100 downloads per month

Apache-2.0

29KB
458 lines

Multi-seq-align

stability-experimental

Rust Rust Documentation Crates.io version Crates.io license

A crate to manipulate multiple sequences alignments in Rust.

Instead of storing aligned sequences as multiple strings, multi_seq_align stores bases or residues in Alignment using a list of characters, like a matrix. This allows easy access to specific rows and columns of the alignment.

Usage

let mut kappa_casein_fragments_alignment = Alignment::with_sequences(
    &[
        b"PAPISKWQSMP".to_vec(),
        b"HAQIPQRQYLP".to_vec(),
        b"PAQILQWQVLS".to_vec(),
    ],
)?;

// Let's extract a column of this alignment
assert_eq!(
    kappa_casein_fragments_alignment.nth_position(6).unwrap(),
    [&b'W', &b'R', &b'W']
);

// But we also have the aligned sequence for the Platypus
// Let's add it to the original alignment
kappa_casein_fragments_alignment.add(
    b"EHQRP--YVLP".to_vec(),
)?;

// the new aligned sequence has a gap at the 6th position
assert_eq!(
    kappa_casein_fragments_alignment.nth_position(6).unwrap(),
    [&b'W', &b'R', &b'W', &b'-']
);

// We can also loop over each position of the alignment
for aas in kappa_casein_fragments_alignment.iter_positions() {
    println!("{:?}", aas);
    assert_eq!(aas.len(), 4); // 4 sequences
}

Here I instancied an alignment using u8, but Alignment works on generics like numbers, custom or third-party structs.

Features

  • Create Alignment from one or multiple aligned sequences at once (see add() and create()).
  • Extract columns of the alignment (see iter_positions() and iter_sequences(). This crate is currently in early stage development. I wouldn't recommend using it in production but I am interested in possible ideas to further the developemt of this project. Quite some work needs toi be done to improve the API and make it easy to use in other project.

Ideas

  • Computation of conservation scores
  • Identification of conserved sites
  • Computation of consensus sequence
  • Collapse / trim alignment
  • Serialisation / Deserialisation of alignment files
  • Extract sub-alignments
    • positions
    • motifs

Optimisation

My goal is to reduce the footprint of this crate, there is ome work to do to achieve it. The code will eventually be optimised to be faster and to better use memory.

Issues

Assuring that all the sequences have the same lengths in a generic way is chalenging and result in some not so nice code.

Ideas & bugs

Please create a new issue on the project repository.

License

Aa-regex is distributed under the terms of the Apache License (Version 2.0). See LICENSE for details.

Dependencies

~0.4–0.9MB
~21K SLoC