Bioinformatics/Subsequence: Difference between revisions
Added Arturo implementation
Drkameleon (talk | contribs) (Added Arturo implementation) |
|||
Line 89:
Found at position: 371..374
Found at position: 380..383</pre>
=={{header|Arturo}}==
<lang rebol>bases: [`A` `G` `C` `T`]
randSeq: join map 1..200 => [sample bases]
randSub: join map 1..4 => [sample bases]
idx: 0
print "Random sequence:"
print join.with:"\n" split.every: 20 randSeq
print ""
print "Looking for subsequence:"
print randSub
print ""
while [(size randSeq) > idx + 4][
if prefix? slice randSeq idx idx+4 randSub ->
print ["Found subsequence at position:" idx]
idx: idx + 1
]</lang>
{{out}}
<pre>Random sequence:
CACGCGCGTTAACCCTGCAT
CTTTTCTCTAAGATGATGCG
CTACTCTGCCCGATTACTAT
GATGTCACCGGCGGTTCGGC
GACTGGCGCTGGCAGAAAGC
GCATGTCAAATTGCCCCAGT
GTGCAAGTCCAAGTATTAGT
GAGGTGCTCCGCTTCGTCCG
GGGTCGACTCGGTCCCACTT
CATTACATGTTGGTAATAGT
Looking for subsequence:
CGGT
Found subsequence at position: 71
Found subsequence at position: 169</pre>
=={{header|Factor}}==
|