Skip to content

Commit 7494027

Browse files
authored
Merge pull request #10 from deeptools/dpryan79-patch-1
Fix #9
2 parents 1821661 + 29d4078 commit 7494027

File tree

3 files changed

+41
-14
lines changed

3 files changed

+41
-14
lines changed

.travis.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

azure-pipelines.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
pr:
2+
autoCancel: true
3+
4+
jobs:
5+
6+
- job: 'Linux'
7+
pool:
8+
vmImage: 'ubuntu-latest'
9+
strategy:
10+
matrix:
11+
Python36:
12+
python.version: '3.6'
13+
Python37:
14+
python.version: '3.7'
15+
Python38:
16+
python.version: '3.8'
17+
Python39:
18+
python.version: '3.9'
19+
Python310:
20+
python.version: '3.10'
21+
maxParallel: 5
22+
23+
steps:
24+
- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin"
25+
displayName: Add conda to PATH
26+
27+
- bash: conda create -n foo -q --yes -c conda-forge -c bioconda python=$(python.version) libcurl zlib pip nose gcc_linux-64
28+
displayName: Installing dependencies
29+
- bash: |
30+
source activate foo
31+
python -m pip install . --no-deps --ignore-installed -vvv
32+
displayName: Installing py2bit
33+
- bash: |
34+
source activate foo
35+
nosetests -sv
36+
displayName: Test py2bit

lib2bit/2bit.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ uint8_t getByteMaskFromOffset(int offset) {
278278
void *twobitBasesWorker(TwoBit *tb, uint32_t tid, uint32_t start, uint32_t end, int fraction) {
279279
void *out;
280280
uint32_t tmp[4] = {0, 0, 0, 0}, len = end - start + (start % 4), i = 0, j = 0;
281+
uint32_t seqLen = end - start;
281282
uint32_t blockStart, blockEnd, maskIdx = (uint32_t) -1, maskStart, maskEnd, foo;
282283
uint8_t *bytes = NULL, mask = 0, offset;
283284

@@ -375,10 +376,10 @@ void *twobitBasesWorker(TwoBit *tb, uint32_t tid, uint32_t start, uint32_t end,
375376
//out is in TCAG order, since that's how 2bit is stored.
376377
//However, for whatever reason I went with ACTG in the first release...
377378
if(fraction) {
378-
((double*) out)[0] = ((double) tmp[2])/((double) len);
379-
((double*) out)[1] = ((double) tmp[1])/((double) len);
380-
((double*) out)[2] = ((double) tmp[0])/((double) len);
381-
((double*) out)[3] = ((double) tmp[3])/((double) len);
379+
((double*) out)[0] = ((double) tmp[2])/((double) seqLen);
380+
((double*) out)[1] = ((double) tmp[1])/((double) seqLen);
381+
((double*) out)[2] = ((double) tmp[0])/((double) seqLen);
382+
((double*) out)[3] = ((double) tmp[3])/((double) seqLen);
382383
} else {
383384
((uint32_t*) out)[0] = tmp[2];
384385
((uint32_t*) out)[1] = tmp[1];

0 commit comments

Comments
 (0)