[BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.3,1.4
Mitsuteru C. Nakao
nakao at pub.open-bio.org
Thu Oct 27 22:08:12 EDT 2005
Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin
In directory pub.open-bio.org:/tmp/cvs-serv10873/lib/bio/shell/plugin
Modified Files:
seq.rb
Log Message:
* Changed way to print output (puts -> display).
* Now returns the pretty DNA sequence in String.
Index: seq.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** seq.rb 23 Sep 2005 15:51:59 -0000 1.3
--- seq.rb 28 Oct 2005 02:08:10 -0000 1.4
***************
*** 100,104 ****
--- 100,108 ----
end
+ # Reterns and displays a DNA sequence pretty printing
+ # in B-type double helix.
+ # Argument ``seq'' required at least 16 bases length.
def double_helix(seq)
+ str = ''
m = [[5, 0], [4, 2], [3, 3], [2, 4],
[1, 4], [0, 3], [0, 2], [1, 0]]
***************
*** 106,116 ****
m.each_with_index do |mij, x|
base = subseq[x, 1]
! puts ' ' * mij[0] + base + '-' * mij[1] + base.complement
end
m.reverse.each_with_index do |mij, x|
base = subseq[x + 8, 1]
! puts ' ' * mij[0] + base.complement + '-' * mij[1] + base
end
end
end
--- 110,122 ----
m.each_with_index do |mij, x|
base = subseq[x, 1]
! str << ' ' * mij[0] + base + '-' * mij[1] + base.complement + "\n"
end
m.reverse.each_with_index do |mij, x|
base = subseq[x + 8, 1]
! str << ' ' * mij[0] + base.complement + '-' * mij[1] + base + "\n"
end
end
+ display(str)
+ return str
end
More information about the bioruby-cvs
mailing list