Skip to main content

Module seq

Module seq 

Source
Expand description

Sequence utilities that operate on raw &[u8] slices.

Everything here is case-preserving and allocation-free unless the return type says otherwise, so these helpers can be used inside hot loops.

Structs§

BaseCounts
Per-base counts of a nucleotide sequence, case-insensitive.

Enums§

Alphabet
A residue alphabet used for validation.

Functions§

canonical_kmer
Canonical k-mer: the lexicographically smaller of a k-mer and its reverse complement, so that both strands hash to the same value.
complement
Complement a single nucleotide as DNA, preserving case.
complement_rna
Complement a single nucleotide as RNA: A becomes U, not T.
gc_content
GC fraction of a sequence, ignoring ambiguity codes.
hamming_distance
Hamming distance between two equal-length sequences, case-insensitive.
kmers
Iterator over the overlapping k-mers of a sequence.
make_uppercase
Uppercase a sequence in place (soft-masked genomes use lowercase for repeats).
n50
N50 of a set of lengths: the length L such that contigs of at least L cover half of the total assembly length.
nx
Generalised N-statistic: nx(lengths, 0.9) is the N90.
reverse_complement
Reverse complement of a nucleotide sequence, as DNA.
reverse_complement_in_place
Reverse complement a sequence in place.
reverse_complement_into
Reverse complement into an existing buffer, which is cleared first.
reverse_complement_rna
Reverse complement of a nucleotide sequence, as RNA.
rna_to_dna
Replace U/u with T/t, turning RNA into DNA in place.
translate
Translate a nucleotide sequence into a protein sequence.
translate_codon
Translate a single codon using the standard genetic code.