Permalink
Browse files

fixed CAF parser to be Ruby 1.8.6 compatible

  • Loading branch information...
fstrozzi committed Jan 12, 2011
1 parent 126f5b0 commit b30db0bced0027a2615910e23c84e2a2eed53ffe
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/bio-assembly/caf.rb
View
@@ -38,9 +38,10 @@ class Read < Bio::Assembly::Read
private
def parse_blocks(line,feat)
- case true
- when line.start_with?("DNA") then parse_dna(feat)
- when line.start_with?("Sequence") then parse_seq(feat,line)
+ keywords = line.split("\s")
+ case keywords[0]
+ when "DNA" then parse_dna(feat)
+ when "Sequence" then parse_seq(feat,line)
end
return feat
end
@@ -58,12 +59,13 @@ def parse_seq(feat,line)
feat[:name] = line.split(":")[1].tr("\s|\n","")
sequence_block = @file.gets("\n\n")
sequence_block.split("\n").each do |l|
- case true
- when l.start_with?("Clipping") then parse_clipping(feat,l)
- when l.start_with?("Strand") then parse_strand(feat,l)
- when l.start_with?("Assembled_from") then parse_af(feat,l)
- when l.start_with?("Is_read") then feat[:type] = :read
- when l.start_with?("Is_contig") then feat[:type] = :contig
+ keywords = l.split("\s")
+ case keywords[0]
+ when "Clipping" then parse_clipping(feat,l)
+ when "Strand" then parse_strand(feat,l)
+ when "Assembled_from" then parse_af(feat,l)
+ when "Is_read" then feat[:type] = :read
+ when "Is_contig" then feat[:type] = :contig
end
end
feat[:parsed] = true if feat[:type] == :read

0 comments on commit b30db0b

Please sign in to comment.