X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fruby%2Fevoruby%2Flib%2Fevo%2Ftool%2Fmulti_sequence_extractor.rb;h=e56ea8a2df0a4c4842397f148f451a34724954a8;hb=f7f405fad4bc9dc65154cef12d11b47decc6e3f1;hp=ffabc45cb9eb61005d2cf4f5bd22fe3795756889;hpb=599a0dfe599da928ccfe1a8bcba65dd78c21422c;p=jalview.git diff --git a/forester/ruby/evoruby/lib/evo/tool/multi_sequence_extractor.rb b/forester/ruby/evoruby/lib/evo/tool/multi_sequence_extractor.rb index ffabc45..e56ea8a 100644 --- a/forester/ruby/evoruby/lib/evo/tool/multi_sequence_extractor.rb +++ b/forester/ruby/evoruby/lib/evo/tool/multi_sequence_extractor.rb @@ -41,6 +41,10 @@ module Evoruby NORMALIZED_IDS_MAP_SUFFIX = ".nim" PROTEINS_LIST_FILE_SEPARATOR = "\t" + def initialize() + @file_to_msa = Hash.new + @seqs = 0 + end def run() @@ -245,6 +249,7 @@ module Evoruby puts basename File.open( input_file ) do | file | + species_counter = 1 while line = file.gets line.strip! if !Util.is_string_empty?( line ) && !(line =~ /\s*#/ ) @@ -286,8 +291,9 @@ module Evoruby print_counts( per_species_counter, log, Constants::LINE_DELIMITER ) per_species_counter = 0 end - puts " " + current_species + " [" + my_readlink + "]" - log << current_species + " [" + my_readlink + "]" + Constants::LINE_DELIMITER + puts " " + species_counter.to_s + ": " + current_species + " [" + my_readlink + "]" + log << species_counter.to_s + ": " + current_species + " [" + my_readlink + "]" + Constants::LINE_DELIMITER + species_counter += 1 end puts " " + seq_name log << " " + seq_name + Constants::LINE_DELIMITER @@ -464,8 +470,6 @@ module Evoruby Util.fatal_error( PRG_NAME, "error: " + e.to_s ) end end - - end @@ -537,6 +541,10 @@ module Evoruby end def read_fasta_file( input ) + if @file_to_msa.has_key?( input ) + return @file_to_msa[ input ] + end + f = MsaFactory.new() msa = nil begin @@ -544,6 +552,11 @@ module Evoruby rescue Exception => e Util.fatal_error( PRG_NAME, "error: " + e.to_s ) end + if @seqs <= 10000000 + @file_to_msa[ input ] = msa + @seqs += msa.get_number_of_seqs + puts " total seqs in memory: " + @seqs.to_s + end msa end