Comparing version 1.0.12 to 1.0.13
@@ -0,3 +1,10 @@ | ||
## [1.0.13](https://github.com/GMOD/bbi-js/compare/v1.0.12...v1.0.13) (2019-04-14) | ||
- Added uniqueId to objects returned from BigBed to avoid issue with duplicates | ||
## [1.0.12](https://github.com/GMOD/bbi-js/compare/v1.0.11...v1.0.12) (2019-04-12) | ||
- Fix returning bigbed objects on empty regions | ||
@@ -4,0 +11,0 @@ |
@@ -234,3 +234,3 @@ "use strict"; | ||
length: data.byteLength / 64, | ||
type: new _binaryParser.Parser().int32('chromId').int32('startBase').int32('endBase').int32('validCnt').float('minVal').float('maxVal').float('sumData').float('sumSqData') | ||
type: new _binaryParser.Parser().int32('chromId').int32('start').int32('end').int32('validCnt').float('minScore').float('maxScore').float('sumData').float('sumSqData') | ||
}); | ||
@@ -241,7 +241,7 @@ return p.parse(data).result.summary.filter(function (elt) { | ||
return { | ||
start: elt.startBase, | ||
end: elt.endBase, | ||
score: elt.sumData / elt.validCnt || 1, | ||
maxScore: elt.maxVal, | ||
minScore: elt.minVal, | ||
start: elt.start, | ||
end: elt.end, | ||
maxScore: elt.maxScore, | ||
minScore: elt.minScore, | ||
score: elt.sumData / (elt.validCnt || 1), | ||
summary: true | ||
@@ -255,13 +255,19 @@ }; | ||
key: "parseBigBedBlock", | ||
value: function parseBigBedBlock(bytes, startOffset) { | ||
value: function parseBigBedBlock(data, startOffset) { | ||
var _this3 = this; | ||
var data = bytes.slice(startOffset); | ||
var p = new _binaryParser.Parser().endianess(this.opts.isBigEndian ? 'big' : 'little').array('items', { | ||
type: new _binaryParser.Parser().uint32('chromId').int32('start').int32('end').string('rest', { | ||
zeroTerminated: true | ||
}), | ||
readUntil: 'eof' | ||
var features = []; | ||
var p = new _binaryParser.Parser().endianess(this.opts.isBigEndian ? 'big' : 'little').uint32('chromId').int32('start').int32('end').string('rest', { | ||
zeroTerminated: true | ||
}); | ||
return p.parse(data).result.items.filter(function (f) { | ||
var currOffset = startOffset; | ||
while (currOffset < data.byteLength) { | ||
var res = p.parse(data.slice(currOffset)); | ||
res.result.uniqueId = "bb-".concat(startOffset + currOffset); | ||
features.push(res.result); | ||
currOffset += res.offset; | ||
} | ||
return features.filter(function (f) { | ||
return _this3.coordFilter(f); | ||
@@ -268,0 +274,0 @@ }); |
{ | ||
"name": "@gmod/bbi", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Parser for BigWig/BigBed files", | ||
@@ -57,3 +57,3 @@ "license": "MIT", | ||
"@babel/preset-typescript": "^7.3.3", | ||
"@gmod/bed": "^1.0.3", | ||
"@gmod/bed": "^1.0.4", | ||
"@types/jest": "^24.0.11", | ||
@@ -60,0 +60,0 @@ "@types/long": "^4.0.0", |
@@ -92,3 +92,5 @@ # bbi-js | ||
const parser = new BED({autoSql}) | ||
const lines = feats.map(f => parser.parseBedText('chr7', f.start, f.end, f.rest, 3)) // 3 indicates skipping first 3 columns of the autoSql since these are provided by BigBed | ||
const lines = feats.map(f => parser.parseBedText('chr7', f.start, f.end, f.rest, { offset: 3, uniqueId: f.uniqueId })) | ||
// note: offset 3 indicates skipping first 3 columns of the autoSql since these are provided by BigBed | ||
// uniqueId is supplied by bbi-js based on the bigbed file offsets to help distinguish exact duplicate features | ||
@@ -95,0 +97,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69153
1478
125