Sha256: 4fb98d2be18e7834456f827e7b8fadd3208c17b0ba28e4fd196076fb257465f1
Contents?: true
Size: 1.39 KB
Versions: 6
Compression:
Stored size: 1.39 KB
Contents
#!/usr/bin/env ruby require 'bio-maf' require 'bigbio' require 'optparse' require 'ostruct' options = OpenStruct.new options.parser = Bio::MAF::Parser OptionParser.new do |opts| opts.banner = "Usage: maf_to_fasta [options] <maf> <fasta>" opts.separator "" opts.separator "Options:" opts.on("-p", "--profile PROF", "Profile with PerfTools") do |prof| options.prof = prof end opts.on("--ruby-prof PATH", "Profile with ruby-prof") do |path| options.ruby_prof = path end opts.on("--profile-gc", "Profile GC") do |prof| options.profile_gc = true end opts.on("--parser PARSER", "parser") do |name| options.parser = Bio::MAF.const_get(name) end end.parse!(ARGV) src_path = ARGV.shift dst_path = ARGV.shift if options.prof require 'perftools' PerfTools::CpuProfiler.start(options.prof) elsif options.ruby_prof require 'ruby-prof' RubyProf.start end if options.profile_gc GC::Profiler.enable end parser = options.parser.new(src_path) writer = FastaWriter.new(dst_path) parser.each_block do |block| block.each_raw_seq do |seq| seq.write_fasta(writer) end end writer.close if options.profile_gc $stderr.puts GC::Profiler.result GC::Profiler.disable end if options.prof PerfTools::CpuProfiler.stop elsif options.ruby_prof res = RubyProf.stop printer = RubyProf::FlatPrinter.new(res) File.open(options.ruby_prof, 'w') do |f| printer.print(f) end end
Version data entries
6 entries across 6 versions & 1 rubygems