File: na2aa.rb

package info (click to toggle)
ruby-bio 2.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,108 kB
  • sloc: ruby: 68,331; perl: 13; makefile: 11; sh: 1
file content (20 lines) | stat: -rwxr-xr-x 413 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env ruby
#
# na2aa.rb - translate any NA input into AA FASTA format
#
# Copyright::   Copyright (C) 2019 BioRuby Project
# License::     The Ruby License
#

require 'bio'

ARGV.each do |fn|
  Bio::FlatFile.open(fn) do |ff|
    ff.each do |entry|
      next if /\A\s*\z/ =~ ff.entry_raw.to_s
      na = entry.naseq
      aa = na.translate
      print aa.to_fasta(entry.definition, 70)
    end
  end
end