Skip to content
Snippets Groups Projects
Commit 7e8bdf38 authored by Martin Larralde's avatar Martin Larralde
Browse files

Add `Alphabet::as_str` method to get all symbols from an alphabet

parent 53da5b92
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,9 @@ pub trait Alphabet: Debug + Copy + Default + 'static {
/// Get all the symbols of this alphabet.
fn symbols() -> &'static [Self::Symbol];
/// Get a string with all symbols from this alphabet.
fn as_str() -> &'static str;
}
// --- ComplementableAlphabet --------------------------------------------------
......@@ -94,6 +97,10 @@ impl Alphabet for Dna {
Nucleotide::N,
]
}
fn as_str() -> &'static str {
b"ACTGN"
}
}
/// A deoxyribonucleotide.
......@@ -201,6 +208,10 @@ impl Alphabet for Protein {
AminoAcid::X,
]
}
fn as_str() -> &'static str {
"ACDEFGHIKLMNPQRSTVWYX"
}
}
/// A proteinogenic amino acid.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment