miga-base 0.7.15.2 → 0.7.16.0
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.
- checksums.yaml +4 -4
- data/lib/miga/cli/action/doctor.rb +19 -0
- data/lib/miga/cli/action/doctor/base.rb +42 -0
- data/lib/miga/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ee2f247a9f26ddbf2fcf0fc85bb0ed51d0d4980e2e40297449665a0befca102
|
4
|
+
data.tar.gz: 9d2ea26b71d226f0cbddebb214912a82b432886efb72e8bb6523b4b2f5aa588c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 673a1f46b1e34e14b58a434be79ec92c2ed31e7225004bd3fe08daebdf1362603353b5dd8473de8923583ed9819b6fe54578a3e18ea33dd51a54e2fad0bb0755
|
7
|
+
data.tar.gz: 23e44862a13fa293ea72d2260fc9676e2438b4c0c1725c64863a23c144d9b8a27dfefa62da6234fc0e86a8e59ada90498801a5609baaf07357293807801ccf60
|
@@ -37,6 +37,7 @@ class MiGA::Cli::Action::Doctor < MiGA::Cli::Action
|
|
37
37
|
@@OPERATIONS = {
|
38
38
|
status: ['status', 'Update metadata status of all datasets'],
|
39
39
|
db: ['databases', 'Check integrity of database files'],
|
40
|
+
bidir: ['bidirectional', 'Check distances are bidirectional'],
|
40
41
|
dist: ['distances', 'Check distance summary tables'],
|
41
42
|
files: ['files', 'Check for outdated files'],
|
42
43
|
cds: ['cds', 'Check for gzipped genes and proteins'],
|
@@ -85,6 +86,24 @@ class MiGA::Cli::Action::Doctor < MiGA::Cli::Action
|
|
85
86
|
cli.say
|
86
87
|
end
|
87
88
|
|
89
|
+
##
|
90
|
+
# Perform bidirectional operation with MiGA::Cli +cli+
|
91
|
+
def check_bidir(cli)
|
92
|
+
cli.say 'Checking that reference distances are bidirectional'
|
93
|
+
ref_ds = cli.load_project.each_dataset.select(&:ref?)
|
94
|
+
ref_names = ref_ds.map(&:name)
|
95
|
+
n, k = ref_ds.size, 0
|
96
|
+
ref_ds.each do |d|
|
97
|
+
cli.advance('Datasets:', k += 1, n, false)
|
98
|
+
saved = saved_targets(d)
|
99
|
+
next if saved.nil?
|
100
|
+
|
101
|
+
to_save = ref_names - saved
|
102
|
+
to_save.each { |k| save_bidirectional(cli.load_project.dataset(k), d) }
|
103
|
+
end
|
104
|
+
cli.say
|
105
|
+
end
|
106
|
+
|
88
107
|
##
|
89
108
|
# Perform distances operation with MiGA::Cli +cli+
|
90
109
|
def check_dist(cli)
|
@@ -99,4 +99,46 @@ module MiGA::Cli::Action::Doctor::Base
|
|
99
99
|
cli.say '- Removing tables, recompute'
|
100
100
|
res.remove!
|
101
101
|
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Returns all targets identified by AAI
|
105
|
+
def saved_targets(dataset)
|
106
|
+
# Return nil if distance or database are not retrievable
|
107
|
+
dist = dataset.result(:distances) or return
|
108
|
+
path = dist.file_path(:aai_db) or return
|
109
|
+
|
110
|
+
o = []
|
111
|
+
SQLite3::Database.new(path) do |conn|
|
112
|
+
o = conn.execute('select seq2 from aai').map(&:first)
|
113
|
+
end
|
114
|
+
o
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# Saves all the distance estimates in +a+ -> +b+ into the +b+ databases
|
119
|
+
# (as +b+ -> +a+), where both +a+ and +b+ are MiGA::Dataset objects
|
120
|
+
def save_bidirectional(a, b)
|
121
|
+
each_database_file(a) do |db_file, metric, result|
|
122
|
+
data = nil
|
123
|
+
SQLite3::Database.new(db_file) do |conn|
|
124
|
+
data =
|
125
|
+
conn.execute(
|
126
|
+
"select seq1, seq2, #{metric}, sd, n, omega " +
|
127
|
+
"from #{metric} where seq2 = ? limit 1", b.name
|
128
|
+
).first
|
129
|
+
end
|
130
|
+
next if data.nil? || data.empty?
|
131
|
+
|
132
|
+
db_file_b = File.join(File.dirname(db_file), "#{b.name}.db")
|
133
|
+
next unless File.exist?(db_file_b)
|
134
|
+
|
135
|
+
data[0], data[1] = data[1], data[0]
|
136
|
+
SQLite3::Database.new(db_file_b) do |conn|
|
137
|
+
conn.execute(
|
138
|
+
"insert into #{metric} (seq1, seq2, #{metric}, sd, n, omega) " +
|
139
|
+
"values(?, ?, ?, ?, ?, ?)", data
|
140
|
+
)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
102
144
|
end
|
data/lib/miga/version.rb
CHANGED
@@ -8,7 +8,7 @@ module MiGA
|
|
8
8
|
# - Float representing the major.minor version.
|
9
9
|
# - Integer representing gem releases of the current version.
|
10
10
|
# - Integer representing minor changes that require new version number.
|
11
|
-
VERSION = [0.7,
|
11
|
+
VERSION = [0.7, 16, 0]
|
12
12
|
|
13
13
|
##
|
14
14
|
# Nickname for the current major.minor version.
|
@@ -16,7 +16,7 @@ module MiGA
|
|
16
16
|
|
17
17
|
##
|
18
18
|
# Date of the current gem release.
|
19
|
-
VERSION_DATE = Date.new(2020,
|
19
|
+
VERSION_DATE = Date.new(2020, 10, 13)
|
20
20
|
|
21
21
|
##
|
22
22
|
# Reference of MiGA.
|
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.
|
4
|
+
version: 0.7.16.0
|
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-
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|