Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added solution for subs

  • Loading branch information...
commit dafb2c259f3bfdf7b03b5cba086a9f565fa87edc 1 parent deed401
@jvoorhis authored
Showing with 11 additions and 0 deletions.
  1. +2 −0  data/rosalind_subs.txt
  2. +9 −0 src/subs.rb
View
2  data/rosalind_subs.txt
@@ -0,0 +1,2 @@
+GAGGCTGCCCAGAGGCTGGAGGCTGACAGCCAGGTATTTAGAGGCTGAGAGGCTGAGAGGCTGGAGGCTGGAGGCTGATCCCATGTGTGAGGCTGGAGGCTGAGAGGCTGTGCGCGAGGCTGGAGGCTGGGAGGCTGGGACTTATGAGGCTGAGAGGCTGAGGACGTGAGGCTGGAGGCTGGAGGCTGTAACCACACGTTAAGAGGCTGTCGAGGCTGGCGAGGCTGGATGGTTCACGAGGCTGAAGATTGAGGCTGTTCGAGGCTGGAGGCTGCCCATCCGGAGGCTGCGTGAGGCTGCGAGGCTGTGTTGAGGCTCTTCCTAGAGGCTGGAGGCTGATTAAGGAGGCTGGATAGAATGAGGCTGGTGCAGCAAGCGAGGCTGTGCCGAGGCTGGTGGTTGGAGGCTGGAGGCTGATACGAGGCTGAGACGGATGGAGGCTGGAGGCTGGTGAGGCTGCGGTAGGAGGCTGCACAGAGGCTGTGAGGCTGTGATGAGGCTGGAGGCTGCTATGAGGCTGGAGGCTGGCCAAGTGCCGAAGAGGCTGGGAGGCTGGAGGCTGAGTTCGGAGGCTGAGGAGGCTGGGAGGCTGTGTCGCTTTTGTGAGGCTGGAGGCTGGAGAGGCTGCGTGTACGAGGCTGCATCAGAGGCTGGCCTGCAGAGGCTGATGAGGCTGGCCCAGATGAGGCTGGAGGCTGAGAGGCTGTCTATGAGGCTGGAGGCTGAAGTGTGAGAGGCTGACCTTGAGGCTGTCGAGGCTGAAGAGGCTGGGGAGGCTGGAGGCTGGAGGCTGGAAGAGGCTGAGGAAGGAGGCTGCGCAGAGGCTGTCTCATGAGGCTGTGAGGCTGGAGGCTG
+GAGGCTGGA
View
9 src/subs.rb
@@ -0,0 +1,9 @@
+dna="GAGGCTGCCCAGAGGCTGGAGGCTGACAGCCAGGTATTTAGAGGCTGAGAGGCTGAGAGGCTGGAGGCTGGAGGCTGATCCCATGTGTGAGGCTGGAGGCTGAGAGGCTGTGCGCGAGGCTGGAGGCTGGGAGGCTGGGACTTATGAGGCTGAGAGGCTGAGGACGTGAGGCTGGAGGCTGGAGGCTGTAACCACACGTTAAGAGGCTGTCGAGGCTGGCGAGGCTGGATGGTTCACGAGGCTGAAGATTGAGGCTGTTCGAGGCTGGAGGCTGCCCATCCGGAGGCTGCGTGAGGCTGCGAGGCTGTGTTGAGGCTCTTCCTAGAGGCTGGAGGCTGATTAAGGAGGCTGGATAGAATGAGGCTGGTGCAGCAAGCGAGGCTGTGCCGAGGCTGGTGGTTGGAGGCTGGAGGCTGATACGAGGCTGAGACGGATGGAGGCTGGAGGCTGGTGAGGCTGCGGTAGGAGGCTGCACAGAGGCTGTGAGGCTGTGATGAGGCTGGAGGCTGCTATGAGGCTGGAGGCTGGCCAAGTGCCGAAGAGGCTGGGAGGCTGGAGGCTGAGTTCGGAGGCTGAGGAGGCTGGGAGGCTGTGTCGCTTTTGTGAGGCTGGAGGCTGGAGAGGCTGCGTGTACGAGGCTGCATCAGAGGCTGGCCTGCAGAGGCTGATGAGGCTGGCCCAGATGAGGCTGGAGGCTGAGAGGCTGTCTATGAGGCTGGAGGCTGAAGTGTGAGAGGCTGACCTTGAGGCTGTCGAGGCTGAAGAGGCTGGGGAGGCTGGAGGCTGGAGGCTGGAAGAGGCTGAGGAAGGAGGCTGCGCAGAGGCTGTCTCATGAGGCTGTGAGGCTGGAGGCTG".chars.to_a
+motif="GAGGCTGGA".chars.to_a
+i=0
+loc=[]
+dna.each_cons(motif.size) { |chars|
+ i += 1
+ loc << i if chars == motif
+}
+puts loc.join(' ')

0 comments on commit dafb2c2

Please sign in to comment.
Something went wrong with that request. Please try again.