class BioDSL::Usearch::IO
Public Instance Methods
each(format = :uc) { |e| ... }
click to toggle source
Parse a given type of Uclust
format and yield the result.
@param format [Symbol] Format type to parse.
# File lib/BioDSL/usearch.rb, line 266 def each(format = :uc) case format when :uc then each_uc { |e| yield e } else fail UsearchError, "Unknown iterator format: #{format}" end end
each_uc() { |record| ... }
click to toggle source
Parse each UC type record and yield the result.
@yield [Hash] BioDSL
record with UC result.
# File lib/BioDSL/usearch.rb, line 279 def each_uc @io.each do |line| fields = line.chomp.split("\t") record = {TYPE: fields[0], CLUSTER: fields[1].to_i} case fields[0] when 'C' then record[:CLUSTER_SIZE] = fields[2].to_i else record[:SEQ_LEN] = fields[2].to_i end record[:IDENT] = fields[3].to_f if fields[0] == 'H' record[:STRAND] = fields[4] record[:CIGAR] = fields[7] record[:Q_ID] = fields[8] record[:S_ID] = fields[9] if fields[0] == 'H' yield record end end