summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2021-02-19 15:21:27 -0500
committerBrian Cully <bjc@kublai.com>2021-02-19 15:21:27 -0500
commited2b76634a6fb1a9fb45abdd7afc7342f5b6f12c (patch)
treedd323eacb14b0d2daf849b09d8ec1422989eba63
parent11ab02da706e0c3b60c363325eabdf88e47ea522 (diff)
downloadmolsim2-ed2b76634a6fb1a9fb45abdd7afc7342f5b6f12c.tar.gz
molsim2-ed2b76634a6fb1a9fb45abdd7afc7342f5b6f12c.zip
Add length getter for genome.
-rw-r--r--genome.mjs6
1 files changed, 6 insertions, 0 deletions
diff --git a/genome.mjs b/genome.mjs
index 7550cf6..bb5c09a 100644
--- a/genome.mjs
+++ b/genome.mjs
@@ -43,6 +43,12 @@ class Genome {
}, [])
}
+ get length() {
+ return this.codons.reduce((acc, c) => {
+ return acc + c.bases.length
+ }, 0)
+ }
+
get onNucleotideSelectionChanged() {
if (this._onNucleotideSelectionChanged !== undefined) {
return this._onNucleotideSelectionChanged