[BioRuby-cvs] bioruby/lib/bio/db/embl format_embl.rb, 1.1.2.4, 1.1.2.5
Naohisa Goto
ngoto at dev.open-bio.org
Wed May 28 13:38:09 UTC 2008
Update of /home/repository/bioruby/bioruby/lib/bio/db/embl
In directory dev.open-bio.org:/tmp/cvs-serv13173/lib/bio/db/embl
Modified Files:
Tag: BRANCH-biohackathon2008
format_embl.rb
Log Message:
simplify code of seq_format_embl(), and SQ line is changed not to show
non-ACGT single base contents (which should be shown together as "other").
Index: format_embl.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/Attic/format_embl.rb,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** format_embl.rb 7 May 2008 12:24:26 -0000 1.1.2.4
--- format_embl.rb 28 May 2008 13:38:07 -0000 1.1.2.5
***************
*** 106,121 ****
def seq_format_embl(seq)
- output_lines = Array.new
counter = 0
! remainder = seq.window_search(60,60) do |subseq|
! counter += 60
! subseq.gsub!(/(.{10})/, '\1 ')
! output_lines.push(' '*5 + subseq + counter.to_s.rjust(9))
end
! counter += remainder.length
! remainder = (remainder.to_s + ' '*(60-remainder.length))
! remainder.gsub!(/(.{10})/, '\1 ')
! output_lines.push(' '*5 + remainder + counter.to_s.rjust(9))
! return output_lines.join("\n")
end
--- 106,126 ----
def seq_format_embl(seq)
counter = 0
! result = seq.gsub(/.{1,60}/) do |x|
! counter += x.length
! x = x.gsub(/.{10}/, '\0 ')
! sprintf(" %-66s%9d\n", x, counter)
end
! result.chomp!
! result
! end
!
! def seq_composition(seq)
! { :a => seq.count('aA'),
! :c => seq.count('cC'),
! :g => seq.count('gG'),
! :t => seq.count('tTuU'),
! :other => seq.count('^aAcCgGtTuU')
! }
end
***************
*** 140,144 ****
FH
<%= format_features_embl(features || []) %>XX
! SQ Sequence <%= seq.length %> BP; <%= seq.composition.collect{|k,v| "#{v} #{k.upcase}"}.join('; ') + '; ' + (seq.gsub(/[ACTGactg]/, '').length.to_s ) + ' other;' %>
<%= seq_format_embl(seq) %>
//
--- 145,149 ----
FH
<%= format_features_embl(features || []) %>XX
! SQ Sequence <%= seq.length %> BP; <% c = seq_composition(seq) %><%= c[:a] %> A; <%= c[:c] %> C; <%= c[:g] %> G; <%= c[:t] %> T; <%= c[:other] %> other;
<%= seq_format_embl(seq) %>
//
More information about the bioruby-cvs
mailing list