#! /usr/bin/env ruby genes = File.open(ARGV[0], "r") h = {} re = /^>/ st = 0 orf = "" lnum = 0 preorf = "" genes.each{|l| if l =~ re preorf = orf orf = l.split(' ')[0][1..-1] # p preorf # p lnum + 1 # p st h[orf] = [st,0] h[preorf][1] = lnum + 1 if h[preorf] lnum = 0 else lnum += 1 st = genes.pos end } h[orf][1] = lnum + 1 index = File.open(ARGV[1],"w") Marshal.dump(h,index)