Crates.io | na_seq |
lib.rs | na_seq |
version | 0.3.7 |
created_at | 2024-10-06 19:17:58.223989+00 |
updated_at | 2025-09-20 22:47:27.869266+00 |
description | DNA, RNA, and amino acid sequence types and functions |
homepage | |
repository | https://github.com/David-OConnor/seq |
max_upload_size | |
id | 1399295 |
size | 81,375 |
This Rust and Python library contains types and functions used for performing operations on DNA 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( #...)
seq_weight(seq)
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.