miga-base 0.7.3.0 → 0.7.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b233f892ba1294bd0959433c443944f267ff9b8c7ec4d220dc4bbacaca985a6
4
- data.tar.gz: bdc51401c6680d63872e7aab594eab50dbc500e6662d244a6fa04f6b6ea2587d
3
+ metadata.gz: 7e3f943800139b48778d227b3f0680bd71cac91774037f9f9e115842ccb3e6f4
4
+ data.tar.gz: 351042f7e77d3b2a3189a27fc37ead6c4fdb02ad519ba72a760d8e75a50dddf3
5
5
  SHA512:
6
- metadata.gz: 96bc61749ae2964656a9d82a2b5b0c74691513af237837960dfe146482a5691dadf7ea8aa958fb5ff35abd1e8ac829c447e219fdf330095e151efd4448470d73
7
- data.tar.gz: 299a4806eea3364a0a64d86aa0eabfa5798f27801d7892241e13bc8ec36e0d3325cddc4eb321ec5b0826b498bb86bdf98494e1384e42cfa6441d97940c690b4f
6
+ metadata.gz: 95f0728ad6f0d4359c32ed37deb9b215e6ecbd15fd5807796a8927eadb5ebfc1466d88e94afec179b33df9009d53e2f109166c5db5bf82424d6c31c6289cf780
7
+ data.tar.gz: 75a5c9f95150c0177f1cf29a2bac58547bb51e60f75fe1d3c42acc3a3945aee161d51e1af479187459312b39c9164a6955d28232cbeb923cb8dbe5b748b590d8
@@ -46,7 +46,7 @@ module MiGA::Common::WithDaemon
46
46
  # Is the daemon active?
47
47
  def active?
48
48
  return false unless File.exist? alive_file
49
- last_alive > Time.now - 60
49
+ (last_alive || Time.new(0)) > Time.now - 60
50
50
  end
51
51
 
52
52
  ##
@@ -26,9 +26,10 @@ module MiGA::Common::WithDaemonClass
26
26
  def last_alive(path)
27
27
  f = alive_file(path)
28
28
  f = terminated_file(path) unless File.exist? f
29
- return nil unless File.exist? f
30
29
  c = File.read(f)
31
30
  return nil if c.nil? || c.empty?
32
31
  Time.parse(c)
32
+ rescue Errno::ENOENT
33
+ return nil
33
34
  end
34
35
  end
data/lib/miga/tax_dist.rb CHANGED
@@ -43,7 +43,6 @@ module MiGA::TaxDist
43
43
  keys.each do |i|
44
44
  v = row.shift
45
45
  next if v == 'NA' # <- missing data
46
- next if i == 1 # <- namespace, not a taxonomic rank
47
46
  rank = i.zero? ? :root : MiGA::Taxonomy.KNOWN_RANKS[i]
48
47
  vals[rank] = v.to_f
49
48
  end
data/lib/miga/version.rb CHANGED
@@ -10,7 +10,7 @@ module MiGA
10
10
  # - Float representing the major.minor version.
11
11
  # - Integer representing gem releases of the current version.
12
12
  # - Integer representing minor changes that require new version number.
13
- VERSION = [0.7, 3, 0]
13
+ VERSION = [0.7, 3, 1]
14
14
 
15
15
  ##
16
16
  # Nickname for the current major.minor version.
@@ -18,7 +18,7 @@ module MiGA
18
18
 
19
19
  ##
20
20
  # Date of the current gem release.
21
- VERSION_DATE = Date.new(2020, 4, 22)
21
+ VERSION_DATE = Date.new(2020, 4, 23)
22
22
 
23
23
  ##
24
24
  # Reference of MiGA.
@@ -5,6 +5,7 @@ module MiGA::DistanceRunner::Database
5
5
  ##
6
6
  # Check for corrupt files and create empty databases
7
7
  def initialize_dbs!(for_ref)
8
+ $stderr.puts "Initializing databases (for_ref = #{for_ref})"
8
9
  @dbs = {}
9
10
  @tmp_dbs = {}
10
11
  @db_counts = {}
@@ -4,7 +4,7 @@ module MiGA::DistanceRunner::Pipeline
4
4
 
5
5
  # Recursively classify the dataset, returning an Array with two entries:
6
6
  # classification and cluster number
7
- def classify(clades, classif, metric, result_fh, val_cls=nil)
7
+ def classify(clades, classif, metric, result_fh, val_cls = nil)
8
8
  dir = File.expand_path(classif, clades)
9
9
  med = File.expand_path('miga-project.medoids', dir)
10
10
  return [classif,val_cls] unless File.size? med
@@ -32,6 +32,7 @@ module MiGA::DistanceRunner::Pipeline
32
32
 
33
33
  # Builds a tree with all visited medoids from any classification level
34
34
  def build_medoids_tree(metric)
35
+ $stderr.puts "Building medoids tree (metric = #{metric})"
35
36
  db = query_db(metric)
36
37
  return unless File.size? db
37
38
  out_base = File.expand_path(dataset.name, home)
@@ -61,6 +62,7 @@ module MiGA::DistanceRunner::Pipeline
61
62
 
62
63
  # Tests taxonomy
63
64
  def tax_test
65
+ $stderr.puts "Testing taxonomy | opts = #{opts}"
64
66
  # Get taxonomy of closest relative
65
67
  from_ref_project = (project != ref_project)
66
68
  res_dir = from_ref_project ?
@@ -95,6 +97,7 @@ module MiGA::DistanceRunner::Pipeline
95
97
 
96
98
  # Transfer the taxonomy to the current dataset
97
99
  def transfer_taxonomy(tax)
100
+ $stderr.puts "Transferring taxonomy"
98
101
  return if tax.nil?
99
102
  pval = (project.metadata[:tax_pvalue] || 0.05).to_f
100
103
  tax_a = tax.
@@ -53,10 +53,12 @@ class MiGA::DistanceRunner
53
53
  @opts[:ani_p] ||= 'blast+'
54
54
  @opts[:distances_checkpoint] ||= 10
55
55
  @opts[:distances_checkpoint] = @opts[:distances_checkpoint].to_i
56
+ $stderr.puts "Options: #{opts}"
56
57
  end
57
58
 
58
59
  # Launch the appropriate analysis
59
60
  def go!
61
+ $stderr.puts "Launching analysis"
60
62
  return if dataset.is_multi?
61
63
  Dir.mktmpdir do |tmp_dir|
62
64
  @tmp = tmp_dir
@@ -67,6 +69,7 @@ class MiGA::DistanceRunner
67
69
 
68
70
  # Launch analysis for reference datasets
69
71
  def go_ref!
72
+ $stderr.puts "Launching analysis for reference dataset"
70
73
  # Initialize databases
71
74
  initialize_dbs! true
72
75
 
@@ -84,6 +87,7 @@ class MiGA::DistanceRunner
84
87
  ##
85
88
  # Launch analysis for query datasets
86
89
  def go_query!
90
+ $stderr.puts "Launching analysis for query dataset"
87
91
  # Check if project is ready
88
92
  tsk = ref_project.is_clade? ? [:subclades, :ani] : [:clade_finding, :aai]
89
93
  res = ref_project.result(tsk[0])
@@ -129,6 +133,7 @@ class MiGA::DistanceRunner
129
133
 
130
134
  # Launch analysis for taxonomy jobs
131
135
  def go_taxonomy!
136
+ $stderr.puts "Launching taxonomy analysis"
132
137
  return unless project.metadata[:ref_project]
133
138
  go_query! # <- yeah, it's actually the same, just different ref_project
134
139
  end
@@ -6,7 +6,11 @@ module MiGA::DistanceRunner::Temporal
6
6
 
7
7
  # Copy input files to the (local) temporal folder
8
8
  def create_temporals
9
- rf = {essential_genes: :ess_genes, cds: :proteins, assembly: :largecontigs}
9
+ rf = {
10
+ essential_genes: :ess_genes,
11
+ cds: :proteins,
12
+ assembly: :largecontigs
13
+ }
10
14
  rf.each do |res, file|
11
15
  r = dataset.result(res)
12
16
  f = r.nil? ? nil : r.file_path(file)
@@ -37,6 +41,7 @@ module MiGA::DistanceRunner::Temporal
37
41
 
38
42
  # Copies temporal databases back to the MiGA Project
39
43
  def checkpoint!(metric)
44
+ $stderr.puts "Checkpoint (metric = #{metric})"
40
45
  SQLite3::Database.new(tmp_dbs[metric]) do |conn|
41
46
  conn.execute("select count(*) from #{metric==:haai ? :aai : metric}")
42
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3.0
4
+ version: 0.7.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-22 00:00:00.000000000 Z
11
+ date: 2020-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons