bio-bigwig 0.0.3 → 0.0.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.
- checksums.yaml +4 -4
- data/ext/bio/bigwig/bigwigext.c +24 -20
- data/lib/bio/bigwig/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fc197bd8ffd3edcbecd7c74e632b9b44d180b30540194e083aa23245822322d
|
4
|
+
data.tar.gz: 52075f2eccf948d9017e4b94ba5b4380cd66729610f8fbabe1a16732649ec5f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27b8667fabdc77ef6e66544af79ccf9c2ea67c7a661649f7add0590f739ed82b0cc57026a6ffd23c7923faa1d9154146213d51fd6f2b56d6f43681b7f6fb00fb
|
7
|
+
data.tar.gz: 7a580a0ef61afdbcdb6eb56507de67c6a91bc610558e36892fae6ebca7b049aaec749012488613e40890a88d25d3c7370e467cbf691b47dca389caf278a69294
|
data/ext/bio/bigwig/bigwigext.c
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
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
|
-
|
721
|
+
bw_is_bigwig_q(VALUE self)
|
715
722
|
{
|
716
|
-
|
723
|
+
return bw_is_file_type(self, 0); // 0 = BigWig
|
724
|
+
}
|
717
725
|
|
718
|
-
|
719
|
-
|
720
|
-
|
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()
|
data/lib/bio/bigwig/version.rb
CHANGED