bio-bigwig 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@
12
12
  size_t GLOBAL_DEFAULTBUFFERSIZE;
13
13
 
14
14
  #ifndef NOCURL
15
- uint64_t getContentLength(URL_t *URL) {
15
+ uint64_t getContentLength(const URL_t *URL) {
16
16
  double size;
17
17
  if(curl_easy_getinfo(URL->x.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &size) != CURLE_OK) {
18
18
  return 0;
@@ -98,7 +98,7 @@ size_t urlRead(URL_t *URL, void *buf, size_t bufSize) {
98
98
  #endif
99
99
  }
100
100
 
101
- size_t bwFillBuffer(void *inBuf, size_t l, size_t nmemb, void *pURL) {
101
+ size_t bwFillBuffer(const void *inBuf, size_t l, size_t nmemb, void *pURL) {
102
102
  URL_t *URL = (URL_t*) pURL;
103
103
  void *p = URL->memBuf;
104
104
  size_t copied = l*nmemb;
@@ -158,7 +158,7 @@ CURLcode urlSeek(URL_t *URL, size_t pos) {
158
158
  #endif
159
159
  }
160
160
 
161
- URL_t *urlOpen(char *fname, CURLcode (*callBack)(CURL*), const char *mode) {
161
+ URL_t *urlOpen(const char *fname, CURLcode (*callBack)(CURL*), const char *mode) {
162
162
  URL_t *URL = calloc(1, sizeof(URL_t));
163
163
  if(!URL) return NULL;
164
164
  char *url = NULL, *req = NULL;
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bio
4
4
  class BigWig
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.3"
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.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-30 00:00:00.000000000 Z
11
+ date: 2024-09-20 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.
@@ -34,16 +34,9 @@ files:
34
34
  - ext/bio/bigwig/libBigWig/bwValues.h
35
35
  - ext/bio/bigwig/libBigWig/bwWrite.c
36
36
  - ext/bio/bigwig/libBigWig/io.c
37
- - ext/bio/bigwig/libBigWig/test/exampleWrite.c
38
- - ext/bio/bigwig/libBigWig/test/testBigBed.c
39
- - ext/bio/bigwig/libBigWig/test/testIterator.c
40
- - ext/bio/bigwig/libBigWig/test/testLocal.c
41
- - ext/bio/bigwig/libBigWig/test/testRemote.c
42
- - ext/bio/bigwig/libBigWig/test/testRemoteManyContigs.c
43
- - ext/bio/bigwig/libBigWig/test/testWrite.c
44
37
  - lib/bio/bigwig.rb
45
38
  - lib/bio/bigwig/version.rb
46
- homepage: https://github.com/kojix2/bw-ruby
39
+ homepage: https://github.com/kojix2/bio-bigwig
47
40
  licenses:
48
41
  - MIT
49
42
  metadata: {}
@@ -62,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
55
  - !ruby/object:Gem::Version
63
56
  version: '0'
64
57
  requirements: []
65
- rubygems_version: 3.3.3
58
+ rubygems_version: 3.4.19
66
59
  signing_key:
67
60
  specification_version: 4
68
61
  summary: A ruby library for accessing bigWig / bigBed files
@@ -1,76 +0,0 @@
1
- #include "bigWig.h"
2
-
3
- int main(int argc, char *argv[]) {
4
- bigWigFile_t *fp = NULL;
5
- char *chroms[] = {"1", "2"};
6
- char *chromsUse[] = {"1", "1", "1"};
7
- uint32_t chrLens[] = {1000000, 1500000};
8
- uint32_t starts[] = {0, 100, 125,
9
- 200, 220, 230,
10
- 500, 600, 625,
11
- 700, 800, 850};
12
- uint32_t ends[] = {5, 120, 126,
13
- 205, 226, 231};
14
- float values[] = {0.0f, 1.0f, 200.0f,
15
- -2.0f, 150.0f, 25.0f,
16
- 0.0f, 1.0f, 200.0f,
17
- -2.0f, 150.0f, 25.0f,
18
- -5.0f, -20.0f, 25.0f,
19
- -5.0f, -20.0f, 25.0f};
20
-
21
-
22
- if(bwInit(1<<17) != 0) {
23
- fprintf(stderr, "Received an error in bwInit\n");
24
- return 1;
25
- }
26
-
27
- fp = bwOpen("test/example_output.bw", NULL, "w");
28
- if(!fp) {
29
- fprintf(stderr, "An error occurred while opening example_output.bw for writingn\n");
30
- return 1;
31
- }
32
-
33
- //Allow up to 10 zoom levels, though fewer will be used in practice
34
- if(bwCreateHdr(fp, 10)) goto error;
35
-
36
- //Create the chromosome lists
37
- fp->cl = bwCreateChromList(chroms, chrLens, 2);
38
- if(!fp->cl) goto error;
39
-
40
- //Write the header
41
- if(bwWriteHdr(fp)) goto error;
42
-
43
- //Some example bedGraph-like entries
44
- if(bwAddIntervals(fp, chromsUse, starts, ends, values, 3)) goto error;
45
- //We can continue appending similarly formatted entries
46
- //N.B. you can't append a different chromosome (those always go into different
47
- if(bwAppendIntervals(fp, starts+3, ends+3, values+3, 3)) goto error;
48
-
49
- //Add a new block of entries with a span. Since bwAdd/AppendIntervals was just used we MUST create a new block
50
- if(bwAddIntervalSpans(fp, "1", starts+6, 20, values+6, 3)) goto error;
51
- //We can continue appending similarly formatted entries
52
- if(bwAppendIntervalSpans(fp, starts+9, values+9, 3)) goto error;
53
-
54
- //Add a new block of fixed-step entries
55
- if(bwAddIntervalSpanSteps(fp, "1", 900, 20, 30, values+12, 3)) goto error;
56
- //The start is then 760, since that's where the previous step ended
57
- if(bwAppendIntervalSpanSteps(fp, values+15, 3)) goto error;
58
-
59
- //Add a new chromosome
60
- chromsUse[0] = "2";
61
- chromsUse[1] = "2";
62
- chromsUse[2] = "2";
63
- if(bwAddIntervals(fp, chromsUse, starts, ends, values, 3)) goto error;
64
-
65
- //Closing the file causes the zoom levels to be created
66
- bwClose(fp);
67
- bwCleanup();
68
-
69
- return 0;
70
-
71
- error:
72
- fprintf(stderr, "Received an error somewhere!\n");
73
- bwClose(fp);
74
- bwCleanup();
75
- return 1;
76
- }
@@ -1,132 +0,0 @@
1
- #include "bigWig.h"
2
- #include <stdio.h>
3
- #include <inttypes.h>
4
- #include <stdlib.h>
5
- #include <assert.h>
6
-
7
- void bwPrintHdr(bigWigFile_t *bb) {
8
- uint64_t i;
9
- int64_t i64;
10
- printf("Version: %"PRIu16"\n", bb->hdr->version);
11
- printf("Levels: %"PRIu16"\n", bb->hdr->nLevels);
12
- printf("ctOffset: 0x%"PRIx64"\n", bb->hdr->ctOffset);
13
- printf("dataOffset: 0x%"PRIx64"\n", bb->hdr->dataOffset);
14
- printf("indexOffset: 0x%"PRIx64"\n", bb->hdr->indexOffset);
15
- printf("fieldCount: %"PRIu32"\n", bb->hdr->fieldCount);
16
- printf("definedFieldCount: %"PRIu32"\n", bb->hdr->definedFieldCount);
17
- printf("sqlOffset: 0x%"PRIx64"\n", bb->hdr->sqlOffset);
18
- printf("summaryOffset: 0x%"PRIx64"\n", bb->hdr->summaryOffset);
19
- printf("bufSize: %"PRIu32"\n", bb->hdr->bufSize);
20
-
21
- if(bb->hdr->nLevels) {
22
- printf(" i level data index\n");
23
- }
24
- for(i=0; i<bb->hdr->nLevels; i++) {
25
- printf("\t%"PRIu64"\t%"PRIu32"\t%"PRIx64"\t%"PRIx64"\n", i, bb->hdr->zoomHdrs->level[i], bb->hdr->zoomHdrs->dataOffset[i], bb->hdr->zoomHdrs->indexOffset[i]);
26
- }
27
-
28
- printf("nBasesCovered: %"PRIu64"\n", bb->hdr->nBasesCovered);
29
- printf("minVal: %f\n", bb->hdr->minVal);
30
- printf("maxVal: %f\n", bb->hdr->maxVal);
31
- printf("sumData: %f\n", bb->hdr->sumData);
32
- printf("sumSquared: %f\n", bb->hdr->sumSquared);
33
-
34
- //Chromosome idx/name/length
35
- if(bb->cl) {
36
- printf("Chromosome List\n");
37
- printf(" idx\tChrom\tLength (bases)\n");
38
- for(i64=0; i64<bb->cl->nKeys; i64++) {
39
- printf(" %"PRIu64"\t%s\t%"PRIu32"\n", i64, bb->cl->chrom[i64], bb->cl->len[i64]);
40
- }
41
- }
42
- }
43
-
44
- void bwPrintIndexNode(bwRTreeNode_t *node, int level) {
45
- uint16_t i;
46
- if(!node) return;
47
- for(i=0; i<node->nChildren; i++) {
48
- if(node->isLeaf) {
49
- printf(" %i\t%"PRIu32"\t%"PRIu32"\t%"PRIu32"\t%"PRIu32"\t0x%"PRIx64"\t%"PRIu64"\n", level,\
50
- node->chrIdxStart[i], \
51
- node->baseStart[i], \
52
- node->chrIdxEnd[i], \
53
- node->baseEnd[i], \
54
- node->dataOffset[i], \
55
- node->x.size[i]);
56
- } else {
57
- printf(" %i\t%"PRIu32"\t%"PRIu32"\t%"PRIu32"\t%"PRIu32"\t0x%"PRIx64"\tNA\n", level,\
58
- node->chrIdxStart[i], \
59
- node->baseStart[i], \
60
- node->chrIdxEnd[i], \
61
- node->baseEnd[i], \
62
- node->dataOffset[i]);
63
- bwPrintIndexNode(node->x.child[i], level+1);
64
- }
65
- }
66
- }
67
-
68
- void bwPrintIndexTree(bigWigFile_t *fp) {
69
- printf("\nIndex tree:\n");
70
- printf("nItems:\t%"PRIu64"\n", fp->idx->nItems);
71
- printf("chrIdxStart:\t%"PRIu32"\n", fp->idx->chrIdxStart);
72
- printf("baseStart:\t%"PRIu32"\n", fp->idx->baseStart);
73
- printf("chrIdxEnd:\t%"PRIu32"\n", fp->idx->chrIdxEnd);
74
- printf("baseEnd:\t%"PRIu32"\n", fp->idx->baseEnd);
75
- printf("idxSize:\t%"PRIu64"\n", fp->idx->idxSize);
76
- printf(" level\tchrIdxStart\tbaseStart\tchrIdxEnd\tbaseEnd\tchild\tsize\n");
77
- bwPrintIndexNode(fp->idx->root, 0);
78
- }
79
-
80
- int main(int argc, char *argv[]) {
81
- bigWigFile_t *fp = NULL;
82
- bbOverlappingEntries_t *o;
83
- uint32_t i;
84
- char *sql;
85
- if(argc != 2) {
86
- fprintf(stderr, "Usage: %s {file.bb|URL://path/file.bb}\n", argv[0]);
87
- return 1;
88
- }
89
-
90
- if(bwInit(1<<17) != 0) {
91
- fprintf(stderr, "Received an error in bwInit\n");
92
- return 1;
93
- }
94
-
95
- assert(bwIsBigWig(argv[1], NULL) == 0);
96
- assert(bbIsBigBed(argv[1], NULL) == 1);
97
-
98
- fp = bbOpen(argv[1], NULL);
99
- if(!fp) {
100
- fprintf(stderr, "An error occured while opening %s\n", argv[1]);
101
- return 1;
102
- }
103
-
104
- bwPrintHdr(fp);
105
- bwPrintIndexTree(fp);
106
-
107
- sql = bbGetSQL(fp);
108
- if(sql) {
109
- printf("SQL is: %s\n", sql);
110
- free(sql);
111
- }
112
-
113
- //Presumably this is the sort of interface that's needed...
114
- o = bbGetOverlappingEntries(fp, "chr1", 4450000, 4500000, 1);
115
- printf("%"PRIu32" entries overlap\n", o->l);
116
- for(i=0; i<o->l; i++) {
117
- printf("%"PRIu32"-%"PRIu32"\t %s\n", o->start[i], o->end[i], o->str[i]);
118
- }
119
- if(o) bbDestroyOverlappingEntries(o);
120
-
121
- //Ensure that we can fetch entries with no strings
122
- o = bbGetOverlappingEntries(fp, "chr1", 4450000, 4500000, 0);
123
- printf("%"PRIu32" entries overlap\n", o->l);
124
- for(i=0; i<o->l; i++) {
125
- printf("%"PRIu32"-%"PRIu32"\n", o->start[i], o->end[i]);
126
- }
127
- if(o) bbDestroyOverlappingEntries(o);
128
-
129
- bwClose(fp);
130
- bwCleanup();
131
- return 0;
132
- }
@@ -1,67 +0,0 @@
1
- #include "bigWig.h"
2
- #include <stdio.h>
3
- #include <inttypes.h>
4
- #include <stdlib.h>
5
- #include <assert.h>
6
-
7
- int main(int argc, char *argv[]) {
8
- bigWigFile_t *fp = NULL;
9
- uint32_t i, chunk = 0, tid, blocksPerIteration;
10
- char *sql, *chrom;
11
- bwOverlapIterator_t *iter;
12
- if(argc != 4) {
13
- fprintf(stderr, "Usage: %s {file.bb|URL://path/file.bb} chromosome blocksPerIteration\n", argv[0]);
14
- return 1;
15
- }
16
- chrom = argv[2];
17
- blocksPerIteration = strtoul(argv[3], NULL, 10);
18
-
19
- if(bwInit(1<<17) != 0) {
20
- fprintf(stderr, "Received an error in bwInit\n");
21
- return 1;
22
- }
23
-
24
- if(bwIsBigWig(argv[1], NULL)) {
25
- fp = bwOpen(argv[1], NULL, "r");
26
- } else if(bbIsBigBed(argv[1], NULL)) {
27
- fp = bbOpen(argv[1], NULL);
28
- }
29
-
30
- if(!fp) {
31
- fprintf(stderr, "An error occured while opening %s\n", argv[1]);
32
- return 1;
33
- }
34
-
35
- sql = bbGetSQL(fp);
36
- if(sql) {
37
- printf("SQL is: %s\n", sql);
38
- free(sql);
39
- }
40
-
41
- //So we can get the bounds
42
- tid = bwGetTid(fp, chrom);
43
-
44
- if(fp->type == 0) {
45
- iter = bwOverlappingIntervalsIterator(fp, chrom, 0, fp->cl->len[tid], blocksPerIteration);
46
- } else {
47
- iter = bbOverlappingEntriesIterator(fp, chrom, 0, fp->cl->len[tid], 1, blocksPerIteration);
48
- }
49
- while(iter->data) {
50
- if(fp->type == 0) {
51
- for(i=0; i<iter->intervals->l; i++) {
52
- printf("chunk %"PRIu32" entry %"PRIu32" %s:%"PRIu32"-%"PRIu32" %f\n", chunk, i, chrom, iter->intervals->start[i], iter->intervals->end[i], iter->intervals->value[i]);
53
- }
54
- } else {
55
- for(i=0; i<iter->entries->l; i++) {
56
- printf("chunk %"PRIu32" entry %"PRIu32" %s:%"PRIu32"-%"PRIu32" %s\n", chunk, i, chrom, iter->entries->start[i], iter->entries->end[i], iter->entries->str[i]);
57
- }
58
- }
59
- chunk++;
60
- iter = bwIteratorNext(iter);
61
- }
62
- bwIteratorDestroy(iter);
63
-
64
- bwClose(fp);
65
- bwCleanup();
66
- return 0;
67
- }
@@ -1,223 +0,0 @@
1
- #include "bigWig.h"
2
- #include <stdio.h>
3
- #include <inttypes.h>
4
- #include <stdlib.h>
5
- #include <assert.h>
6
-
7
- void bwPrintHdr(bigWigFile_t *bw) {
8
- uint64_t i;
9
- int64_t i64;
10
- printf("Version: %"PRIu16"\n", bw->hdr->version);
11
- printf("Levels: %"PRIu16"\n", bw->hdr->nLevels);
12
- printf("ctOffset: 0x%"PRIx64"\n", bw->hdr->ctOffset);
13
- printf("dataOffset: 0x%"PRIx64"\n", bw->hdr->dataOffset);
14
- printf("indexOffset: 0x%"PRIx64"\n", bw->hdr->indexOffset);
15
- printf("sqlOffset: 0x%"PRIx64"\n", bw->hdr->sqlOffset);
16
- printf("summaryOffset: 0x%"PRIx64"\n", bw->hdr->summaryOffset);
17
- printf("bufSize: %"PRIu32"\n", bw->hdr->bufSize);
18
- printf("extensionOffset: 0x%"PRIx64"\n", bw->hdr->extensionOffset);
19
-
20
- if(bw->hdr->nLevels) {
21
- printf(" i level data index\n");
22
- }
23
- for(i=0; i<bw->hdr->nLevels; i++) {
24
- printf("\t%"PRIu64"\t%"PRIu32"\t%"PRIx64"\t%"PRIx64"\n", i, bw->hdr->zoomHdrs->level[i], bw->hdr->zoomHdrs->dataOffset[i], bw->hdr->zoomHdrs->indexOffset[i]);
25
- }
26
-
27
- printf("nBasesCovered: %"PRIu64"\n", bw->hdr->nBasesCovered);
28
- printf("minVal: %f\n", bw->hdr->minVal);
29
- printf("maxVal: %f\n", bw->hdr->maxVal);
30
- printf("sumData: %f\n", bw->hdr->sumData);
31
- printf("sumSquared: %f\n", bw->hdr->sumSquared);
32
-
33
- //Chromosome idx/name/length
34
- if(bw->cl) {
35
- printf("Chromosome List\n");
36
- printf(" idx\tChrom\tLength (bases)\n");
37
- for(i64=0; i64<bw->cl->nKeys; i64++) {
38
- printf(" %"PRIu64"\t%s\t%"PRIu32"\n", i64, bw->cl->chrom[i64], bw->cl->len[i64]);
39
- }
40
- }
41
- }
42
-
43
- void bwPrintIndexNode(bwRTreeNode_t *node, int level) {
44
- uint16_t i;
45
- if(!node) return;
46
- for(i=0; i<node->nChildren; i++) {
47
- if(node->isLeaf) {
48
- printf(" %i\t%"PRIu32"\t%"PRIu32"\t%"PRIu32"\t%"PRIu32"\t0x%"PRIx64"\t%"PRIu64"\n", level,\
49
- node->chrIdxStart[i], \
50
- node->baseStart[i], \
51
- node->chrIdxEnd[i], \
52
- node->baseEnd[i], \
53
- node->dataOffset[i], \
54
- node->x.size[i]);
55
- } else {
56
- printf(" %i\t%"PRIu32"\t%"PRIu32"\t%"PRIu32"\t%"PRIu32"\t0x%"PRIx64"\tNA\n", level,\
57
- node->chrIdxStart[i], \
58
- node->baseStart[i], \
59
- node->chrIdxEnd[i], \
60
- node->baseEnd[i], \
61
- node->dataOffset[i]);
62
- bwPrintIndexNode(node->x.child[i], level+1);
63
- }
64
- }
65
- }
66
-
67
- void bwPrintIndexTree(bigWigFile_t *fp) {
68
- printf("\nIndex tree:\n");
69
- printf("nItems:\t%"PRIu64"\n", fp->idx->nItems);
70
- printf("chrIdxStart:\t%"PRIu32"\n", fp->idx->chrIdxStart);
71
- printf("baseStart:\t%"PRIu32"\n", fp->idx->baseStart);
72
- printf("chrIdxEnd:\t%"PRIu32"\n", fp->idx->chrIdxEnd);
73
- printf("baseEnd:\t%"PRIu32"\n", fp->idx->baseEnd);
74
- printf("idxSize:\t%"PRIu64"\n", fp->idx->idxSize);
75
- printf(" level\tchrIdxStart\tbaseStart\tchrIdxEnd\tbaseEnd\tchild\tsize\n");
76
- bwPrintIndexNode(fp->idx->root, 0);
77
- }
78
-
79
- void printIntervals(bwOverlappingIntervals_t *ints, uint32_t start) {
80
- uint32_t i;
81
- if(!ints) return;
82
- for(i=0; i<ints->l; i++) {
83
- if(ints->start && ints->end) {
84
- printf("Interval %"PRIu32"\t%"PRIu32"-%"PRIu32": %f\n",i, ints->start[i], ints->end[i], ints->value[i]);
85
- } else if(ints->start) {
86
- printf("Interval %"PRIu32"\t%"PRIu32"-%"PRIu32": %f\n",i, ints->start[i], ints->start[i]+1, ints->value[i]);
87
- } else {
88
- printf("Interval %"PRIu32"\t%"PRIu32"-%"PRIu32": %f\n",i, start+i, start+i+1, ints->value[i]);
89
- }
90
- }
91
- }
92
-
93
- int main(int argc, char *argv[]) {
94
- bigWigFile_t *fp = NULL;
95
- bwOverlappingIntervals_t *intervals = NULL;
96
- double *stats = NULL;
97
- if(argc != 2) {
98
- fprintf(stderr, "Usage: %s {file.bw|URL://path/file.bw}\n", argv[0]);
99
- return 1;
100
- }
101
-
102
- if(bwInit(1<<17) != 0) {
103
- fprintf(stderr, "Received an error in bwInit\n");
104
- return 1;
105
- }
106
-
107
- assert(bwIsBigWig(argv[1], NULL) == 1);
108
- assert(bbIsBigBed(argv[1], NULL) == 0);
109
-
110
- fp = bwOpen(argv[1], NULL, "r");
111
- if(!fp) {
112
- fprintf(stderr, "An error occured while opening %s\n", argv[1]);
113
- return 1;
114
- }
115
-
116
- bwPrintHdr(fp);
117
- bwPrintIndexTree(fp);
118
-
119
- //Try to get some blocks
120
- printf("1:0-99\n");
121
- intervals = bwGetValues(fp, "1", 0, 99, 0);
122
- printIntervals(intervals,0);
123
- bwDestroyOverlappingIntervals(intervals);
124
-
125
- printf("1:99-1000\n");
126
- intervals = bwGetValues(fp, "1", 99, 1000, 0);
127
- printIntervals(intervals,0);
128
- bwDestroyOverlappingIntervals(intervals);
129
-
130
- printf("1:99-150\n");
131
- intervals = bwGetValues(fp, "1", 99, 150, 1);
132
- printIntervals(intervals,99);
133
- bwDestroyOverlappingIntervals(intervals);
134
-
135
- printf("1:99-100\n");
136
- intervals = bwGetValues(fp, "1", 99, 100, 0);
137
- printIntervals(intervals,0);
138
- bwDestroyOverlappingIntervals(intervals);
139
-
140
- printf("1:151-1000\n");
141
- intervals = bwGetValues(fp, "1", 151, 1000, 0);
142
- printIntervals(intervals,0);
143
- bwDestroyOverlappingIntervals(intervals);
144
-
145
- printf("chr1:0-100\n");
146
- intervals = bwGetValues(fp, "chr1", 0, 100, 0);
147
- printIntervals(intervals,0);
148
- bwDestroyOverlappingIntervals(intervals);
149
-
150
- stats = bwStats(fp, "1", 0, 200, 1, mean);
151
- assert(stats);
152
- printf("1:0-1000 mean: %f\n", *stats);
153
- free(stats);
154
-
155
- stats = bwStats(fp, "1", 0, 200, 2, mean);
156
- assert(stats);
157
- printf("1:0-1000 mean: %f %f\n", stats[0], stats[1]);
158
- free(stats);
159
-
160
- stats = bwStats(fp, "1", 0, 200, 1, dev);
161
- assert(stats);
162
- printf("1:0-1000 std. dev.: %f\n", *stats);
163
- free(stats);
164
-
165
- stats = bwStats(fp, "1", 0, 200, 2, dev);
166
- assert(stats);
167
- printf("1:0-1000 std. dev.: %f %f\n", stats[0], stats[1]);
168
- free(stats);
169
-
170
- stats = bwStats(fp, "1", 0, 200, 1, min);
171
- assert(stats);
172
- printf("1:0-1000 min: %f\n", *stats);
173
- free(stats);
174
-
175
- stats = bwStats(fp, "1", 0, 200, 2, min);
176
- assert(stats);
177
- printf("1:0-1000 min: %f %f\n", stats[0], stats[1]);
178
- free(stats);
179
-
180
- stats = bwStats(fp, "1", 0, 200, 1, max);
181
- assert(stats);
182
- printf("1:0-1000 max: %f\n", *stats);
183
- free(stats);
184
-
185
- stats = bwStats(fp, "1", 0, 200, 2, max);
186
- assert(stats);
187
- printf("1:0-1000 max: %f %f\n", stats[0], stats[1]);
188
- free(stats);
189
-
190
- stats = bwStats(fp, "1", 0, 200, 1, cov);
191
- assert(stats);
192
- printf("1:0-1000 coverage: %f\n", *stats);
193
- free(stats);
194
-
195
- stats = bwStats(fp, "1", 0, 200, 2, cov);
196
- assert(stats);
197
- printf("1:0-1000 coverage: %f %f\n", stats[0], stats[1]);
198
- free(stats);
199
-
200
- stats = bwStats(fp, "1", 0, 200, 1, sum);
201
- assert(stats);
202
- printf("1:0-200 sum: %f\n", *stats); //72.1
203
- free(stats);
204
-
205
- stats = bwStats(fp, "1", 100, 151, 2, sum);
206
- assert(stats);
207
- printf("1:0-200 sum: %f %f\n", stats[0], stats[1]); //35.0, 36.5
208
- free(stats);
209
-
210
- printf("1:0-200000000 intervals\n");
211
- intervals = bwGetOverlappingIntervals(fp, "1", 0, 200000000);
212
- printIntervals(intervals,0);
213
- bwDestroyOverlappingIntervals(intervals);
214
-
215
- printf("10:0-200000000 intervals\n");
216
- intervals = bwGetOverlappingIntervals(fp, "10", 0, 200000000);
217
- printIntervals(intervals,0);
218
- bwDestroyOverlappingIntervals(intervals);
219
-
220
- bwClose(fp);
221
- bwCleanup();
222
- return 0;
223
- }