miga-base 1.2.15.1 → 1.2.15.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ad52d75f0a01d681043530335e20e89ecfb46822a8166dd7c0993b9822882f9
4
- data.tar.gz: 28bf47b3e257718cb3071ebf48d2f0fd63a8797116f8108faa789643940aac3f
3
+ metadata.gz: 02ee43a4f918d4adb45bc28c20386965eeea6a6a7447a7bb56efbd7017c4ee54
4
+ data.tar.gz: c7d16aff20c61fd64833a3aa2f9ca66aaa6f3caedc19a03ae08cd1b9bd08b720
5
5
  SHA512:
6
- metadata.gz: b498f1617e597feb77f6adc655f7fdd0ee941b670867f5157f12f5af49a462c712a72ea60a7b6ef28ad702a4afdcca0a33bac00216d306ef4bff2ddcee4f844b
7
- data.tar.gz: 41755ac99346b7dbbdf1a971158f98c99ca970d4134b912b17989d4776ae528902fed6df68d7f477fecfcc02657fae0350f311e3195c2211bc4e0945744366c8
6
+ metadata.gz: 94ca45cab979c73e767cd05dfaceca410b6cedef44a5d9b0d16e4439651d872013fadc23a54d3ed6355bf6ed045f673e8e80424979e17af7dae0a32cd22e89d7
7
+ data.tar.gz: 0d83195dcbe7afb4fbfce02d492ed63c93776f1756037aa6412ab94b6378ae54d983a0583c3cf1c27e5c9a9b2dca108d386a60aaabce80a7af083d53a9cf0648
@@ -12,14 +12,32 @@ class MiGA::RemoteDataset < MiGA::MiGA
12
12
  # Class-level
13
13
 
14
14
  class << self
15
- def ncbi_asm_acc2id(acc)
15
+ ##
16
+ # Translate an NCBI Assembly Accession (+acc+) to corresponding internal
17
+ # NCBI ID, with up to +retrials+ retrials if the returned JSON document
18
+ # does not conform to the expected format
19
+ def ncbi_asm_acc2id(acc, retrials = 3)
16
20
  return acc if acc =~ /^\d+$/
17
21
 
18
22
  search_doc = MiGA::Json.parse(
19
23
  download(:ncbi_search, :assembly, acc, :json),
20
24
  symbolize: false, contents: true
21
25
  )
22
- (search_doc['esearchresult']['idlist'] || []).first
26
+ out = (search_doc['esearchresult']['idlist'] || []).first
27
+ if out.nil?
28
+ raise MiGA::RemoteDataMissingError.new(
29
+ "NCBI Assembly Accession not found: #{acc}"
30
+ )
31
+ end
32
+ return out
33
+ rescue MiGA::RemoteDataMissingError => e
34
+ if retrials <= 0
35
+ raise e
36
+ else
37
+ MiGA::MiGA.DEBUG("#{self}.ncbi_asm_acc2id - RETRY #{retrials}")
38
+ retrials -= 1
39
+ retry
40
+ end
23
41
  end
24
42
  end
25
43
 
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.2, 15, 1].freeze
15
+ VERSION = [1.2, 15, 2].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(2023, 1, 24)
23
+ VERSION_DATE = Date.new(2023, 1, 25)
24
24
 
25
25
  ##
26
26
  # References of MiGA
@@ -63,7 +63,9 @@ class RemoteDatasetTest < Test::Unit::TestCase
63
63
 
64
64
  def test_asm_acc2id
65
65
  declare_remote_access
66
- assert_nil(MiGA::RemoteDataset.ncbi_asm_acc2id('NotAnAccession'))
66
+ assert_raise(MiGA::RemoteDataMissingError) do
67
+ MiGA::RemoteDataset.ncbi_asm_acc2id('NotAnAccession', 1)
68
+ end
67
69
  id = MiGA::RemoteDataset.ncbi_asm_acc2id('GCA_004684205.1')
68
70
  assert_equal('2514661', id)
69
71
  assert_equal(id, MiGA::RemoteDataset.ncbi_asm_acc2id(id))
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.2.15.1
4
+ version: 1.2.15.2
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: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2023-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons