Class: CdHitParser
- Inherits:
-
Object
- Object
- CdHitParser
- Defined in:
- lib/bio-cd-hit-report/parser.rb
Instance Attribute Summary collapse
-
#report_file ⇒ Object
Returns the value of attribute report_file.
Instance Method Summary collapse
Instance Attribute Details
#report_file ⇒ Object
Returns the value of attribute report_file.
2 3 4 |
# File 'lib/bio-cd-hit-report/parser.rb', line 2 def report_file @report_file end |
Instance Method Details
#each {|Cluster.new(:name => header, :data => data)| ... } ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bio-cd-hit-report/parser.rb', line 4 def each data,header = nil, nil File.open(report_file).each do |line| if line[0].chr == '>' yield Cluster.new(:name => header,:data => data) if data data = '' header = line[1..-1].strip else data << line end end yield Cluster.new(:name => header, :data => data) end |