jbrowse-plugin-mafviewer 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BgzipTaffyAdapter/BgzipTaffyAdapter.js +11 -4
- package/dist/BgzipTaffyAdapter/BgzipTaffyAdapter.js.map +1 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +2 -2
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +2 -2
- package/package.json +1 -1
- package/src/BgzipTaffyAdapter/BgzipTaffyAdapter.ts +12 -4
package/package.json
CHANGED
|
@@ -197,17 +197,25 @@ export default class BgzipTaffyAdapter extends BaseFeatureDataAdapter {
|
|
|
197
197
|
if (records) {
|
|
198
198
|
let firstEntry = records[0]
|
|
199
199
|
let nextEntry
|
|
200
|
+
// two pass:
|
|
201
|
+
// first pass: find first block greater than query start, then -1 from
|
|
202
|
+
// that
|
|
200
203
|
for (let i = 0; i < records.length; i++) {
|
|
201
204
|
if (records[i]!.chrStart >= query.start) {
|
|
202
|
-
// we use i-1 for firstEntry because the current record is "greater
|
|
203
|
-
// than the query start", we go backwards one record to make sure to
|
|
204
|
-
// cover up until the query start. we use i+1 to ensure we get at
|
|
205
|
-
// least one block in the case that i=0
|
|
206
205
|
firstEntry = records[Math.max(i - 1, 0)]
|
|
206
|
+
break
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// second pass: find first block where query end less than record start,
|
|
210
|
+
// and +1 from that
|
|
211
|
+
for (let i = 0; i < records.length; i++) {
|
|
212
|
+
if (query.end <= records[i]!.chrStart) {
|
|
207
213
|
nextEntry = records[i + 1]
|
|
208
214
|
break
|
|
209
215
|
}
|
|
210
216
|
}
|
|
217
|
+
|
|
218
|
+
nextEntry = nextEntry ?? records.at(-1)
|
|
211
219
|
if (firstEntry && nextEntry) {
|
|
212
220
|
const response = await file.read(
|
|
213
221
|
nextEntry.virtualOffset.blockPosition -
|