Sha256: 13f0f4d94f1538ee8987fed06be039e3d3ade4890e470345ec16fe18958e4bac
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
#!/usr/bin/env ruby require 'ostruct' require 'bio-maf' require 'bio-bgzf' $options = OpenStruct.new $options.dir = '.' $options.ref_only = true op = OptionParser.new do |opts| opts.banner = "Usage: maf_bgzip [options] [<maf> ...]" opts.separator "" opts.separator "Options:" opts.on("-d", "--dir DIR", "Directory to write compressed MAF to", "(default is current directory)") do |dir| $options.dir = dir end opts.on("-i", "--index", "Index MAF files after writing") do $options.index = true end opts.on("-a", "--all", "Index all sequences, not just reference seq", "(has no effect without --index)") do $options.ref_only = false end end op.parse!(ARGV) until ARGV.empty? maf_path = ARGV.shift maf_base = File.basename(maf_path) base = maf_base.gsub(/\.maf.*/, '') bgz_path = "#{$options.dir}/#{base}.maf.bgz" p = Bio::MAF::Parser.new(maf_path, :parse_extended => true, :parse_empty => true) File.open(bgz_path, 'w') do |out_f| Bio::BGZF::Writer.new(out_f) do |bgz_w| maf_w = Bio::MAF::Writer.new(bgz_w) maf_w.write_header(p.header) p.each_block do |block| maf_w.write_block(block) end end end p.close if $options.index p2 = Bio::MAF::Parser.new(bgz_path) idx_path = "#{$options.dir}/#{base}.kct" Bio::MAF::KyotoIndex.build(p2, idx_path, $options.ref_only) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bio-maf-1.0.0-java | bin/maf_bgzip |
bio-maf-1.0.0 | bin/maf_bgzip |