Sha256: 202d05ad97169c5f0e5c2540f3a486ae15e60be524c436a0884ebc60c23a6093
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
#!/usr/bin/ruby require 'fasta' require 'optparse' hash = { 'shuffle' => { 'method' => :aaseq_shuffle!, 'file_postfix' => Fasta::SHUFF_FILE_POSTFIX, }, 'invert' => { 'method' => :aaseq_invert!, 'file_postfix' => Fasta::INV_FILE_POSTFIX, }, } opt = {} OptionParser.new do |opts| opts.on("-p", "--prefix PREFIX", "add prefix to protein header") {|v| opt['p'] = v } end.parse! #opts = GetoptLong.new(["-p", "--prefix", GetoptLong::REQUIRED_ARGUMENT]) if ARGV.size < 2 puts " usage: #{File.basename(__FILE__)} [-p <prefix>] <method> <file>.fasta ... AA seq's will be modified according to <method>. Each file takes on a postfix (before the extension). -p prefix each protein's header will take on a header prefix after the '>'. Method FILE_POSTFIX (added before the file extension) shuffle #{hash['shuffle']['file_postfix']} invert #{hash['invert']['file_postfix']} " exit end prefix = nil; if opt.key?('p') then prefix = opt['p'] end method = ARGV.shift cmd_hash = nil if hash.key?(method) cmd_hash = hash[method] else puts "Not a defined method: #{method}" puts "type #{File.basename(__FILE__)} for usage" exit end ARGV.each do |fn| outfile = Fasta.modify_file(fn, cmd_hash['method'], cmd_hash['file_postfix'], prefix) puts "OUTPUT: #{outfile}" end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mspire-0.1.3 | bin/fasta_mod.rb |
mspire-0.1.5 | bin/fasta_mod.rb |
mspire-0.1.7 | bin/fasta_mod.rb |