Sha256: d4420373062b3b75d128df1645ebecc1f8480a73c60afbc2cbd8790979cc51ae
Contents?: true
Size: 1.68 KB
Versions: 3
Compression:
Stored size: 1.68 KB
Contents
#!/usr/bin/ruby require 'fasta' require 'optparse' hash = { 'shuffle' => { 'method' => :aaseq_shuffle!, 'protein_header_prefix' => Fasta::SHUFF_PREFIX, 'file_postfix' => Fasta::CAT_SHUFF_FILE_POSTFIX, }, 'invert' => { 'method' => :aaseq_invert!, 'protein_header_prefix' => Fasta::INV_PREFIX, 'file_postfix' => Fasta::CAT_INV_FILE_POSTFIX, }, } opt = {} OptionParser.new do |opts| opts.on("-f", "--fraction FLOAT", "fraction") {|v| opt['f'] = v } end.parse! if ARGV.size < 2 puts " usage: #{File.basename(__FILE__)} [-f <fraction>] <method> <file>.fasta ... The AA seq's of (a fraction of) proteins will be modified according to <method> and concatenated to the end of the normal proteins. Each modified protein's header takes on a header prefix after the '>'. Each file takes on a postfix (before the extension). METHOD PROT_PREFIX FILE_POSTFIX shuffle #{hash['shuffle']['protein_header_prefix']} #{hash['shuffle']['file_postfix']} invert #{hash['invert']['protein_header_prefix']} #{hash['invert']['file_postfix']} " exit end method = ARGV.shift opt_h = nil if hash.key? method opth = hash[method] else abort "invalid method! choose: #{hash.keys.join(", ")}" end fraction = 1; if opt.key?('f') then fraction = opt['f'] end specific_method = opth['method'] file_postfix = opth['file_postfix'] protein_header_prefix = opth['protein_header_prefix'] #puts [file, specific_method, fraction, file_postfix, protein_header_prefix].join("*") ARGV.each do |file| outfile = Fasta.modify_fraction_and_cat_to_file(file, specific_method, fraction, file_postfix, protein_header_prefix) puts "OUTPUT: #{outfile}" end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mspire-0.1.3 | bin/fasta_cat_mod.rb |
mspire-0.1.7 | bin/fasta_cat_mod.rb |
mspire-0.1.5 | bin/fasta_cat_mod.rb |