htslib 0.4.0 → 0.4.1

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: 26b019acbf5b8e110829d2666710f9187923edc57a4af486be8fc4ac690cd0e0
4
- data.tar.gz: 8edf3b8fc44ce5ce42f0d09f2dcfffdb3dd4b145e72aac28bf13b4daa6d952ad
3
+ metadata.gz: 86838244ad390e04fb293d3db9fd639c837dcd7b2309cc0c83da0b5925e7185c
4
+ data.tar.gz: 547063279b934706efcf919d287217f4231fe76d2e8fb3ae6df8e4dd7b6040ad
5
5
  SHA512:
6
- metadata.gz: 6429da59067ed17e863117a98320304eb9445b82eb0a8ed94c6afe0b5c01cd149797e068cfa6c14cb32f7e60c0cfeedfc9c49d47cf7a5d92191a3818ad8f63a6
7
- data.tar.gz: 5f6ce5d70616eb23213ebde0a77b1a0efb66664263c839eb3d00bc08d957c77655d9b03c426573e3db7b5a9d459f8ec86077e771b55b51523fbda520ac82cfcb
6
+ metadata.gz: 787f9167abef88ddbd758d3155f1f3568bb99d8a5a340086a1cc677be46e0e77ec5a0ef56d201610f06143d0f54a20a1f2563ae3e080996564b5b5545e3e8a2a
7
+ data.tar.gz: d07ae5e437c9729a39e32adb12ff694560eaa33e44094679199bc8b742ccaab4c5a111c7e6391a314a8b6a19fae82acea549123b57497690678e1b2b1746f2c7
data/lib/hts/bam/auxi.rb CHANGED
@@ -248,10 +248,9 @@ module HTS
248
248
  end
249
249
  end
250
250
 
251
- # Iterate auxiliary tags with their SAM/BAM type.
251
+ # Iterate auxiliary tags as key-value pairs.
252
252
  #
253
253
  # @yieldparam tag [String] 2-byte AUX tag name
254
- # @yieldparam type [String] AUX type, e.g. "i", "Z", or "B:C"
255
254
  # @yieldparam value [Object] Ruby representation of the AUX value
256
255
  def each
257
256
  return enum_for(__method__) unless block_given?
@@ -261,7 +260,7 @@ module HTS
261
260
 
262
261
  loop do
263
262
  tag = FFI::Pointer.new(aux_ptr.address - 2).read_string(2)
264
- yield tag, aux_type(aux_ptr), get_ruby_aux(aux_ptr)
263
+ yield tag, get_ruby_aux(aux_ptr)
265
264
  aux_ptr = LibHTS.bam_aux_next(@record.struct, aux_ptr)
266
265
  break if aux_ptr.null?
267
266
  end
@@ -269,6 +268,25 @@ module HTS
269
268
 
270
269
  alias each_pair each
271
270
 
271
+ # Iterate auxiliary tags with their SAM/BAM type.
272
+ #
273
+ # @yieldparam tag [String] 2-byte AUX tag name
274
+ # @yieldparam type [String] AUX type, e.g. "i", "Z", or "B:C"
275
+ # @yieldparam value [Object] Ruby representation of the AUX value
276
+ def each_with_type
277
+ return enum_for(__method__) unless block_given?
278
+
279
+ aux_ptr = first_pointer
280
+ return nil if aux_ptr.null?
281
+
282
+ loop do
283
+ tag = FFI::Pointer.new(aux_ptr.address - 2).read_string(2)
284
+ yield tag, aux_type(aux_ptr), get_ruby_aux(aux_ptr)
285
+ aux_ptr = LibHTS.bam_aux_next(@record.struct, aux_ptr)
286
+ break if aux_ptr.null?
287
+ end
288
+ end
289
+
272
290
  def to_h
273
291
  h = {}
274
292
  aux_ptr = first_pointer
data/lib/hts/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTS
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htslib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2