Sha256: 9bf2a5935b42939fe04b914f1928d3ae608f2f99174cc4b88a3116158e2ed31a
Contents?: true
Size: 873 Bytes
Versions: 19
Compression:
Stored size: 873 Bytes
Contents
#!/usr/bin/ruby if ARGV.size == 0 puts "usage: #{File.basename(__FILE__)} <file>.fasta ..." puts "outputs: <file>_NCBI.fasta ..." puts "" puts "(Bioworks 3.3.1 [maybe others] does not seem to read an IPI" puts "formatted fasta database header lines. This will change an" puts "IPI format to an NCBI style format that Bioworks can read." exit end ARGV.each do |file| base = file.chomp(File.extname(file)) outfile = base + '_NCBI' + ".fasta" File.open(outfile, 'w') do |out| IO.foreach(file) do |line| if line =~ /^>/ (codes, *description) = line[1..-1].split(" ") description = description.join(" ") code_section = codes.split('|').map {|code| (key, val) = code.split(':') ; "#{key}|#{val}|" }.join out.puts ">#{code_section} #{description}" else out.print line end end end end
Version data entries
19 entries across 19 versions & 2 rubygems