class Gene
def initialize(seq, info)
@seq = seq
@info = info
@ei_marks = [0] + srch_ei_recursively(0)
end
def ex_N
@ei_marks.size/2 + 1
end
def in_N
@ei_makrs.size/2
end
def exon(index)
if (index*2) < @ei_marks.size - 1
@seq[@ei_marks[index*2]...@ei_marks[index*2 + 1]]
else
@seq[@ei_marks[index*2]...@seq.size]
end
end
def intron(index)
@seq[(@ei_marks[index*2 + 1])...(@ei_marks[index*2 + 2])]
end
def test
@ei_marks
end
private
def srch_ei_recursively(beg)
beg_value = @seq[beg].to_i
inter_value = 96.5 # the value of 'Z' is 96
for i in beg...@seq.size
if (((beg_value - inter_value)*(@seq[i].to_i - inter_value)) < 0)
return [i] + srch_ei_recursively(i)
end
end
return []
end
# end of private methods
end
Subscribe to Posts [Atom]