lib/big_simon/utils.rb in big_simon-0.2.0 vs lib/big_simon/utils.rb in big_simon-0.2.1
- old
+ new
@@ -72,10 +72,12 @@
# @note I also rename all the sequences in the tmp fasta files with the new ID.
def self.set_up_tmp_dirs fastas, tmpdir, which
Object::FileUtils.mkdir_p tmpdir
+ seq_lengths = {}
+
name_map = {}
all_ids = Set.new
seq_num = -1
fastas.each do |fname|
@@ -90,17 +92,19 @@
new_id = "#{which}_#{seq_num}"
name_map[new_id] = rec.id
outfname = File.join tmpdir, "#{new_id}.fa"
+ seq_lengths[new_id] = rec.seq.length
+
File.open(outfname, "w") do |f|
f.puts ">#{new_id}\n#{rec.seq}" # TODO HERE
end
end
end
end
- [name_map, all_ids]
+ [name_map, all_ids, seq_lengths]
end
def self.strip_suffix fname
fname.sub /.fasta$|.fa$/, ""
end
\ No newline at end of file