(phixonline)-->
string dna = repeat(' ',200+rand(300))
for i=1 to length(dna) do dna[i] = "ACGT"[rand(4)] end for
procedure show()
sequence acgt = repeat(0,5)
for i=1 to length(dna) do
acgt[find(dna[i],"ACGT")] += 1
end for
acgt[$] = sum(acgt)
sequence s = split(trim(join_by(split(join_by(dna,1,10,""),"\n"),1,5," ")),"\n")
for i=1 to length(s) do
printf(1,"%3d: %s\n",{(i-1)*50+1,s[i]})
end for
printf(1,"\nBase counts: A:%d, C:%d, G:%d, T:%d, total:%d\n",acgt)
end procedure
procedure mutate()
printf(1,"\n")
for i=1 to 10 do
integer p = rand(length(dna)),
sdi = "SDI"[rand(3)],
rep = "ACGT"[rand(4)],
was = dna[p]
switch sdi do
case 'S':dna[p] = rep printf(1,"swapped %c at %d for %c\n",{was,p,rep})
case 'D':dna[p..p] = "" printf(1,"deleted %c at %d\n",{was,p})
case 'I':dna[p..p-1] = ""&rep printf(1,"inserted %c at %d, before %c\n",{rep,p,was})
end switch
end for
printf(1,"\n")
end procedure
show()
mutate()
show()