bio-bigwig 0.0.3 → 0.0.4

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: '0585eab5aa345929c023943bafc6e27955be406f79379f056a9c45ec5d0b1933'
4
- data.tar.gz: 7ffd6b9bcce8e12382fad0fcfe26914f69da45a3db66b022c82007e9820abd9f
3
+ metadata.gz: 9fc197bd8ffd3edcbecd7c74e632b9b44d180b30540194e083aa23245822322d
4
+ data.tar.gz: 52075f2eccf948d9017e4b94ba5b4380cd66729610f8fbabe1a16732649ec5f6
5
5
  SHA512:
6
- metadata.gz: 776424b2382940cc1b31242d527b3e468bc5abbfa7a98009fb662389cc79cd2693e49d365423263435db06ab09811d66e5634ca8c07b546ebd46ef1bfb243141
7
- data.tar.gz: d245494b5f68359d66fdb80250ab1de08dd9fc21db17f28436e90997b94ca6a5c90f72e9048bcbcf0a4906a274a2785074e57b896def130ab6ebccaa62943881
6
+ metadata.gz: 27b8667fabdc77ef6e66544af79ccf9c2ea67c7a661649f7add0590f739ed82b0cc57026a6ffd23c7923faa1d9154146213d51fd6f2b56d6f43681b7f6fb00fb
7
+ data.tar.gz: 7a580a0ef61afdbcdb6eb56507de67c6a91bc610558e36892fae6ebca7b049aaec749012488613e40890a88d25d3c7370e467cbf691b47dca389caf278a69294
@@ -89,12 +89,12 @@ bigwig_allocate(VALUE klass)
89
89
  return TypedData_Wrap_Struct(klass, &BigWig_type, bw);
90
90
  }
91
91
 
92
- //Return 1 if there are any entries at all
92
+ // Return 1 if there are any entries at all
93
93
  int hasEntries(bigWigFile_t *bw)
94
94
  {
95
95
  if (bw->hdr->indexOffset != 0)
96
96
  return 1; // No index, no entries pyBigWig issue #111
97
- //if(bw->hdr->nBasesCovered > 0) return 1; // Sometimes headers are broken
97
+ // if(bw->hdr->nBasesCovered > 0) return 1; // Sometimes headers are broken
98
98
  return 0;
99
99
  }
100
100
 
@@ -108,7 +108,7 @@ bigwig_init(VALUE self, VALUE rb_fname, VALUE rb_mode)
108
108
  fname = StringValueCStr(rb_fname);
109
109
  mode = StringValueCStr(rb_mode);
110
110
 
111
- //Open the local/remote file
111
+ // Open the local/remote file
112
112
  if (strchr(mode, 'w') != NULL || bwIsBigWig(fname, NULL))
113
113
  {
114
114
  bw = bwOpen(fname, NULL, mode);
@@ -130,7 +130,7 @@ bigwig_init(VALUE self, VALUE rb_fname, VALUE rb_mode)
130
130
  goto error;
131
131
  }
132
132
 
133
- //Set the data pointer
133
+ // Set the data pointer
134
134
  DATA_PTR(self) = bw;
135
135
 
136
136
  rb_ivar_set(self, rb_intern("@last_tid"), INT2NUM(-1));
@@ -498,7 +498,7 @@ bw_get_intervals(VALUE self, VALUE rb_chrom, VALUE rb_start, VALUE rb_end)
498
498
 
499
499
  tid = bwGetTid(bw, chrom);
500
500
 
501
- //Sanity check
501
+ // Sanity check
502
502
  if (endl == (unsigned long)-1 && tid != (uint32_t)-1)
503
503
  endl = bw->cl->len[tid];
504
504
 
@@ -522,7 +522,7 @@ bw_get_intervals(VALUE self, VALUE rb_chrom, VALUE rb_start, VALUE rb_end)
522
522
  return rb_ary_new2(0);
523
523
  }
524
524
 
525
- //Get the intervals
525
+ // Get the intervals
526
526
  intervals = bwGetOverlappingIntervals(bw, chrom, start, end);
527
527
  if (!intervals)
528
528
  {
@@ -589,7 +589,7 @@ bb_get_entries(VALUE self, VALUE rb_chrom, VALUE rb_start, VALUE rb_end, VALUE r
589
589
 
590
590
  tid = bwGetTid(bw, chrom);
591
591
 
592
- //Sanity check
592
+ // Sanity check
593
593
  if (endl == (unsigned long)-1 && tid != (uint32_t)-1)
594
594
  endl = bw->cl->len[tid];
595
595
  if (tid == (uint32_t)-1 || startl > end || endl > end)
@@ -641,7 +641,8 @@ bb_get_entries(VALUE self, VALUE rb_chrom, VALUE rb_start, VALUE rb_end, VALUE r
641
641
  return ret;
642
642
 
643
643
  error:
644
- bbDestroyOverlappingEntries(o);
644
+ if (o)
645
+ bbDestroyOverlappingEntries(o);
645
646
  rb_raise(rb_eRuntimeError, "An error occurred while constructing the output!\n");
646
647
  return Qnil;
647
648
  }
@@ -696,11 +697,17 @@ bw_get_file_type(VALUE self)
696
697
  }
697
698
 
698
699
  static VALUE
699
- bw_is_bigwig_q(VALUE self)
700
+ bw_is_file_type(VALUE self, int type_check)
700
701
  {
701
702
  bigWigFile_t *bw = get_bigWigFile(self);
702
703
 
703
- if (bw->type == 0)
704
+ if (!bw)
705
+ {
706
+ rb_raise(rb_eRuntimeError, "The bigWig file handle is not opened!");
707
+ return Qnil;
708
+ }
709
+
710
+ if (bw->type == type_check)
704
711
  {
705
712
  return Qtrue;
706
713
  }
@@ -711,18 +718,15 @@ bw_is_bigwig_q(VALUE self)
711
718
  }
712
719
 
713
720
  static VALUE
714
- bw_is_bigbed_q(VALUE self)
721
+ bw_is_bigwig_q(VALUE self)
715
722
  {
716
- bigWigFile_t *bw = get_bigWigFile(self);
723
+ return bw_is_file_type(self, 0); // 0 = BigWig
724
+ }
717
725
 
718
- if (bw->type == 1)
719
- {
720
- return Qtrue;
721
- }
722
- else
723
- {
724
- return Qfalse;
725
- }
726
+ static VALUE
727
+ bw_is_bigbed_q(VALUE self)
728
+ {
729
+ return bw_is_file_type(self, 1); // 1 = BigBed
726
730
  }
727
731
 
728
732
  void Init_bigwigext()
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bio
4
4
  class BigWig
5
- VERSION = "0.0.3"
5
+ VERSION = "0.0.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-bigwig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2