a = Array.new(size)
for i in 0...size
a[i].new(...)
end
Labels: tips
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
irb(main):001:0> a = "he l lo !"
=> "he l lo !"
irb(main):002:0> a.delete!(" ", "a")
=> nil
irb(main):003:0> a
=> "he l lo !"
irb(main):004:0> a.delete!(" ")
=> "hello!"
irb(main):005:0>
irb(main):001:0> "he ll o\n".delete('\n')
=> "he ll o\n"
irb(main):002:0> "he ll o\n".delete("\n")
=> "he ll o"
irb(main):003:0> printf('\n')
\n=> nil
irb(main):004:0> printf("\n")
=> nil
irb(main):005:0>
irb(main):001:0> 98.chrreference
=> "b"
testfile = File.new("testfile", "w")
a = 5
for i in 1..10 do
testfile.printf("%0#{a}d \n", i)
end
Subscribe to Posts [Atom]