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

Version Path
mspire-sequest-0.2.7 script/fasta_ipi_to_ncbi-ish.rb
mspire-sequest-0.2.6 script/fasta_ipi_to_ncbi-ish.rb
mspire-sequest-0.2.5 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.2.1 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.1.2 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.1.1 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.1.0 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.24 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.23 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.22 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.21 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.20 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.18 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.17 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.16 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.15 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.14 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.13 script/fasta_ipi_to_ncbi-ish.rb
ms-sequest-0.0.12 script/fasta_ipi_to_ncbi-ish.rb