miga-base 1.3.12.2 → 1.3.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/miga/remote_dataset/download.rb +24 -3
- data/lib/miga/remote_dataset.rb +9 -2
- 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: a824f1edbe1778b4a7e5a0bb88062f81be5a29acfbaf22bc12d46e662f9fe15e
|
4
|
+
data.tar.gz: 4ccbc1577786a1c967fa93dfd15ad0e1d46f3daf4e6f31eb8f1fc401a29c0bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa3313457cae5bc365afa7d58ede79a7644afa5f051ed711d7fd7ade38961749ff8188491df675e7652037a440f24bb0e2bdba229e79b0c5b1eefcf2b015d8e4
|
7
|
+
data.tar.gz: be5039aa64d97347c65d290992a7022e7e069f9afb330265bd4b571b5936f2fcac686d92951cecb9c3d57ca52f83e659b3977b66aaa617c80ecafa3600769ff2
|
@@ -96,9 +96,21 @@ class MiGA::RemoteDataset
|
|
96
96
|
o = download_rest(opts.merge(universe: :ncbi, db: :nuccore))
|
97
97
|
return o unless o.strip.empty?
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
begin
|
100
|
+
MiGA::MiGA.DEBUG 'Empty sequence, attempting download as NCBI assembly'
|
101
|
+
opts[:format] = :fasta
|
102
|
+
ncbi_asm_get(opts)
|
103
|
+
rescue => e
|
104
|
+
raise e unless opts[:obj]&.metadata&.dig(:ncbi_wgs)
|
105
|
+
MiGA::MiGA.DEBUG e.to_s
|
106
|
+
end
|
107
|
+
|
108
|
+
MiGA::MiGA.DEBUG 'Empty sequence, attempting download as WGS records'
|
109
|
+
a, b = opts[:obj].metadata[:ncbi_wgs].split('-', 2)
|
110
|
+
pref = longest_common_prefix([a, b])
|
111
|
+
rang = a[pref.size .. -1].to_i .. b[pref.size .. -1].to_i
|
112
|
+
ids = rang.map { |k| "%s%0#{a.size - pref.size}i" % [pref, k] }
|
113
|
+
download_rest(opts.merge(universe: :ncbi, db: :nuccore, ids: ids))
|
102
114
|
end
|
103
115
|
|
104
116
|
##
|
@@ -184,6 +196,15 @@ class MiGA::RemoteDataset
|
|
184
196
|
end
|
185
197
|
tree
|
186
198
|
end
|
199
|
+
|
200
|
+
##
|
201
|
+
# From: https://github.com/isisAnchalee/Algorithms
|
202
|
+
def longest_common_prefix(strs)
|
203
|
+
return '' if strs.empty?
|
204
|
+
min, max = strs.minmax
|
205
|
+
idx = min.size.times { |i| break i if min[i] != max[i] }
|
206
|
+
min[0...idx]
|
207
|
+
end
|
187
208
|
end
|
188
209
|
end
|
189
210
|
|
data/lib/miga/remote_dataset.rb
CHANGED
@@ -322,9 +322,16 @@ class MiGA::RemoteDataset < MiGA::MiGA
|
|
322
322
|
taxid = metadata.dig(:ncbi_dataset, :organism, :tax_id)
|
323
323
|
return taxid if taxid
|
324
324
|
|
325
|
-
#
|
325
|
+
# Get GenBank document
|
326
326
|
doc = self.class.download(:ncbi, db, ids, :gb, nil, {}, self).split(/\n/)
|
327
|
-
|
327
|
+
|
328
|
+
# Since we're here, try to recover WGS for synthetic records
|
329
|
+
ln = doc.grep(/^WGS\s+\S+-\S+/).first
|
330
|
+
wgs = ln&.gsub(/^WGS\s+(\S+-\S+).*/, '\1')
|
331
|
+
@metadata[:ncbi_wgs] = wgs if wgs
|
332
|
+
|
333
|
+
# Now try to extract taxid from GenBank
|
334
|
+
ln = doc.grep(%r{^\s+/db_xref="taxon:}).first
|
328
335
|
return nil if ln.nil?
|
329
336
|
|
330
337
|
ln.sub!(/.*(?:"taxon:)(\d+)["; ].*/, '\\1')
|
data/lib/miga/version.rb
CHANGED
@@ -12,7 +12,7 @@ module MiGA
|
|
12
12
|
# - String indicating release status:
|
13
13
|
# - rc* release candidate, not released as gem
|
14
14
|
# - [0-9]+ stable release, released as gem
|
15
|
-
VERSION = [1.3, 12,
|
15
|
+
VERSION = [1.3, 12, 3].freeze
|
16
16
|
|
17
17
|
##
|
18
18
|
# Nickname for the current major.minor version.
|
@@ -20,7 +20,7 @@ module MiGA
|
|
20
20
|
|
21
21
|
##
|
22
22
|
# Date of the current gem relese.
|
23
|
-
VERSION_DATE = Date.new(2024, 3,
|
23
|
+
VERSION_DATE = Date.new(2024, 3, 10)
|
24
24
|
|
25
25
|
##
|
26
26
|
# References 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: 1.3.12.
|
4
|
+
version: 1.3.12.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: 2024-03-
|
11
|
+
date: 2024-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|