Sha256: e35d238fddc207fddc444596ca953c054a144fb1d4a4cce4e5322ab47556f624

Contents?: true

Size: 927 Bytes

Versions: 7

Compression:

Stored size: 927 Bytes

Contents

#!/usr/bin/ruby

require 'ms/fasta'
require 'transmembrane/phobius.rb'

if ARGV.size != 3
  puts "usage: #{File.basename(__FILE__)} <max#tm> phobius_file_short <file>.fasta"
  puts "max#tm = max # of transmembrane sequences allowed to be a non-transmembrane."
  puts ""
  puts "outputs: <file>_NONTM.fasta"
  exit
end

(max_num_tm, phobius_short_file, fasta_db_file) = ARGV
max_num_tm = max_num_tm.to_i

base = fasta_db_file.chomp(File.extname(fasta_db_file))
outfile = base + "_NONTM.fasta"

index = Phobius::Index.new(phobius_short_file)

File.open(outfile, 'w') do |out|
  Ms::Fasta.open(fasta_db_file) do |fasta|
    fasta.each do |entry|
      key = index.reference_to_key(entry.header)
      abort "can't find key: #{key} for #{entry.header}"  unless index.key?(key)
      num_tms = index[key][:num_certain_transmembrane_segments]
      if num_tms <= max_num_tm
        out.print entry.to_s
      end
    end
  end
end


Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ms-error_rate-0.0.13 bin/phobius_to_nontransmembrane.rb
ms-error_rate-0.0.12 bin/phobius_to_nontransmembrane.rb
ms-error_rate-0.0.11 bin/phobius_to_nontransmembrane.rb
ms-error_rate-0.0.10 bin/phobius_to_nontransmembrane.rb
ms-error_rate-0.0.9 bin/phobius_to_nontransmembrane.rb
ms-error_rate-0.0.8 bin/phobius_to_nontransmembrane.rb
ms-error_rate-0.0.7 bin/phobius_to_nontransmembrane.rb