Please go easy on me... i'm just a beginner.
o.k - my problem is that I want to calculate how many times a 'G' or 'C' occurs on the 3rd position in a piece of DNA starting from the first base..
e.g. CTCCGGATCTAT A C/G is present on 3/4 3rd positions = 75%.
i am struggling a bit.
I can't think how to get the code to loop to every third base! Any help greatly appreciated.for ($i = 1; $i < @dna; $i++) { if ($dna[$i+3] eq 'C') { $counter++; } elsif ($dna[$i+3] eq 'G') { $counter++; } }
update (broquaint): title change (was for loops) and added formatting
In reply to Count every 3rd base occurence by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |