summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2021-02-18 16:34:51 -0500
committerBrian Cully <bjc@kublai.com>2021-02-18 16:34:51 -0500
commitc7f2bd8f2c2da652baff5ebc35562f7567574c9e (patch)
tree75bb7d5d52acf684416c37d9c4955b7908e4ad16
parent737b94c65bf275ce66df24f65dfbf418d4835902 (diff)
downloadmolsim2-c7f2bd8f2c2da652baff5ebc35562f7567574c9e.tar.gz
molsim2-c7f2bd8f2c2da652baff5ebc35562f7567574c9e.zip
Get genome cloning working again.
-rw-r--r--codon.mjs8
-rw-r--r--genome.mjs8
2 files changed, 4 insertions, 12 deletions
diff --git a/codon.mjs b/codon.mjs
index 7cc5ea1..612e4ac 100644
--- a/codon.mjs
+++ b/codon.mjs
@@ -25,14 +25,6 @@ class Codon {
return this._elt
}
- get aaElt() {
- if (this._aaElt === undefined) {
- this._aaElt = document.createElement('div')
- this._aaElt.classList.add('amino-acid')
- }
- return this._aaElt
- }
-
lock() {
this.bases.forEach(n => n.lock())
this.aminoAcid.lock()
diff --git a/genome.mjs b/genome.mjs
index c90d10a..ed69dbf 100644
--- a/genome.mjs
+++ b/genome.mjs
@@ -9,14 +9,14 @@ class Genome {
}
}
- constructor(nucleotideGenerator) {
+ constructor(nucleotides) {
const codonList = document.createElement('ol')
this._boundNucleotideClickedHandler =
this.nucleotideClickedHandler.bind(this)
this.codons = []
let tmpCodon = []
- nucleotideGenerator.forEach(base => {
+ nucleotides.forEach(base => {
tmpCodon.push(base)
if (tmpCodon.length == 3) {
const c = new Codon(...tmpCodon)
@@ -55,11 +55,11 @@ class Genome {
unlock() {
this.elt.classList.remove('locked')
- this.coons.forEach(n => n.unlock())
+ this.codons.forEach(n => n.unlock())
}
clone() {
- return new Genome(this.codons.map(c => c.value))
+ return new Genome(this.codons.flatMap(c => c.bases.map(b => b.value)))
}
get selectedNucleotide() {