Anonymous user
Bioinformatics/base count: Difference between revisions
m
→{{header|REXX}}: added whitespace.
m (→{{header|REXX}}: (internal only) changed the DNA sequence to lowercase; output DNA sequence is still uppercase.) |
m (→{{header|REXX}}: added whitespace.) |
||
Line 969:
dna= space(dna, 0); upper dna /*elide blanks from DNA; uppercase it. */
say '────────length of the DNA string: ' length(dna)
@.=
w= 1 /*the maximum width of a base count. */
$= /*a placeholder for the names of bases.*/
do j=1 for length(dna) /*traipse through the DNA string. */
_= substr(dna, j, 1) /*obtain a base name from the DNA str. */
if pos(_, $)==0 then $= $ ||
@._= @._ + 1 /*bump the count of this base. */
w= max(w, length(@._) ) /*compute the maximum width number. */
Line 983:
say ' base ' z " has a basecount of: " right(@.z, w)
@.tot= @.tot + @.z /*add to a grand total to verify count.*/
say
▲say /*stick a fork in it, we're all done. */
say '────────total for all basecounts:' right(@.tot, w+1)</lang>
{{out|output|text= when using the default input:}}
|