I'm a beginner mathematica programmer and I am tryin to create my first demonstration. This code should represent what happens if one changes the size of the reading frame, calculating the nucleotide percentage in random DNA.
When I run it, it stays in an infinite loop.
Manipulate[
SeedRandom[1234];
Dnasize = 1000;
dnalist = RandomChoice[{A, T, G, C}, Dnasize];
plist = Partition[dnalist, partition];
iterationmax = Dnasize/partition;
As = {};
Ts = {};
Gs = {};
Cs = {};
GCs = {};
For[i = 1, i < iterationmax + 1, i++,
AppendTo[As, Count[plist[[i]], A]];
AppendTo[Gs, Count[plist[[i]], G]];
AppendTo[Ts, Count[plist[[i]], T]];
AppendTo[Cs, Count[plist[[i]], C]];
AppendTo[
GCs, (Gs[[i]] + Cs[[i]])/(As[[i]] + Gs[[i]] + Cs[[i]] + Ts[[i]])]
]
ListLinePlot[GCs,
PlotLegends -> {"GC content across the molecule"}], {partition, 50,
100}
]
Any help appreciated.