miga-base 1.3.13.8 → 1.3.13.10

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: e3bafd65eb344dccfd8a2b1601a2fc28282c17f8826565c6d0393161ad407b6b
4
- data.tar.gz: cf47cca552f8651fe821af0431f579ef8958fb81371974fe5233391077a6405d
3
+ metadata.gz: 805637216225db5718e2a8a085046a64beae0ec816da3ecc01fda274194b83aa
4
+ data.tar.gz: 7c063bcd35554dd6ac7784ddeb37cf3a8e5b1f3ac3349f3ba4af9c5a7425806b
5
5
  SHA512:
6
- metadata.gz: 9d8bebf5ac6267645fcaf2129d61dc516552a63790ef329310631c8db6e55f14d5ebcbe486eccef8898cd0a3036e6a448810ffe41a44810f351e2217a1f31817
7
- data.tar.gz: 252d4fa1a39137358ce381bcdecebc9f1b5a40321c99b3ed059755555dbee3fd931fd77209d14d3b59ed236e51c53fa97d4668f9ad153ec7bdc2f02d205a1161
6
+ metadata.gz: 74fe73270087e6ceb32fea09e2a2b13e1f8687c96fe39b42f68c0fdbea5d172b15ab946843ba184667071c34f3080a3e12613b7ecf078d90656514f96654044b
7
+ data.tar.gz: 6d4e2ff50403236cdc90349aa67263590781c7ff4694cafb2bf35b81b57480026f3f59543145181e20f71b4cbee85d5682adf11d9813e86ea25ef1c40291c345
data/lib/miga/json.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'json'
4
4
  begin
5
5
  require 'oj'
6
- OJ.mimic_JSON()
6
+ Oj.mimic_JSON()
7
7
  rescue LoadError
8
8
  # Do nothing if not available
9
9
  end
@@ -134,6 +134,15 @@ module MiGA::RemoteDataset::Base
134
134
  end,
135
135
  method: :get
136
136
  },
137
+ ncbi_fetch: {
138
+ dbs: { nuccore: { stage: :metadata, format: :gb } },
139
+ uri: lambda do |opts|
140
+ @@_EUTILS_BUILD[:efetch,
141
+ db: opts[:db], id: opts[:ids], rettype: opts[:format], retmode: :text
142
+ ]
143
+ end,
144
+ method: :get
145
+ },
137
146
  ncbi_search: {
138
147
  dbs: {
139
148
  assembly: { stage: :metadata, format: :json },
@@ -107,9 +107,12 @@ class MiGA::RemoteDataset
107
107
 
108
108
  MiGA::MiGA.DEBUG 'Empty sequence, attempting download as WGS records'
109
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] }
110
+ ids = [a]
111
+ unless b.nil?
112
+ pref = longest_common_prefix([a, b])
113
+ rang = a[pref.size .. -1].to_i .. b[pref.size .. -1].to_i
114
+ ids = rang.map { |k| "%s%0#{a.size - pref.size}i" % [pref, k] }
115
+ end
113
116
  download_rest(opts.merge(universe: :ncbi, db: :nuccore, ids: ids))
114
117
  end
115
118
 
@@ -300,6 +300,16 @@ class MiGA::RemoteDataset < MiGA::MiGA
300
300
  metadata[:web_assembly_gz] ||=
301
301
  '%s/%s_genomic.fna.gz' % [url_dir, File.basename(url_dir)]
302
302
  end
303
+
304
+ # If all conditions are right, try getting the WGS range
305
+ if @_ncbi_asm_json_doc['wgs'] && !@_ncbi_asm_json_doc['wgs'].empty? &&
306
+ metadata[:ncbi_nuccore] && !metadata[:ncbi_wgs]
307
+ doc = self.class.download(:ncbi_fetch, :nuccore, metadata[:ncbi_nuccore], :gb).split(/\n/)
308
+ ln = doc.grep(/^WGS\s+\S+-\S+/).first
309
+ wgs = ln&.gsub(/^WGS\s+(\S+-\S+).*/, '\1')
310
+ metadata[:ncbi_wgs] = wgs if wgs
311
+ end
312
+
303
313
  @_ncbi_asm_json_doc
304
314
  end
305
315
 
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, 13, 8].freeze
15
+ VERSION = [1.3, 13, 10].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)
23
+ VERSION_DATE = Date.new(2024, 4, 1)
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.13.8
4
+ version: 1.3.13.10
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-23 00:00:00.000000000 Z
11
+ date: 2024-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons