mizlab 0.1.2 → 0.1.4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mizlab/version.rb +1 -1
  3. data/lib/mizlab.rb +14 -17
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df8aef7891b1d4362295bf293deeab71c0df4b1acdb7e67d7fbc79fe01a7f047
4
- data.tar.gz: 836d63375f5b57f0dee6c8b52602870e1bec91e49a0af6caa7133c588bf8298f
3
+ metadata.gz: 66e83019b3716a3b8bdb55bd6d14df9764821fe394547f3d54e34f26ca5bab06
4
+ data.tar.gz: 794444eaeff6a46f8e3cddc1e6173b746df7eab24a7b1fd1454dac8c4e4bc79d
5
5
  SHA512:
6
- metadata.gz: 5a27e47c4d641c989a5c3d0d744f77316cd898a4172bc96e3231cc1d7b1c8f9421cf521f1c61d4af81c42f8e4acb5498702ba61c19b51200f2bb9b0a9b3d4a94
7
- data.tar.gz: a62744a6682e782a68e729fecc00e31d3685768acb52a4e86243037de2a07b96de1527d6b0c91378e1c0245061815c6663c311cefdf7fdd1ba17b27cdcbcd333
6
+ metadata.gz: 9bd7ab8e6be7264a6ba6a392685a271755320c555a459b1554797577f57ab387ce5e45762cd20341fa6749dc9117f4ac216d1a62d388d8386e2fd7b17a526761
7
+ data.tar.gz: fa475f06c3d361eff8bd3c19787e26ec973daca6a73e66f6bdccb414e4ddba5abe10a544ca2eb002f9c26eee6c532b4dbb964ea6eac6a66fa9f28a4ef69a2514
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mizlab
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/mizlab.rb CHANGED
@@ -7,25 +7,22 @@ require "stringio"
7
7
 
8
8
  module Mizlab
9
9
  class << self
10
- # Fetch data via genbank
11
- # @param [String] accession Accession number Like "NC_012920".
10
+ # Fetch data via genbank. You can also give a block.
11
+ # @param [String/Array] accessions Accession numbers Like ["NC_012920", ...].
12
12
  # @param [Bool] is_protein wheather the accession is protein. Default to true.
13
13
  # @return [Bio::GenBank] GenBank object.
14
- def getobj(accession, is_protein = false)
15
- ret = is_protein ? fetch_protein(accession) : fetch_nucleotide(accession)
16
- parse(ret) do |o|
17
- return o
18
- end
19
- end
20
-
21
- # Fetch multiple data via genbank
22
- # @param [Array] accessions Array of accession string.
23
- # @param [Bool] is_protein wheather the accession is protein. Default to true.
24
- # @yield [Bio::GenBank] GenBank object.
25
- def getobjs(accessions, is_protein = false)
26
- ret = is_protein ? fetch_protein(accessions) : fetch_nucleotide(accessions)
27
- parse(ret) do |o|
28
- yield o
14
+ def getobj(accessions, is_protein = false)
15
+ accessions = accessions.is_a?(String) ? [accessions] : accessions
16
+ accessions.each do |acc|
17
+ ret = is_protein ? fetch_protein(acc) : fetch_nucleotide(acc)
18
+ parse(ret) do |o|
19
+ if block_given?
20
+ yield o
21
+ else
22
+ return o
23
+ end
24
+ end
25
+ sleep(0.37) # Using 0.333... seconds, sometimes hit the NCBI rate limit
29
26
  end
30
27
  end
31
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mizlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omochice
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-22 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The tools for our laboratory
14
14
  email: