@gmod/cram
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "@gmod/cram", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "read CRAM files with pure Javascript", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -395,13 +395,21 @@ const { | ||
const refStart = records[0].alignmentStart | ||
const lastRecord = records[records.length - 1] | ||
const refEnd = lastRecord.alignmentStart + lastRecord.lengthOnRef - 1 | ||
const seq = await this.file.fetchReferenceSequenceCallback( | ||
sliceHeader.content.refSeqId, | ||
refStart, | ||
refEnd, | ||
) | ||
const refRegion = { seq, start: refStart, end: refEnd } | ||
records.forEach(r => { | ||
r.addReferenceSequence(refRegion, compressionScheme) | ||
}) | ||
// need to iterate over the records to find the right end of the span | ||
let refEnd = -Infinity | ||
for (let i = 0; i < records.length; i += 1) { | ||
const end = records[i].alignmentStart + records[i].lengthOnRef - 1 | ||
if (end > refEnd) refEnd = end | ||
} | ||
if (refStart <= refEnd) { | ||
const seq = await this.file.fetchReferenceSequenceCallback( | ||
sliceHeader.content.refSeqId, | ||
refStart, | ||
refEnd, | ||
) | ||
const refRegion = { seq, start: refStart, end: refEnd } | ||
records.forEach(r => { | ||
r.addReferenceSequence(refRegion, compressionScheme) | ||
}) | ||
} | ||
} | ||
@@ -408,0 +416,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
163199
4006