miga-base 0.3.6.2 → 0.3.6.3
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/README.md +1 -4
- data/actions/get.rb +5 -1
- data/actions/ncbi_get.rb +1 -0
- data/lib/miga/daemon.rb +5 -2
- data/lib/miga/remote_dataset/base.rb +10 -2
- data/lib/miga/remote_dataset/download.rb +1 -0
- data/lib/miga/version.rb +1 -1
- data/scripts/clade_finding.bash +0 -3
- data/scripts/haai_distances.bash +4 -0
- data/utils/distance/commands.rb +4 -4
- data/utils/distance/runner.rb +6 -6
- 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: f989fccd5161208979728e293bfc89d18e24e1ca6941b18a804063749cce56e9
|
4
|
+
data.tar.gz: 7568cb56974c18279428a50f750a5302beae8063a190def53734eb985fe4b56b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d026577fd38d399d643fbc9ef7c01ffa7969d8206d6f859655b9d04e41d7c3e75b1432581add654c5b3d58ce6b2bedf566783c2587165f811e12f6fbf87b695
|
7
|
+
data.tar.gz: 4fae078b18a74314a7654d5c7a83ca7277555977b299931e33ddfabc3356cfa82994b00c6950a646eb8c16289f4cdb34f686574fc9505aacfec9ae826242c742
|
data/README.md
CHANGED
@@ -7,10 +7,7 @@
|
|
7
7
|
|
8
8
|
# MiGA: Microbial Genomes Atlas
|
9
9
|
|
10
|
-
|
11
|
-
any stability on the different interfaces. We're currently running a Beta
|
12
|
-
Testing program with dedicated support for a small number of laboratories. If
|
13
|
-
you're interested, please [contact us][contact].
|
10
|
+

|
14
11
|
|
15
12
|
For additional information on MiGA, visit:
|
16
13
|
|
data/actions/get.rb
CHANGED
@@ -39,10 +39,11 @@ OptionParser.new do |opt|
|
|
39
39
|
opt.on('--get-metadata',
|
40
40
|
'Only download and update metadata for existing datasets'
|
41
41
|
){ |v| o[:get_md] = v }
|
42
|
+
opt.on('--api-key STRING',
|
43
|
+
'API key for the given universe.'){ |v| o[:api_key] = v }
|
42
44
|
opt_common(opt, o)
|
43
45
|
end.parse!
|
44
46
|
|
45
|
-
|
46
47
|
##=> Main <=
|
47
48
|
glob = [o]
|
48
49
|
unless o[:file].nil?
|
@@ -66,6 +67,9 @@ end
|
|
66
67
|
|
67
68
|
glob.each do |o_i|
|
68
69
|
opt_require(o_i, project: '-P', dataset: '-D', ids: '-I')
|
70
|
+
unless o_i[:api_key].nil?
|
71
|
+
ENV["#{o_i[:universe].to_s.upcase}_API_KEY"] = o_i[:api_key]
|
72
|
+
end
|
69
73
|
|
70
74
|
$stderr.puts "Dataset: #{o_i[:dataset]}" unless o_i[:q]
|
71
75
|
$stderr.puts 'Loading project.' unless o_i[:q]
|
data/actions/ncbi_get.rb
CHANGED
@@ -50,6 +50,7 @@ OptionParser.new do |opt|
|
|
50
50
|
opt.on('-R', '--remote-list PATH',
|
51
51
|
'Path to an output file with the list of all datasets listed remotely.'
|
52
52
|
){ |v| o[:remote_list]=v }
|
53
|
+
opt.on('--api-key STRING', 'NCBI API key.'){ |v| ENV['NCBI_API_KEY'] = v }
|
53
54
|
opt_common(opt, o)
|
54
55
|
end.parse!
|
55
56
|
|
data/lib/miga/daemon.rb
CHANGED
@@ -95,15 +95,18 @@ class MiGA::Daemon < MiGA::MiGA
|
|
95
95
|
def load_status
|
96
96
|
f_path = File.expand_path('daemon/status.json', project.path)
|
97
97
|
return unless File.size? f_path
|
98
|
+
say 'Loading previous status in daemon/status.json:'
|
98
99
|
status = JSON.parse(File.read(f_path), symbolize_names: true)
|
99
100
|
status.keys.each do |i|
|
100
101
|
status[i].map! do |j|
|
101
102
|
j.tap { |k| k[:ds] = project.dataset(k[:ds_name]) unless k[:ds].nil? }
|
102
103
|
end
|
103
104
|
end
|
104
|
-
@jobs_to_run = status[:jobs_to_run]
|
105
105
|
@jobs_running = status[:jobs_running]
|
106
|
+
@jobs_to_run = status[:jobs_to_run]
|
106
107
|
purge!
|
108
|
+
say "- jobs running: #{@jobs_running.size}"
|
109
|
+
say "- jobs to run: #{@jobs_to_run.size}"
|
107
110
|
end
|
108
111
|
|
109
112
|
##
|
@@ -111,7 +114,7 @@ class MiGA::Daemon < MiGA::MiGA
|
|
111
114
|
def check_datasets
|
112
115
|
project.each_dataset do |n, ds|
|
113
116
|
if ds.nil?
|
114
|
-
say "Warning: Dataset #{n} listed but not loaded, reloading project
|
117
|
+
say "Warning: Dataset #{n} listed but not loaded, reloading project"
|
115
118
|
project.load
|
116
119
|
else
|
117
120
|
to_run = ds.next_preprocessing(true)
|
@@ -27,6 +27,8 @@ module MiGA::RemoteDataset::Base
|
|
27
27
|
# option.
|
28
28
|
# - +method+ => Method used to query the URL. Only +:rest+ and +:net+ are
|
29
29
|
# currently supported.
|
30
|
+
# - +api_key+ => A lambda function that takes a URL as input and returns the
|
31
|
+
# URL to be downloaded with an API Key (if available).
|
30
32
|
# - +map_to_universe+ => Universe where results map to. Currently unsupported.
|
31
33
|
@@UNIVERSE = {
|
32
34
|
web: {
|
@@ -46,7 +48,10 @@ module MiGA::RemoteDataset::Base
|
|
46
48
|
ncbi: {
|
47
49
|
dbs: { nuccore: {stage: :assembly, format: :fasta} },
|
48
50
|
url: "#{@@_EUTILS}efetch.fcgi?db=%1$s&id=%2$s&rettype=%3$s&retmode=text",
|
49
|
-
method: :rest
|
51
|
+
method: :rest,
|
52
|
+
api_key: lambda { |url|
|
53
|
+
ENV['NCBI_API_KEY'].nil? ?
|
54
|
+
url : "#{url}&api_key=#{ENV['NCBI_API_KEY']}" }
|
50
55
|
},
|
51
56
|
ncbi_map: {
|
52
57
|
dbs: {
|
@@ -56,7 +61,10 @@ module MiGA::RemoteDataset::Base
|
|
56
61
|
},
|
57
62
|
url: "#{@@_EUTILS}elink.fcgi?dbfrom=%1$s&id=%2$s&db=%4$s&retmode=%3$s",
|
58
63
|
method: :net,
|
59
|
-
map_to_universe: :ncbi
|
64
|
+
map_to_universe: :ncbi,
|
65
|
+
api_key: lambda { |url|
|
66
|
+
ENV['NCBI_API_KEY'].nil? ?
|
67
|
+
url : "#{url}&api_key=#{ENV['NCBI_API_KEY']}" }
|
60
68
|
}
|
61
69
|
}
|
62
70
|
|
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.3, 6,
|
13
|
+
VERSION = [0.3, 6, 3]
|
14
14
|
|
15
15
|
##
|
16
16
|
# Nickname for the current major.minor version.
|
data/scripts/clade_finding.bash
CHANGED
@@ -11,9 +11,6 @@ cd "$PROJECT/data/10.clades/01.find"
|
|
11
11
|
# Initialize
|
12
12
|
miga date > "miga-project.start"
|
13
13
|
|
14
|
-
# Cleanup databases
|
15
|
-
ruby -I "$MIGA/lib" "$MIGA/utils/cleanup-databases.rb" "$PROJECT" "$CORES"
|
16
|
-
|
17
14
|
# Run
|
18
15
|
ruby -I "$MIGA/lib" "$MIGA/utils/subclades.rb" "$PROJECT" "$SCRIPT"
|
19
16
|
|
data/scripts/haai_distances.bash
CHANGED
@@ -11,6 +11,10 @@ cd "$PROJECT/data/09.distances/01.haai"
|
|
11
11
|
# Initialize
|
12
12
|
miga date > "miga-project.start"
|
13
13
|
|
14
|
+
# Cleanup databases
|
15
|
+
ruby -I "$MIGA/lib" "$MIGA/utils/cleanup-databases.rb" "$PROJECT" "$CORES"
|
16
|
+
|
17
|
+
# Run hAAI
|
14
18
|
echo -n "" > miga-project.log
|
15
19
|
DS=$(miga ls -P "$PROJECT" --ref --no-multi --active)
|
16
20
|
|
data/utils/distance/commands.rb
CHANGED
@@ -53,11 +53,11 @@ module MiGA::DistanceRunner::Commands
|
|
53
53
|
end
|
54
54
|
|
55
55
|
##
|
56
|
-
# Calculates and returns ANI against +target+ if AAI >=
|
57
|
-
# +nil+ otherwise
|
58
|
-
def ani_after_aai(target)
|
56
|
+
# Calculates and returns ANI against +target+ if AAI >= +aai_limit+.
|
57
|
+
# Returns +nil+ otherwise
|
58
|
+
def ani_after_aai(target, aai_limit = 85.0)
|
59
59
|
aai = aai(target)
|
60
|
-
ani(target) unless aai.nil? or aai <
|
60
|
+
ani(target) unless aai.nil? or aai < aai_limit
|
61
61
|
end
|
62
62
|
|
63
63
|
##
|
data/utils/distance/runner.rb
CHANGED
@@ -94,19 +94,19 @@ class MiGA::DistanceRunner
|
|
94
94
|
fh.each_line do |ln|
|
95
95
|
r = ln.chomp.split("\t")
|
96
96
|
next unless r[1].to_i == val_cls
|
97
|
-
ani = ani_after_aai(ref_project.dataset(r[0]))
|
97
|
+
ani = ani_after_aai(ref_project.dataset(r[0]), 80.0)
|
98
98
|
closest = {ds: r[0], ani: ani} unless ani.nil? or ani < closest[:ani]
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
# Calculate all the AAIs/ANIs against the closest ANI95-clade (if
|
104
|
-
cl_path =
|
105
|
-
if File.size? cl_path and tsk[0] == :clade_finding
|
103
|
+
# Calculate all the AAIs/ANIs against the closest ANI95-clade (if AAI > 80%)
|
104
|
+
cl_path = res.file_path :clades_ani95
|
105
|
+
if File.size? cl_path and tsk[0] == :clade_finding
|
106
106
|
File.foreach(cl_path).
|
107
107
|
map { |i| i.chomp.split(',') }.
|
108
|
-
find { |i| i.include? closest[:ds] }.
|
109
|
-
each { |i| ani_after_aai(ref_project.dataset(i)) }
|
108
|
+
find( lambda{[]} ){ |i| i.include? closest[:ds] }.
|
109
|
+
each { |i| ani_after_aai(ref_project.dataset(i), 80.0) }
|
110
110
|
end
|
111
111
|
|
112
112
|
# Finalize
|
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.3.6.
|
4
|
+
version: 0.3.6.3
|
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: 2018-12-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|