bio-twobit 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/bio-twobit.gemspec +0 -2
- data/ext/bio/twobit/twobit.c +19 -2
- data/lib/bio/twobit/version.rb +1 -1
- data/lib/bio/twobit.rb +29 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec7f8c720eed6e69a7e0829e7a46237e49532a5dc3124c57ee0c574f36e79a46
|
4
|
+
data.tar.gz: b46dcf07bd2c34993b57a91e4743d45579285727146fe5ea269dab848e6e6a7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 071f082fca0cde51ff22be152f5b6a33837dbf9acdc39dfa9c7caa96fe141a065290febb17f1c5fc45b26a01caacd8d350334f9950885bd5f8a1fe7fae0e5ee4
|
7
|
+
data.tar.gz: 7a6753959f1a7bd188341e64c3dc9176de7f240cc214334ba155a9e706a5cbb997a02c2355626831435bf2b5b0755a31e412902f095a9900cd87a3413043d6cc
|
data/Gemfile
CHANGED
data/bio-twobit.gemspec
CHANGED
data/ext/bio/twobit/twobit.c
CHANGED
@@ -125,6 +125,20 @@ twobit_close(VALUE self)
|
|
125
125
|
return Qnil;
|
126
126
|
}
|
127
127
|
|
128
|
+
static VALUE
|
129
|
+
twobit_closed_question_mark(VALUE self)
|
130
|
+
{
|
131
|
+
TwoBit *tb = getTwoBit(self);
|
132
|
+
if (tb)
|
133
|
+
{
|
134
|
+
return Qfalse;
|
135
|
+
}
|
136
|
+
else
|
137
|
+
{
|
138
|
+
return Qtrue;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
128
142
|
static VALUE
|
129
143
|
twobit_info(VALUE self)
|
130
144
|
{
|
@@ -351,7 +365,8 @@ twobit_hard_masked_blocks(VALUE self, VALUE chrom, VALUE rbstart, VALUE rbend)
|
|
351
365
|
{
|
352
366
|
char *ch;
|
353
367
|
TwoBit *tb;
|
354
|
-
|
368
|
+
long tid = -1;
|
369
|
+
unsigned long startl = 0, endl = 0, totalBlocks = 0;
|
355
370
|
uint32_t i, len, start, end, blockStart, blockEnd;
|
356
371
|
VALUE val, ary;
|
357
372
|
|
@@ -428,7 +443,8 @@ twobit_soft_masked_blocks(VALUE self, VALUE chrom, VALUE rbstart, VALUE rbend)
|
|
428
443
|
{
|
429
444
|
char *ch;
|
430
445
|
TwoBit *tb;
|
431
|
-
|
446
|
+
long tid = -1;
|
447
|
+
unsigned long startl = 0, endl = 0, totalBlocks = 0;
|
432
448
|
uint32_t i, len, start, end, blockStart, blockEnd;
|
433
449
|
VALUE val, ary;
|
434
450
|
|
@@ -515,6 +531,7 @@ void Init_twobit(void)
|
|
515
531
|
|
516
532
|
rb_define_private_method(mTwoBit, "initialize_raw", twobit_init, 2);
|
517
533
|
rb_define_method(mTwoBit, "close", twobit_close, 0);
|
534
|
+
rb_define_method(mTwoBit, "closed?", twobit_closed_question_mark, 0);
|
518
535
|
rb_define_method(mTwoBit, "info", twobit_info, 0);
|
519
536
|
rb_define_method(mTwoBit, "chroms", twobit_chroms, 0);
|
520
537
|
rb_define_private_method(mTwoBit, "sequence_raw", twobit_sequence, 3);
|
data/lib/bio/twobit/version.rb
CHANGED
data/lib/bio/twobit.rb
CHANGED
@@ -4,21 +4,40 @@ require_relative "twobit/version"
|
|
4
4
|
require_relative "twobit/twobit"
|
5
5
|
|
6
6
|
module Bio
|
7
|
+
# Reader for .2bit files (i.e., from UCSC genome browser)
|
7
8
|
class TwoBit
|
8
|
-
|
9
|
-
|
9
|
+
def self.open(*args, **kwargs)
|
10
|
+
file = new(*args, **kwargs)
|
11
|
+
return file unless block_given?
|
12
|
+
|
13
|
+
begin
|
14
|
+
yield file
|
15
|
+
ensure
|
16
|
+
file.close
|
17
|
+
end
|
18
|
+
file
|
10
19
|
end
|
11
20
|
|
12
21
|
def initialize(fname, masked: false)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
22
|
+
raise "TwoBit::new() does not take block; use TwoBit::open() instead" if block_given?
|
23
|
+
|
24
|
+
@fname = fname
|
25
|
+
if masked
|
26
|
+
mskd = 1
|
27
|
+
@masked = true
|
28
|
+
else
|
29
|
+
mskd = 0
|
30
|
+
@masked = false
|
21
31
|
end
|
32
|
+
initialize_raw(fname, mskd)
|
33
|
+
end
|
34
|
+
|
35
|
+
def path
|
36
|
+
@fname
|
37
|
+
end
|
38
|
+
|
39
|
+
def masked?
|
40
|
+
@masked
|
22
41
|
end
|
23
42
|
|
24
43
|
def sequence(chrom, start = 0, stop = 0)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-twobit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a Ruby binding for lib2bit(https://github.com/dpryan79/lib2bit),
|
14
14
|
which provides high-speed access to genomic data in 2bit file format.
|
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
|
-
rubygems_version: 3.
|
55
|
+
rubygems_version: 3.3.3
|
56
56
|
signing_key:
|
57
57
|
specification_version: 4
|
58
58
|
summary: A ruby library for accessing 2bit files
|