Bioinformatics/Sequence mutation: Difference between revisions

Content added Content deleted
(Changing the representation of a DNA sequence from a sequence of Base to a string, as requested. Updated procedures to work with a string rather than a sequence.)
m (Replaced the ugly "ord(Base.other) - 1" by "MaxBaseVal".)
Line 1,459:
 
of mutSwap:
let newBase = Base(rand(ord(Base.Other) - 1MaxBaseVal))
echo fmt"Changing base at position {idx + 1} from {dnaSeq[idx]} to {newBase}"
dnaSeq[idx] = newBase.toChar
Line 1,468:
 
of mutInsert:
let newBase = Base(rand(ord(Base.Other) - 1MaxBaseVal))
echo fmt"Inserting base {newBase} at position {idx + 1}"
dnaSeq.insert($newBase, idx)