bio-bigwig 0.0.4 → 0.0.5

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: 9fc197bd8ffd3edcbecd7c74e632b9b44d180b30540194e083aa23245822322d
4
- data.tar.gz: 52075f2eccf948d9017e4b94ba5b4380cd66729610f8fbabe1a16732649ec5f6
3
+ metadata.gz: 2a7c6f632a8789e179e25df4689ba33ea3afa6ab2e61eaa3eb4e2ec9aa83595b
4
+ data.tar.gz: d60bff195ccd4b53bce8c7cdc826e204d28df864bf6c564f23dea925e012b751
5
5
  SHA512:
6
- metadata.gz: 27b8667fabdc77ef6e66544af79ccf9c2ea67c7a661649f7add0590f739ed82b0cc57026a6ffd23c7923faa1d9154146213d51fd6f2b56d6f43681b7f6fb00fb
7
- data.tar.gz: 7a580a0ef61afdbcdb6eb56507de67c6a91bc610558e36892fae6ebca7b049aaec749012488613e40890a88d25d3c7370e467cbf691b47dca389caf278a69294
6
+ metadata.gz: bf0692a90f5dc3fd04d86f155360d4d917657dfd460fc93f44b49acf8669290d5b9c836b941b7723fdda3ad9afcf7ced19e0e73c5e81ad72df7bd46f8623e674
7
+ data.tar.gz: 3e9a81e355c12c6c161f46f66a16db12f707135f7b37b9459eb50e4824cf4739759bc346dede7237dafa4d181b0914317de9ccf0e3255df839edf9f2752fa2e3
@@ -162,6 +162,21 @@ bigwig_close(VALUE self)
162
162
  return Qnil;
163
163
  }
164
164
 
165
+ static VALUE
166
+ bigwig_is_closed(VALUE self)
167
+ {
168
+ bigWigFile_t *bw = get_bigWigFile(self);
169
+
170
+ if (bw)
171
+ {
172
+ return Qfalse;
173
+ }
174
+ else
175
+ {
176
+ return Qtrue;
177
+ }
178
+ }
179
+
165
180
  static VALUE
166
181
  bw_get_header(VALUE self)
167
182
  {
@@ -170,7 +185,7 @@ bw_get_header(VALUE self)
170
185
 
171
186
  if (!bw)
172
187
  {
173
- rb_raise(rb_eRuntimeError, "The bigWig file handle is not opened!");
188
+ rb_raise(rb_eIOError, "The bigWig file handle is not opened!");
174
189
  return Qnil;
175
190
  }
176
191
 
@@ -210,7 +225,7 @@ bw_get_chroms(int argc, VALUE *argv, VALUE self)
210
225
 
211
226
  if (!bw)
212
227
  {
213
- rb_raise(rb_eRuntimeError, "The bigWig file handle is not opened!");
228
+ rb_raise(rb_eIOError, "The bigWig file handle is not opened!");
214
229
  return Qnil;
215
230
  }
216
231
 
@@ -284,7 +299,7 @@ bw_get_stats(VALUE self, VALUE rb_chrom, VALUE rb_start, VALUE rb_end, VALUE rb_
284
299
 
285
300
  if (!bw)
286
301
  {
287
- rb_raise(rb_eRuntimeError, "The bigWig file handle is not opened!");
302
+ rb_raise(rb_eIOError, "The bigWig file handle is not opened!");
288
303
  return Qnil;
289
304
  }
290
305
 
@@ -397,7 +412,7 @@ bw_get_values(VALUE self, VALUE rb_chrom, VALUE rb_start, VALUE rb_end)
397
412
 
398
413
  if (!bw)
399
414
  {
400
- rb_raise(rb_eRuntimeError, "The bigWig file handle is not opened!");
415
+ rb_raise(rb_eIOError, "The bigWig file handle is not opened!");
401
416
  return Qnil;
402
417
  }
403
418
 
@@ -469,7 +484,7 @@ bw_get_intervals(VALUE self, VALUE rb_chrom, VALUE rb_start, VALUE rb_end)
469
484
 
470
485
  if (!bw)
471
486
  {
472
- rb_raise(rb_eRuntimeError, "The bigWig file handle is not opened!");
487
+ rb_raise(rb_eIOError, "The bigWig file handle is not opened!");
473
488
  return Qnil;
474
489
  }
475
490
 
@@ -558,7 +573,7 @@ bb_get_entries(VALUE self, VALUE rb_chrom, VALUE rb_start, VALUE rb_end, VALUE r
558
573
 
559
574
  if (!bw)
560
575
  {
561
- rb_raise(rb_eRuntimeError, "The bigBed file handle is not opened!");
576
+ rb_raise(rb_eIOError, "The bigBed file handle is not opened!");
562
577
  return Qnil;
563
578
  }
564
579
 
@@ -656,7 +671,7 @@ bb_get_sql(VALUE self)
656
671
 
657
672
  if (!bw)
658
673
  {
659
- rb_raise(rb_eRuntimeError, "The bigBed file handle is not opened!");
674
+ rb_raise(rb_eIOError, "The bigBed file handle is not opened!");
660
675
  return Qnil;
661
676
  }
662
677
 
@@ -684,6 +699,12 @@ bw_get_file_type(VALUE self)
684
699
  {
685
700
  bigWigFile_t *bw = get_bigWigFile(self);
686
701
 
702
+ if (!bw)
703
+ {
704
+ rb_raise(rb_eIOError, "The bigWig file handle is not opened!");
705
+ return Qnil;
706
+ }
707
+
687
708
  if (bw->type == 0)
688
709
  {
689
710
  return rb_str_new2("BigWig");
@@ -703,7 +724,7 @@ bw_is_file_type(VALUE self, int type_check)
703
724
 
704
725
  if (!bw)
705
726
  {
706
- rb_raise(rb_eRuntimeError, "The bigWig file handle is not opened!");
727
+ rb_raise(rb_eIOError, "The bigWig file handle is not opened!");
707
728
  return Qnil;
708
729
  }
709
730
 
@@ -738,6 +759,7 @@ void Init_bigwigext()
738
759
 
739
760
  rb_define_private_method(rb_BigWig, "initialize_raw", bigwig_init, 2);
740
761
  rb_define_method(rb_BigWig, "close", bigwig_close, 0);
762
+ rb_define_method(rb_BigWig, "closed?", bigwig_is_closed, 0);
741
763
  rb_define_method(rb_BigWig, "header", bw_get_header, 0);
742
764
  rb_define_method(rb_BigWig, "chroms", bw_get_chroms, -1);
743
765
  rb_define_private_method(rb_BigWig, "stats_raw", bw_get_stats, 6);
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bio
4
4
  class BigWig
5
- VERSION = "0.0.4"
5
+ VERSION = "0.0.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-bigwig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-20 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a Ruby binding for libBigWig (https://github.com/dpryan79/libBigWig),
14
14
  which provides high-speed access to bigWig or bigBed files.