24 releases
Uses new Rust 2024
| new 0.3.9 | Nov 12, 2025 |
|---|---|
| 0.3.7 | Sep 20, 2025 |
| 0.3.0 | Jul 20, 2025 |
| 0.2.7 | Feb 15, 2025 |
| 0.2.1 | Oct 16, 2024 |
#279 in Biology
438 downloads per month
Used in 5 crates
70KB
1.5K
SLoC
Nucleic Acid Sequence tools
This Rust and Python library contains types and functions used for performing operations on DNA, RNA,
and amino acid sequences. Its most fundamental types are the Nucleotide and AminoAcid enums, representing a single DNA nucleotide,
and single amino acid respectively. This library is general, and intended to be used by any program or library
that uses DNA sequences. It also includes an Element enum, with parameters associated with each element.
It includes functions to convert between &[Nucleotide] to string and vice-versa, and convert to and from u8
representations of the UTF-8 characters. It includes functions to serialize and deserialize in a compact binary
format, with 2 bits per nucleotide.
It includes forcefield-parameter amino acid variants, as used by Amber as the AminoAcidProtenationVariant enum.
Basic types impl Display and ToStr, with variants in some cases, e.g. to display an AA as a single letter,
or 3-letter string.
See the docs for details on data structures and functions available.
Also includes restriction enzyme and ligation basics.
Minmal python example. See the rust docs for adetails:
from na_seq import *
aa = AminoAcid.from_codons([Nucleotide.A, Nucleotide.T, Nucleotide.G])
aa = AminoAcid.from_str("HIS")
aa.to_str(AaIdent.OneLetter)
aa.to_str(AaIdent.ThreeLetters)
Element.C.atomic_weight()
seq = [Nucleotide.A, Nucleotide.T, Nucleotide.G, Nucleotide.C, Nucleotide.C]
seq_complement(seq)
# [G, G, C, A, T]
seq_from_str("ATGC")
# [A, T, G, C]
seq_to_str_lower(seq)
# 'atgc'
seq_aa_from_str("MKYS")
# [Met, Lys, Tyr, Ser]
seq_aa_to_str( #...)
el = Element.Carbon
el.atomic_weight()
seq_weight(seq)
Utility functionality
- Sequence and nucleotide complements
- Sequence and nucleotide weight
- GC content, and misc general properties of elements and amino acids. ( e.g. hydrophobicity, weight, CPK colors)
- A small restriction enzyme library
We may add Sequence searches, and other utility features in the future.
This library is used by the PlasCAD plasmid editor and Daedalus molecule viewer.
Note: The Python version currently does not include restriction-enzyme and ligation functionality.
Dependencies
~0.4–0.9MB
~20K SLoC