[BioRuby-cvs] bioruby/lib/bio/db/genbank format_genbank.rb, 1.1.2.3, 1.1.2.4
Naohisa Goto
ngoto at dev.open-bio.org
Wed May 28 13:26:35 UTC 2008
Update of /home/repository/bioruby/bioruby/lib/bio/db/genbank
In directory dev.open-bio.org:/tmp/cvs-serv13124/lib/bio/db/genbank
Modified Files:
Tag: BRANCH-biohackathon2008
format_genbank.rb
Log Message:
simplify sequence formatting routine
Index: format_genbank.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/Attic/format_genbank.rb,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** format_genbank.rb 7 May 2008 12:28:56 -0000 1.1.2.3
--- format_genbank.rb 28 May 2008 13:26:33 -0000 1.1.2.4
***************
*** 102,111 ****
# formats sequence lines as GenBank
! def each_genbank_seqline(str) #:yields: counter, seqline
i = 1
! a = str.scan(/.{1,60}/) do |s|
! yield i, s.gsub(/(.{1,10})/, " \\1")
i += 60
end
end
--- 102,114 ----
# formats sequence lines as GenBank
! def seq_format_genbank(str)
i = 1
! result = str.gsub(/.{1,60}/) do |s|
! s = s.gsub(/.{1,10}/, ' \0')
! y = sprintf("%9d%s\n", i, s)
i += 60
+ y
end
+ result
end
***************
*** 129,135 ****
<%= format_features_genbank(features || [])
%>ORIGIN
! <% each_genbank_seqline(seq) do |i, s|
! %><%= sprintf('%9d', i) %><%= s %>
! <% end %>//
__END_OF_TEMPLATE__
--- 132,137 ----
<%= format_features_genbank(features || [])
%>ORIGIN
! <%= seq_format_genbank(seq)
! %>//
__END_OF_TEMPLATE__
More information about the bioruby-cvs
mailing list