Skip to content

Commit 32f64be

Browse files
committed
Oops, swapped the output order
1 parent f5048d6 commit 32f64be

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

2bit.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,17 @@ void *twobitBasesWorker(TwoBit *tb, uint32_t tid, uint32_t start, uint32_t end,
368368
}
369369
free(bytes);
370370

371+
//out is in TCAG order, since that's how 2bit is stored.
372+
//However, for whatever reason I went with ACTG in the first release...
371373
if(fraction) {
372-
((double*) out)[0] = ((double) tmp[0])/((double) len);
374+
((double*) out)[0] = ((double) tmp[2])/((double) len);
373375
((double*) out)[1] = ((double) tmp[1])/((double) len);
374-
((double*) out)[2] = ((double) tmp[2])/((double) len);
376+
((double*) out)[2] = ((double) tmp[0])/((double) len);
375377
((double*) out)[3] = ((double) tmp[3])/((double) len);
376378
} else {
377-
((uint32_t*) out)[0] = tmp[0];
379+
((uint32_t*) out)[0] = tmp[2];
378380
((uint32_t*) out)[1] = tmp[1];
379-
((uint32_t*) out)[2] = tmp[2];
381+
((uint32_t*) out)[2] = tmp[0];
380382
((uint32_t*) out)[3] = tmp[3];
381383
}
382384

test/test.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@
22
"""
33
The expected output is below:
44
5-
0 chr1 150 offset 0x4a
6-
1 chr2 100 offset 0x88
7-
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNACGTACGTACGTagctagctGATCGATCGTAGCTAGCTAGCTAGCTGATCNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
8-
NNNNNNNNNNNNNNNNNNNNNNNNNNACGTACGTACGTagctagctGATC
9-
0 0.086667
10-
1 0.080000
11-
2 0.080000
12-
3 0.086667
13-
0 0.120000
14-
1 0.120000
15-
2 0.120000
16-
3 0.120000
175
"""
186
from subprocess import Popen, PIPE, check_call
197
from os import remove
@@ -27,6 +15,6 @@
2715
except:
2816
p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
2917
md5sum = p2.communicate()[0].strip().split()[0]
30-
assert(md5sum == "55e28106e51c37e9191846f0b69a7b52")
18+
assert(md5sum == "0274c32c7f3dd75e8991f6107dca6a5f")
3119

3220
print("Passed!")

0 commit comments

Comments
 (0)