Bioinformatics/base count: Difference between revisions
→{{header|REXX}}: Refurbished (better variable names and no Upper instruction)
(add RPL) |
Walterpachl (talk | contribs) (→{{header|REXX}}: Refurbished (better variable names and no Upper instruction)) |
||
Line 2,940:
=={{header|REXX}}==
A little extra boilerplate was added to verify correct coding of the bases in a DNA string and the alignment of the (totals) numbers.
<syntaxhighlight lang="rexx">/*REXX program finds the number of each
if dna=='' | dna=="," then dna= 'cgtaaaaaattacaacgtcctttggctatctcttaaactcctgctaaatg' ,▼
If dna==''|dna==',' Then
'ctcgtgctttccaattatgtaagcgttccgagacggggtggtcgattctg' ,▼
'aggacaaaggtcaagatggagcgcatcgaacgcaataaggatcatttgat' ,▼
'gggacgtttcgtcgacaaagtcttgtttcgagagtaacggctaccgtctt' ,▼
'cgattctgcttataacactatgttcttatgaaatggatgttctgagttgg' ,▼
'tcagtcccaatgtgcggggtttcttttagtacgtcgggagtggtattata' ,▼
'tttaatttttctatatagcgatctgtatttaagcaattcatttaggttat' ,▼
'cgccgcgatgctcggttcggaccgccaagcatctggctccactgctagtg' ,▼
'tcctaaatttgaatggcaaacacaaataagatttagcaattcgtgtagac' ,▼
'gaccggggacttgcatgatgggagcagctttgttaaactacgaacgtaat'▼
dna= space(dna, 0); upper dna /*elide blanks from DNA; uppercase it. */▼
say '────────length of the DNA string: ' length(dna)▼
▲@.= 0 /*initialize the count for all bases. */
w=1
names=''
Do j=1 To
If pos(name,names)==0 Then
w= max(w, length(@._) ) /*compute the maximum width number. */▼
names=names||name /* if not found, add it to the list */
count.name=count.name+1 /* bump the count of this base. */
End
Say
Do k=0 To 255
@.tot= @.tot + @.z /*add to a grand total to verify count.*/▼
If pos(z,names)>0 Then Do
End
End
Say
Say '--------total for all basecounts:' right(count.tot,w+1)
</syntaxhighlight>
{{out|output|text= when using the default input:}}
<pre>
Line 2,982 ⟶ 2,988:
────────total for all basecounts: 500
</pre>
=={{header|Ring}}==
<syntaxhighlight lang="ring">
|