bio-bigwig 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 16a4f8614b5681336c4cb6f2e94318e70b1319b67ac30a01e4f60e36b66646cb
4
+ data.tar.gz: 1bdc56ff64d8a4c96e2a6be92375b432562476f456b7c3541c1a3f932603f77d
5
+ SHA512:
6
+ metadata.gz: 3aafa8e3e0c69abdf2f07152997fc4b8162e05e9e0a10521a0780c3ce2cb237e4bc84367d771d7394f74568faa5f5ef542a19cb2cc2b0bc2a28a2d1125b8a1c7
7
+ data.tar.gz: d639dab381fd5613c527dc6b7c0abd4d66c89f0df36fce15903b827e7e22ceba4d86c391f9197577082b9ab44534341569020149eaebfd9c345bb9ad5768cf63
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 kojix2
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # bio-bigwig
2
+
3
+ Ruby wrapper to [libBigWig](https://github.com/dpryan79/libBigWig) compatible with [pyBigWig](https://github.com/deeptools/pyBigWig).
4
+
5
+ * Currently, curl does not seem to work well ((Pull requests welcome)).
6
+ * File writing is not implemented.
7
+
8
+ ## Installation
9
+
10
+ Installation from source.
11
+
12
+ ```
13
+ git clone --recursive https://github.com/kojix2/bio-bigwig
14
+ cd bio-bigwig
15
+ bundle install
16
+ bundle exec rake compile
17
+ bundle exec rake install
18
+ ```
19
+
20
+ Not yet uploaded to the Gem server.
21
+
22
+ ```
23
+ gem install bio-bigwig
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ [bigWig Track Format](https://genome.ucsc.edu/goldenPath/help/bigWig.html)
29
+
30
+ ```ruby
31
+ require "bio/bigwig"
32
+
33
+ bw = Bio::BigWig.open("test/fixtures/test.bw")
34
+ bw.is_bigwig?
35
+
36
+ bw.chroms
37
+ # {"1"=>195471971, "10"=>130694993}
38
+
39
+ bw.chroms("1")
40
+ # 195471971
41
+
42
+ bw.header
43
+ # {
44
+ # :version => 4, the version number
45
+ # :levels => 1, the number of zoom levels
46
+ # :bases_covered => 154, the number of bases described
47
+ # :min_val => 0, the minimum value
48
+ # :max_val => 2, the maximum value
49
+ # :sum_data => 272, the sum of all values
50
+ # :sum_squared => 500 the sum of all squared values
51
+ # }
52
+
53
+ bw.stats("1", 0, 3)
54
+ # [0.2000000054637591]
55
+
56
+ bw.stats("1", 0, 3, type: :max)
57
+ # [0.30000001192092896]
58
+
59
+ # types
60
+ # mean - the average value (default)
61
+ # min - the minimum value
62
+ # max - the maximum value
63
+ # cov/coverage - the fraction of bases covered
64
+ # std - the standard deviation of the values
65
+ # dev -
66
+ # sum -
67
+
68
+ bw.stats("1",99, 200, type: :max, nbins: 2)
69
+ # [1.399999976158142, 1.5]
70
+
71
+ bw.stats("1")
72
+ # [1.3351851569281683]
73
+
74
+ bw.values("1", 0, 3)
75
+ # [0.10000000149011612, 0.20000000298023224, 0.30000001192092896]
76
+
77
+ bw.values("1", 0, 4)
78
+ # [0.10000000149011612, 0.20000000298023224, 0.30000001192092896, NaN]
79
+
80
+ bw.intervals("1", 0, 3)
81
+ # [[0, 1, 0.10000000149011612], [1, 2, 0.20000000298023224], [2, 3, 0.30000001192092896]]
82
+
83
+ bw.intervals("1")
84
+ # [[0, 1, 0.10000000149011612], [1, 2, 0.20000000298023224], [2, 3, 0.30000001192092896],
85
+ # [100, 150, 1.399999976158142], [150, 151, 1.5]]
86
+ ```
87
+
88
+ [bigBed Track Format](https://genome.ucsc.edu/goldenPath/help/bigBed.html)
89
+
90
+ ```ruby
91
+ require "bio/bigwig"
92
+
93
+ bb = Bio::BigWig.open("test/fixtures/test.bigBed")
94
+
95
+ bb.entries("chr1", 10000000, 10020000)
96
+ # [[10009333, 10009640, "61035\t130\t-\t0.026\t0.42\t404"],
97
+ # [10014007, 10014289, "61047\t136\t-\t0.029\t0.42\t404"],
98
+ # [10014373, 10024307, "61048\t630\t-\t5.420\t0.00\t2672399"]]
99
+
100
+ bb = Bio::BigWig.open("test/fixtures/test.bigBed")
101
+ bb.entries("chr1", 10000000, 10020000, text: false)
102
+ # [[10009333, 10009640],
103
+ # [10014007, 10014289],
104
+ # [10014373, 10024307]]
105
+
106
+ bb.sql
107
+ # table RnaElements
108
+ # "BED6 + 3 scores for RNA Elements data "
109
+ # (
110
+ # string chrom; "Reference sequence chromosome or scaffold"
111
+ # uint chromStart; "Start position in chromosome"
112
+ # uint chromEnd; "End position in chromosome"
113
+ # string name; "Name of item"
114
+ # uint score; "Normalized score from 0-1000"
115
+ # char[1] strand; "+ or - or . for unknown"
116
+ # float level; "Expression level such as RPKM or FPKM. Set to -1 for no data."
117
+ # float signif; "Statistical significance such as IDR. Set to -1 for no data."
118
+ # uint score2; "Additional measurement/count e.g. number of reads. Set to 0 for no data."
119
+ # )
120
+ ```
121
+
122
+ ## Development
123
+
124
+ Pull requests are welcome!
125
+ ## Contributing
126
+
127
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kojix2/bio-bigwig.
128
+
129
+ ## License
130
+
131
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).