Sha256: 4bffef28ae0d6e7e58ec50db5c6bf9f7a45485935b72a54b22aaba30add833c4

Contents?: true

Size: 468 Bytes

Versions: 1

Compression:

Stored size: 468 Bytes

Contents

#!/usr/bin/env ruby

require 'parse_fasta'
require 'bio'
require 'benchmark'

def parse_fasta fname
  File.open(fname, 'r').each_record do |header, sequence|
    [header, sequence.length].join("\t")
  end
end

def bioruby fname
  Bio::FastaFormat.open(fname).each do |entry|
    [entry.definition, entry.seq.length].join("\t")
  end
end

Benchmark.bmbm do |x|
  x.report('parse_fasta') { parse_fasta(ARGV.first) }
  x.report('bioruby')     { bioruby(ARGV.first) }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
parse_fasta-0.0.5 benchmark.rb