aai 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aai.rb +28 -18
  3. data/lib/aai/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c439cf060023c9dc0c792217b3983f08bf3f696e
4
- data.tar.gz: 6f091a4758dcde5648cf4f611b74fe6a21c163b0
3
+ metadata.gz: 7ad0d928493f79c8941621c5a60c434eab14d210
4
+ data.tar.gz: 64f0ddaac0103bf9413302cc6fc42b85d694e645
5
5
  SHA512:
6
- metadata.gz: d54827285835cab1981111b4c3b17de121385ba85f9c999158621e73eec063660c8d27161e83f34c055135f835c905cc4d7fc5f96aa4263f003e5fdde1e4219a
7
- data.tar.gz: c34a2a154b613e7cfeab1cb009508803e933dfcf085fde8dea6ade437e731f4f296644672d6b1516f9ebc7e8335da8a0f39f5f5d19f3806e1b837c35c7718dce
6
+ metadata.gz: 3ea7855a5732a973b543bc17841c21ff256828ee750acc02ebe49b4e26462f9065c245d9907f3a00afaf8e2cfc6f70f8c936c1372bc46f7e9540356de1198d60
7
+ data.tar.gz: 7cfba7f20566fc6f9c6177ce5bcc758a816e1c9e8ee65c9c2938e5dfd0b4a25ebfed0e34be1c209a164729d1b385d11f41dc3105646fb4bf2cbf0be7170b9285
data/lib/aai.rb CHANGED
@@ -53,18 +53,16 @@ module Aai
53
53
  [first_files[idx], second_files[idx], outf_names[idx]]
54
54
  end
55
55
 
56
- Time.time_it "Running blast jobs" do
57
- Parallel.each(args, in_processes: cpus) do |infiles|
58
- query = infiles[0]
59
- db = infiles[1]
60
- out = infiles[2]
56
+ Parallel.each(args, in_processes: cpus) do |infiles|
57
+ query = infiles[0]
58
+ db = infiles[1]
59
+ out = infiles[2]
61
60
 
62
- cmd = "diamond blastp --threads 1 --outfmt 6 " +
63
- "--query #{query} --db #{db} --out #{out} " +
64
- "--evalue #{EVALUE_CUTOFF}"
61
+ cmd = "diamond blastp --threads 1 --outfmt 6 " +
62
+ "--query #{query} --db #{db} --out #{out} " +
63
+ "--evalue #{EVALUE_CUTOFF}"
65
64
 
66
- Process.run_and_time_it! "Diamond blast", cmd
67
- end
65
+ Process.run_and_time_it! "Diamond blast", cmd
68
66
  end
69
67
 
70
68
  outf_names
@@ -80,13 +78,11 @@ module Aai
80
78
  suffix = BLAST_DB_SUFFIX
81
79
  outfiles = fnames.map { |fname| fname + suffix }
82
80
 
83
- Time.time_it "Making blast databases" do
84
- Parallel.each(fnames, in_processes: cpus) do |fname|
85
- cmd = "diamond makedb --threads 1 --in #{fname} " +
86
- "--db #{fname}#{BLAST_DB_SUFFIX}"
81
+ Parallel.each(fnames, in_processes: cpus) do |fname|
82
+ cmd = "diamond makedb --threads 1 --in #{fname} " +
83
+ "--db #{fname}#{BLAST_DB_SUFFIX}"
87
84
 
88
- Process.run_and_time_it! "Make db", cmd
89
- end
85
+ Process.run_and_time_it! "Make db", cmd
90
86
  end
91
87
 
92
88
  outfiles
@@ -125,7 +121,14 @@ module Aai
125
121
 
126
122
  def get_best_hits fnames, seq_lengths
127
123
  best_hits = {}
128
- fnames.each do |fname| # blast files
124
+ num_fnames = fnames.count
125
+ log_every = num_fnames > 10 ? num_fnames / 10 : 1
126
+ fnames.each_with_index do |fname, idx| # blast files
127
+ if (idx % log_every).zero?
128
+ AbortIf.logger.debug { "Working on blastp file " +
129
+ "##{idx} of #{num_fnames}"}
130
+ end
131
+
129
132
  File.open(fname, "rt").each_line do |line|
130
133
  ary = line.chomp.split "\t"
131
134
 
@@ -217,7 +220,14 @@ module Aai
217
220
  one_way_hits = one_way_best_hits best_hits
218
221
  genome_pair_keys = one_way_hits.keys.map { |pair| pair.sort }.uniq
219
222
 
220
- genome_pair_keys.each do |pair_key|
223
+ num_genome_pairs = genome_pair_keys.count
224
+ log_every = num_genome_pairs > 10 ? num_genome_pairs / 10 : 1
225
+ genome_pair_keys.each_with_index do |pair_key, idx|
226
+ if (idx % log_every).zero?
227
+ AbortIf.logger.debug { "Working on genome pair ##{idx} of " +
228
+ "#{num_genome_pairs}" }
229
+ end
230
+
221
231
  if one_way_hits.has_key?(pair_key) &&
222
232
  one_way_hits.has_key?(pair_key.reverse)
223
233
 
@@ -1,5 +1,5 @@
1
1
  module Aai
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  COPYRIGHT = "2017 Ryan Moore"
4
4
  CONTACT = "moorer@udel.edu"
5
5
  WEBSITE = "https://github.com/mooreryan/aai"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Moore