git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
inprogress
[jalview.git]
/
forester
/
ruby
/
evoruby
/
lib
/
evo
/
tool
/
multi_sequence_extractor.rb
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
(file)
--- 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"
NORMALIZED_IDS_MAP_SUFFIX = ".nim"
PROTEINS_LIST_FILE_SEPARATOR = "\t"
+ def initialize()
+ @file_to_msa = Hash.new
+ @seqs = 0
+ end
def run()
def run()
@@
-245,6
+249,7
@@
module Evoruby
puts basename
File.open( input_file ) do | file |
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*#/ )
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
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
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
Util.fatal_error( PRG_NAME, "error: " + e.to_s )
end
end
-
-
end
end
@@
-537,6
+541,10
@@
module Evoruby
end
def read_fasta_file( input )
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
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
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
msa
end