jbrowse-plugin-mafviewer 1.0.6 → 1.1.1
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/README.md +71 -22
- package/dist/BgzipTaffyAdapter/BgzipTaffyAdapter.d.ts +20 -0
- package/dist/BgzipTaffyAdapter/BgzipTaffyAdapter.js +197 -0
- package/dist/BgzipTaffyAdapter/BgzipTaffyAdapter.js.map +1 -0
- package/dist/BgzipTaffyAdapter/configSchema.d.ts +44 -0
- package/dist/BgzipTaffyAdapter/configSchema.js +53 -0
- package/dist/BgzipTaffyAdapter/configSchema.js.map +1 -0
- package/dist/BgzipTaffyAdapter/index.d.ts +2 -0
- package/dist/BgzipTaffyAdapter/index.js +11 -0
- package/dist/BgzipTaffyAdapter/index.js.map +1 -0
- package/dist/BgzipTaffyAdapter/rowInstructions.d.ts +35 -0
- package/dist/BgzipTaffyAdapter/rowInstructions.js +55 -0
- package/dist/BgzipTaffyAdapter/rowInstructions.js.map +1 -0
- package/dist/BgzipTaffyAdapter/types.d.ts +13 -0
- package/dist/BgzipTaffyAdapter/types.js +2 -0
- package/dist/BgzipTaffyAdapter/types.js.map +1 -0
- package/dist/BgzipTaffyAdapter/virtualOffset.d.ts +8 -0
- package/dist/BgzipTaffyAdapter/virtualOffset.js +23 -0
- package/dist/BgzipTaffyAdapter/virtualOffset.js.map +1 -0
- package/dist/BigMafAdapter/BigMafAdapter.d.ts +17 -0
- package/dist/BigMafAdapter/BigMafAdapter.js +92 -0
- package/dist/BigMafAdapter/BigMafAdapter.js.map +1 -0
- package/dist/BigMafAdapter/configSchema.d.ts +32 -0
- package/dist/BigMafAdapter/configSchema.js +39 -0
- package/dist/BigMafAdapter/configSchema.js.map +1 -0
- package/dist/BigMafAdapter/index.d.ts +2 -0
- package/dist/BigMafAdapter/index.js +11 -0
- package/dist/BigMafAdapter/index.js.map +1 -0
- package/dist/LinearMafDisplay/components/ColorLegend.d.ts +8 -0
- package/dist/LinearMafDisplay/components/ColorLegend.js +19 -0
- package/dist/LinearMafDisplay/components/ColorLegend.js.map +1 -0
- package/dist/LinearMafDisplay/components/ReactComponent.d.ts +6 -0
- package/dist/LinearMafDisplay/components/ReactComponent.js +50 -0
- package/dist/LinearMafDisplay/components/ReactComponent.js.map +1 -0
- package/dist/LinearMafDisplay/components/RectBg.d.ts +9 -0
- package/dist/LinearMafDisplay/components/RectBg.js +7 -0
- package/dist/LinearMafDisplay/components/RectBg.js.map +1 -0
- package/dist/LinearMafDisplay/components/SetRowHeight.d.ts +11 -0
- package/dist/LinearMafDisplay/components/SetRowHeight.js +36 -0
- package/dist/LinearMafDisplay/components/SetRowHeight.js.map +1 -0
- package/dist/LinearMafDisplay/components/SvgWrapper.d.ts +8 -0
- package/dist/LinearMafDisplay/components/SvgWrapper.js +21 -0
- package/dist/LinearMafDisplay/components/SvgWrapper.js.map +1 -0
- package/dist/LinearMafDisplay/components/Tree.d.ts +5 -0
- package/dist/LinearMafDisplay/components/Tree.js +22 -0
- package/dist/LinearMafDisplay/components/Tree.js.map +1 -0
- package/dist/LinearMafDisplay/components/YScaleBars.d.ts +8 -0
- package/dist/LinearMafDisplay/components/YScaleBars.js +20 -0
- package/dist/LinearMafDisplay/components/YScaleBars.js.map +1 -0
- package/dist/LinearMafDisplay/components/util.d.ts +1 -0
- package/dist/LinearMafDisplay/components/util.js +8 -0
- package/dist/LinearMafDisplay/components/util.js.map +1 -0
- package/dist/LinearMafDisplay/configSchema.d.ts +34 -0
- package/dist/LinearMafDisplay/configSchema.js +15 -0
- package/dist/LinearMafDisplay/configSchema.js.map +1 -0
- package/dist/LinearMafDisplay/index.d.ts +2 -0
- package/dist/LinearMafDisplay/index.js +20 -0
- package/dist/LinearMafDisplay/index.js.map +1 -0
- package/dist/LinearMafDisplay/renderSvg.d.ts +4 -0
- package/dist/LinearMafDisplay/renderSvg.js +18 -0
- package/dist/LinearMafDisplay/renderSvg.js.map +1 -0
- package/dist/LinearMafDisplay/stateModel.d.ts +426 -0
- package/dist/LinearMafDisplay/stateModel.js +276 -0
- package/dist/LinearMafDisplay/stateModel.js.map +1 -0
- package/dist/LinearMafDisplay/types.d.ts +17 -0
- package/dist/LinearMafDisplay/types.js +16 -0
- package/dist/LinearMafDisplay/types.js.map +1 -0
- package/dist/LinearMafRenderer/LinearMafRenderer.d.ts +45 -0
- package/dist/LinearMafRenderer/LinearMafRenderer.js +183 -0
- package/dist/LinearMafRenderer/LinearMafRenderer.js.map +1 -0
- package/dist/LinearMafRenderer/components/ReactComponent.d.ts +6 -0
- package/dist/LinearMafRenderer/components/ReactComponent.js +8 -0
- package/dist/LinearMafRenderer/components/ReactComponent.js.map +1 -0
- package/dist/LinearMafRenderer/configSchema.d.ts +2 -0
- package/dist/LinearMafRenderer/configSchema.js +13 -0
- package/dist/LinearMafRenderer/configSchema.js.map +1 -0
- package/dist/LinearMafRenderer/index.d.ts +2 -0
- package/dist/LinearMafRenderer/index.js +12 -0
- package/dist/LinearMafRenderer/index.js.map +1 -0
- package/dist/LinearMafRenderer/util.d.ts +10 -0
- package/dist/LinearMafRenderer/util.js +16 -0
- package/dist/LinearMafRenderer/util.js.map +1 -0
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.d.ts +5 -0
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js +128 -0
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js.map +1 -0
- package/dist/MafAddTrackWorkflow/index.d.ts +2 -0
- package/dist/MafAddTrackWorkflow/index.js +12 -0
- package/dist/MafAddTrackWorkflow/index.js.map +1 -0
- package/dist/MafRPC/index.d.ts +16 -0
- package/dist/MafRPC/index.js +19 -0
- package/dist/MafRPC/index.js.map +1 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.d.ts +25 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.js +95 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.js.map +1 -0
- package/dist/MafTabixAdapter/configSchema.d.ts +50 -0
- package/dist/MafTabixAdapter/configSchema.js +56 -0
- package/dist/MafTabixAdapter/configSchema.js.map +1 -0
- package/dist/MafTabixAdapter/index.d.ts +2 -0
- package/dist/MafTabixAdapter/index.js +11 -0
- package/dist/MafTabixAdapter/index.js.map +1 -0
- package/dist/MafTrack/configSchema.d.ts +79 -0
- package/dist/MafTrack/configSchema.js +15 -0
- package/dist/MafTrack/configSchema.js.map +1 -0
- package/dist/MafTrack/index.d.ts +2 -0
- package/dist/MafTrack/index.js +14 -0
- package/dist/MafTrack/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +65 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +7 -1
- package/dist/parseNewick.d.ts +60 -0
- package/dist/parseNewick.js +95 -0
- package/dist/parseNewick.js.map +1 -0
- package/dist/util.d.ts +9 -0
- package/dist/util.js +9 -0
- package/dist/util.js.map +1 -0
- package/package.json +37 -41
- package/src/BgzipTaffyAdapter/BgzipTaffyAdapter.ts +227 -0
- package/src/BgzipTaffyAdapter/configSchema.ts +59 -0
- package/src/BgzipTaffyAdapter/index.ts +16 -0
- package/src/BgzipTaffyAdapter/rowInstructions.ts +91 -0
- package/src/BgzipTaffyAdapter/types.ts +16 -0
- package/src/BgzipTaffyAdapter/virtualOffset.ts +29 -0
- package/src/BigMafAdapter/BigMafAdapter.ts +12 -13
- package/src/BigMafAdapter/configSchema.ts +11 -0
- package/src/BigMafAdapter/index.ts +2 -1
- package/src/LinearMafDisplay/components/ColorLegend.tsx +38 -27
- package/src/LinearMafDisplay/components/ReactComponent.tsx +68 -3
- package/src/LinearMafDisplay/components/SetRowHeight.tsx +15 -8
- package/src/LinearMafDisplay/components/SvgWrapper.tsx +39 -0
- package/src/LinearMafDisplay/components/Tree.tsx +33 -0
- package/src/LinearMafDisplay/components/YScaleBars.tsx +11 -38
- package/src/LinearMafDisplay/components/util.ts +7 -0
- package/src/LinearMafDisplay/index.ts +2 -1
- package/src/LinearMafDisplay/renderSvg.tsx +2 -1
- package/src/LinearMafDisplay/stateModel.ts +169 -18
- package/src/LinearMafDisplay/types.ts +41 -0
- package/src/LinearMafRenderer/LinearMafRenderer.ts +51 -44
- package/src/LinearMafRenderer/components/ReactComponent.tsx +2 -1
- package/src/LinearMafRenderer/index.ts +2 -1
- package/src/LinearMafRenderer/util.ts +20 -0
- package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +133 -51
- package/src/MafRPC/index.ts +39 -0
- package/src/MafTabixAdapter/MafTabixAdapter.ts +33 -27
- package/src/MafTabixAdapter/configSchema.ts +17 -1
- package/src/MafTabixAdapter/index.ts +2 -1
- package/src/MafTrack/index.ts +1 -0
- package/src/index.ts +6 -2
- package/src/parseNewick.ts +94 -0
- package/src/util.ts +11 -0
- package/LICENSE +0 -201
- package/dist/jbrowse-plugin-mafviewer.umd.development.js +0 -1439
- package/dist/jbrowse-plugin-mafviewer.umd.development.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ JBrowse 2
|
|
|
9
9
|
|
|
10
10
|
## Demo
|
|
11
11
|
|
|
12
|
-
https://jbrowse.org/code/jb2/main/?config=%2Fdemos%
|
|
12
|
+
https://jbrowse.org/code/jb2/main/?config=%2Fdemos%2Fmaf%2Fhg38%2Fdistconfig.json&session=share-jREsrEm0Q-&password=fRZjQ
|
|
13
13
|
|
|
14
14
|
## GUI usage (e.g. in JBrowse Desktop)
|
|
15
15
|
|
|
@@ -41,7 +41,7 @@ Then use the custom "Add track workflow"
|
|
|
41
41
|
|
|
42
42
|
### Example MafTabixAdapter config
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
can use nhLocation or samples array on adapter
|
|
45
45
|
|
|
46
46
|
```json
|
|
47
47
|
{
|
|
@@ -66,6 +66,8 @@ The MafTabix track is created according to
|
|
|
66
66
|
|
|
67
67
|
### Example BigMafAdapter config
|
|
68
68
|
|
|
69
|
+
can use nhLocation or samples array on adapter
|
|
70
|
+
|
|
69
71
|
```json
|
|
70
72
|
{
|
|
71
73
|
"type": "MafTrack",
|
|
@@ -90,6 +92,31 @@ The MafTabix track is created according to
|
|
|
90
92
|
}
|
|
91
93
|
```
|
|
92
94
|
|
|
95
|
+
### Example BgzipTaffyAdapter config
|
|
96
|
+
|
|
97
|
+
can use nhLocation or samples array on adapter
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"type": "MafTrack",
|
|
102
|
+
"trackId": "bigMaf",
|
|
103
|
+
"name": "taffy",
|
|
104
|
+
"adapter": {
|
|
105
|
+
"type": "BgzipTaffyAdapter",
|
|
106
|
+
"nhLocation": {
|
|
107
|
+
"uri": "hg38.30way.nh"
|
|
108
|
+
},
|
|
109
|
+
"tafGzLocation": {
|
|
110
|
+
"uri": "30way.taf.gz"
|
|
111
|
+
},
|
|
112
|
+
"taiGzLocation": {
|
|
113
|
+
"uri": "30way.taf.gz.tai"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"assemblyNames": ["hg38"]
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
93
120
|
### Example with customized sample names and colors
|
|
94
121
|
|
|
95
122
|
```json
|
|
@@ -136,47 +163,57 @@ The MafTabix track is created according to
|
|
|
136
163
|
|
|
137
164
|
The samples array is either `string[]|{id:string,label:string,color?:string}[]`
|
|
138
165
|
|
|
139
|
-
##
|
|
166
|
+
## Creating MAF files as Cactus pangenome/HAL
|
|
167
|
+
|
|
168
|
+
You can create a MAF file from a Cactus pangenome graph using
|
|
169
|
+
ComparativeGenomeToolkit
|
|
170
|
+
|
|
171
|
+
This page discusses some examples
|
|
140
172
|
|
|
141
|
-
|
|
142
|
-
|
|
173
|
+
https://github.com/ComparativeGenomicsToolkit/cactus/blob/master/doc/progressive.md#maf-export
|
|
174
|
+
|
|
175
|
+
Thanks to Sam Talbot (https://github.com/SamCT) for initially creating the
|
|
176
|
+
Cactus -> JBrowse 2 MAF example
|
|
177
|
+
|
|
178
|
+
Please note that MAFViewer wants non-overlapping blocks, please check if this is
|
|
179
|
+
the case
|
|
180
|
+
|
|
181
|
+
## Prepare data
|
|
143
182
|
|
|
144
183
|
1. BigMaf format, which can be created following UCSC guidelines
|
|
184
|
+
(https://genome.ucsc.edu/FAQ/FAQformat.html#format9.3)
|
|
145
185
|
|
|
146
186
|
2. MAF tabix based format, based on a custom BED created via conversion tools in
|
|
147
|
-
this repo
|
|
187
|
+
this repo (see maf2bed)
|
|
148
188
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
newer for it's BigBed support. The custom BED format only requires JBrowse
|
|
152
|
-
1.12.3 or newer, so therefore some slightly older JBrowse versions can support
|
|
153
|
-
it.
|
|
189
|
+
3. TAF format (new!). Currently only supports bgzip'd TAF. This is pioneered by
|
|
190
|
+
https://github.com/ComparativeGenomicsToolkit/taffy
|
|
154
191
|
|
|
155
|
-
_Note:
|
|
156
|
-
should contain the species name and chromosome name e.g. hg38.chr1 in the
|
|
192
|
+
_Note: All these formats generally start with a MAF as input. Note that your MAF
|
|
193
|
+
file should contain the species name and chromosome name e.g. hg38.chr1 in the
|
|
157
194
|
sequence identifiers._
|
|
158
195
|
|
|
159
|
-
### Preparing BigMaf
|
|
196
|
+
### Option 1. Preparing BigMaf
|
|
160
197
|
|
|
161
198
|
Follow instructions from https://genome.ucsc.edu/FAQ/FAQformat.html#format9.3
|
|
162
|
-
and set the storeType of your track as MAFViewer/Store/SeqFeature/BigMaf
|
|
163
199
|
|
|
164
|
-
### Preparing
|
|
200
|
+
### Option 2. Preparing MAF tabix
|
|
165
201
|
|
|
166
202
|
Start by converting the MAF into a pseudo-BED format using the maf2bed tool
|
|
167
203
|
|
|
168
204
|
```bash
|
|
169
205
|
# from https://github.com/cmdcolin/maf2bed
|
|
170
206
|
cargo install maf2bed
|
|
171
|
-
cat file.maf | maf2bed hg38 | bgzip > out.bed
|
|
172
|
-
tabix
|
|
207
|
+
cat file.maf | maf2bed hg38 | sort -k1,1 -k2,2n | bgzip > out.bed.gz
|
|
208
|
+
tabix out.bed.gz
|
|
173
209
|
```
|
|
174
210
|
|
|
175
211
|
The second argument to maf2bed is the genome version e.g. hg38 used for the main
|
|
176
212
|
species in the MAF (if your MAF comes from a pipeline like Ensembl or UCSC, the
|
|
177
213
|
identifiers in the MAF file will say something like hg38.chr1, therefore, the
|
|
178
214
|
argument to maf2bed should just be hg38 to remove hg38 part of the identifier.
|
|
179
|
-
|
|
215
|
+
|
|
216
|
+
If your MAF file does not include the species name as part of the identifier,
|
|
180
217
|
you should add the species into them the those scaffold/chromosome e.g. create
|
|
181
218
|
hg38.chr1 if it was just chr1 before)
|
|
182
219
|
|
|
@@ -185,7 +222,19 @@ If all is well, your BED file should have 6 columns, with
|
|
|
185
222
|
separated between each species by `;` and each field in the alignment is
|
|
186
223
|
separated by `:`.
|
|
187
224
|
|
|
188
|
-
|
|
225
|
+
Note: If you can't use the `cargo install maf2bed` binary, there is a
|
|
226
|
+
`bin/maf2bed.pl` perl version of it in this repo
|
|
227
|
+
|
|
228
|
+
### Option 3. Preparing TAF
|
|
229
|
+
|
|
230
|
+
Follow steps from https://github.com/ComparativeGenomicsToolkit/taffy
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
taffy view -i chr22.maf -o chr22.taf
|
|
234
|
+
bgzip chr22.taf
|
|
235
|
+
taffy index -i chr22.taf.gz
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
The above workflow requires that taffy is built with "htslib support"
|
|
189
239
|
|
|
190
|
-
|
|
191
|
-
perl version of it in this repo
|
|
240
|
+
Note that the TAF support is beta, let me know if you run into any issues
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
import { Feature, Region } from '@jbrowse/core/util';
|
|
3
|
+
import type { IndexData } from './types';
|
|
4
|
+
export default class BgzipTaffyAdapter extends BaseFeatureDataAdapter {
|
|
5
|
+
setupP?: Promise<IndexData>;
|
|
6
|
+
getRefNames(): Promise<string[]>;
|
|
7
|
+
setup(): Promise<IndexData>;
|
|
8
|
+
readTaiFile(): Promise<IndexData>;
|
|
9
|
+
getFeatures(query: Region): import("rxjs").Observable<Feature>;
|
|
10
|
+
getSamples(_query: Region): Promise<{
|
|
11
|
+
samples: {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
}[];
|
|
16
|
+
tree: Record<string, any> | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
getLines(query: Region): Promise<string[]>;
|
|
19
|
+
freeResources(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { unzip } from '@gmod/bgzf-filehandle';
|
|
2
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
+
import { SimpleFeature } from '@jbrowse/core/util';
|
|
4
|
+
import { openLocation } from '@jbrowse/core/util/io';
|
|
5
|
+
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
6
|
+
import Long from 'long';
|
|
7
|
+
import VirtualOffset from './virtualOffset';
|
|
8
|
+
import parseNewick from '../parseNewick';
|
|
9
|
+
import { normalize } from '../util';
|
|
10
|
+
import { parseRowInstructions } from './rowInstructions';
|
|
11
|
+
export default class BgzipTaffyAdapter extends BaseFeatureDataAdapter {
|
|
12
|
+
setupP;
|
|
13
|
+
async getRefNames() {
|
|
14
|
+
const data = await this.setup();
|
|
15
|
+
return Object.keys(data);
|
|
16
|
+
}
|
|
17
|
+
setup() {
|
|
18
|
+
if (!this.setupP) {
|
|
19
|
+
this.setupP = this.readTaiFile().catch((e) => {
|
|
20
|
+
this.setupP = undefined;
|
|
21
|
+
throw e;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return this.setupP;
|
|
25
|
+
}
|
|
26
|
+
async readTaiFile() {
|
|
27
|
+
const text = await openLocation(this.getConf('taiLocation')).readFile('utf8');
|
|
28
|
+
const lines = text
|
|
29
|
+
.split('\n')
|
|
30
|
+
.map(f => f.trim())
|
|
31
|
+
.filter(line => !!line);
|
|
32
|
+
const entries = {};
|
|
33
|
+
let lastChr = '';
|
|
34
|
+
let lastChrStart = 0;
|
|
35
|
+
let lastRawVirtualOffset = 0;
|
|
36
|
+
for (const line of lines) {
|
|
37
|
+
const [chr, chrStart, virtualOffset] = line.split('\t');
|
|
38
|
+
const relativizedVirtualOffset = lastRawVirtualOffset + +virtualOffset;
|
|
39
|
+
const currChr = chr === '*' ? lastChr : chr.split('.').at(-1);
|
|
40
|
+
// bgzip TAF files store virtual offsets in plaintext in the TAI file
|
|
41
|
+
// these virtualoffsets are 64bit values, so the long library is needed
|
|
42
|
+
// to accurately do the bit manipulations needed
|
|
43
|
+
const x = Long.fromNumber(relativizedVirtualOffset);
|
|
44
|
+
const y = x.shiftRightUnsigned(16);
|
|
45
|
+
const z = x.and(0xffff);
|
|
46
|
+
const voff = new VirtualOffset(y.toNumber(), z.toNumber());
|
|
47
|
+
if (!entries[currChr]) {
|
|
48
|
+
entries[currChr] = [];
|
|
49
|
+
lastChr = '';
|
|
50
|
+
lastChrStart = 0;
|
|
51
|
+
lastRawVirtualOffset = 0;
|
|
52
|
+
}
|
|
53
|
+
const currStart = +chrStart + lastChrStart;
|
|
54
|
+
entries[currChr].push({
|
|
55
|
+
chrStart: currStart,
|
|
56
|
+
virtualOffset: voff,
|
|
57
|
+
});
|
|
58
|
+
lastChr = currChr;
|
|
59
|
+
lastChrStart = currStart;
|
|
60
|
+
lastRawVirtualOffset = relativizedVirtualOffset;
|
|
61
|
+
}
|
|
62
|
+
return entries;
|
|
63
|
+
}
|
|
64
|
+
getFeatures(query) {
|
|
65
|
+
return ObservableCreate(async (observer) => {
|
|
66
|
+
try {
|
|
67
|
+
const lines = await this.getLines(query);
|
|
68
|
+
const alignments = {};
|
|
69
|
+
const k = lines.length;
|
|
70
|
+
const data = [];
|
|
71
|
+
let a0;
|
|
72
|
+
for (let j = 0; j < k; j++) {
|
|
73
|
+
const line = lines[j];
|
|
74
|
+
if (line) {
|
|
75
|
+
const [lineData, rowInstructions] = line.split(' ; ');
|
|
76
|
+
if (rowInstructions) {
|
|
77
|
+
for (const ins of parseRowInstructions(rowInstructions)) {
|
|
78
|
+
if (ins.type === 'i') {
|
|
79
|
+
data.splice(ins.row, 0, ins);
|
|
80
|
+
if (!alignments[ins.asm]) {
|
|
81
|
+
alignments[ins.asm] = {
|
|
82
|
+
start: ins.start,
|
|
83
|
+
strand: ins.strand,
|
|
84
|
+
srcSize: ins.length,
|
|
85
|
+
chr: ins.ref,
|
|
86
|
+
data: '',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const e = alignments[ins.asm];
|
|
90
|
+
e.data += ' '.repeat(Math.max(0, j - e.data.length)); // catch it up
|
|
91
|
+
}
|
|
92
|
+
else if (ins.type === 's') {
|
|
93
|
+
if (!alignments[ins.asm]) {
|
|
94
|
+
alignments[ins.asm] = {
|
|
95
|
+
start: ins.start,
|
|
96
|
+
strand: ins.strand,
|
|
97
|
+
srcSize: ins.length,
|
|
98
|
+
chr: ins.ref,
|
|
99
|
+
data: '',
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const e = alignments[ins.asm];
|
|
103
|
+
e.data += ' '.repeat(Math.max(0, j - e.data.length)); // catch it up
|
|
104
|
+
data[ins.row] = ins;
|
|
105
|
+
}
|
|
106
|
+
else if (ins.type === 'd') {
|
|
107
|
+
data.splice(ins.row, 1);
|
|
108
|
+
}
|
|
109
|
+
// no gaps for now(?)
|
|
110
|
+
// else if (ins.type === 'g') {
|
|
111
|
+
// }
|
|
112
|
+
// else if (ins.type === 'G') {
|
|
113
|
+
// }
|
|
114
|
+
}
|
|
115
|
+
if (!a0) {
|
|
116
|
+
a0 = data[0];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const lineLen = lineData.length;
|
|
120
|
+
for (let i = 0; i < lineLen; i++) {
|
|
121
|
+
const letter = lineData[i];
|
|
122
|
+
const r = data[i];
|
|
123
|
+
alignments[r.asm].data += letter;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (a0) {
|
|
128
|
+
const row0 = alignments[a0.asm];
|
|
129
|
+
// see
|
|
130
|
+
// https://github.com/ComparativeGenomicsToolkit/taffy/blob/f5a5354/docs/taffy_utilities.md#referenced-based-maftaf-and-indexing
|
|
131
|
+
// for the significance of row[0]:
|
|
132
|
+
//
|
|
133
|
+
// "An anchor line in TAF is a column from which all sequence
|
|
134
|
+
// coordinates can be deduced without scanning backwards to previous
|
|
135
|
+
// lines "
|
|
136
|
+
observer.next(new SimpleFeature({
|
|
137
|
+
uniqueId: `${row0.start}-${row0.data.length}`,
|
|
138
|
+
refName: query.refName,
|
|
139
|
+
start: row0.start,
|
|
140
|
+
end: row0.start + row0.data.length,
|
|
141
|
+
strand: row0.strand,
|
|
142
|
+
alignments,
|
|
143
|
+
seq: row0.data,
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
observer.complete();
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
observer.error(e);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
async getSamples(_query) {
|
|
154
|
+
const nhLoc = this.getConf('nhLocation');
|
|
155
|
+
const nh = nhLoc.uri === '/path/to/my.nh'
|
|
156
|
+
? undefined
|
|
157
|
+
: await openLocation(nhLoc).readFile('utf8');
|
|
158
|
+
// TODO: we may need to resolve the exact set of rows in the visible region
|
|
159
|
+
// here
|
|
160
|
+
return {
|
|
161
|
+
samples: normalize(this.getConf('samples')),
|
|
162
|
+
tree: nh ? parseNewick(nh) : undefined,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
async getLines(query) {
|
|
166
|
+
const byteRanges = await this.setup();
|
|
167
|
+
const file = openLocation(this.getConf('tafGzLocation'));
|
|
168
|
+
const decoder = new TextDecoder('utf8');
|
|
169
|
+
const records = byteRanges[query.refName];
|
|
170
|
+
if (records) {
|
|
171
|
+
let firstEntry = records[0];
|
|
172
|
+
let nextEntry;
|
|
173
|
+
for (let i = 0; i < records.length; i++) {
|
|
174
|
+
if (records[i].chrStart >= query.start) {
|
|
175
|
+
// we use i-1 for firstEntry because the current record is "greater
|
|
176
|
+
// than the query start", we go backwards one record to make sure to
|
|
177
|
+
// cover up until the query start. we use i+1 to ensure we get at
|
|
178
|
+
// least one block in the case that i=0
|
|
179
|
+
firstEntry = records[Math.max(i - 1, 0)];
|
|
180
|
+
nextEntry = records[i + 1];
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (firstEntry && nextEntry) {
|
|
185
|
+
const response = await file.read(nextEntry.virtualOffset.blockPosition -
|
|
186
|
+
firstEntry.virtualOffset.blockPosition, firstEntry.virtualOffset.blockPosition);
|
|
187
|
+
const buffer = await unzip(response);
|
|
188
|
+
return decoder
|
|
189
|
+
.decode(buffer.slice(firstEntry.virtualOffset.dataPosition))
|
|
190
|
+
.split('\n');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return [];
|
|
194
|
+
}
|
|
195
|
+
freeResources() { }
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=BgzipTaffyAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BgzipTaffyAdapter.js","sourceRoot":"","sources":["../../src/BgzipTaffyAdapter/BgzipTaffyAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAChF,OAAO,EAAmB,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAA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UAAU,IAAI,SAAS,EAAE,CAAC;gBAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAC9B,SAAS,CAAC,aAAa,CAAC,aAAa;oBACnC,UAAU,CAAC,aAAa,CAAC,aAAa,EACxC,UAAU,CAAC,aAAa,CAAC,aAAa,CACvC,CAAA;gBACD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAA;gBACpC,OAAO,OAAO;qBACX,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;qBAC3D,KAAK,CAAC,IAAI,CAAC,CAAA;YAChB,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,aAAa,KAAU,CAAC;CACzB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
+
/**
|
|
3
|
+
* #slot
|
|
4
|
+
*/
|
|
5
|
+
samples: {
|
|
6
|
+
type: string;
|
|
7
|
+
description: string;
|
|
8
|
+
defaultValue: never[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* #slot
|
|
12
|
+
*/
|
|
13
|
+
tafGzLocation: {
|
|
14
|
+
type: string;
|
|
15
|
+
description: string;
|
|
16
|
+
defaultValue: {
|
|
17
|
+
uri: string;
|
|
18
|
+
locationType: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* #slot
|
|
23
|
+
*/
|
|
24
|
+
taiLocation: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
defaultValue: {
|
|
28
|
+
uri: string;
|
|
29
|
+
locationType: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* #slot
|
|
34
|
+
*/
|
|
35
|
+
nhLocation: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
defaultValue: {
|
|
39
|
+
uri: string;
|
|
40
|
+
locationType: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
44
|
+
export default configSchema;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
+
/**
|
|
3
|
+
* #config BgzipTaffyAdapter
|
|
4
|
+
* used to configure BgzipTaffy adapter
|
|
5
|
+
*/
|
|
6
|
+
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
7
|
+
const configSchema = ConfigurationSchema('BgzipTaffyAdapter', {
|
|
8
|
+
/**
|
|
9
|
+
* #slot
|
|
10
|
+
*/
|
|
11
|
+
samples: {
|
|
12
|
+
type: 'frozen',
|
|
13
|
+
description: 'string[] or {id:string,label:string,color?:string}[]',
|
|
14
|
+
defaultValue: [],
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* #slot
|
|
18
|
+
*/
|
|
19
|
+
tafGzLocation: {
|
|
20
|
+
type: 'fileLocation',
|
|
21
|
+
description: 'bgzip taffy file',
|
|
22
|
+
defaultValue: {
|
|
23
|
+
uri: '/path/to/my.taf',
|
|
24
|
+
locationType: 'UriLocation',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* #slot
|
|
29
|
+
*/
|
|
30
|
+
taiLocation: {
|
|
31
|
+
type: 'fileLocation',
|
|
32
|
+
description: 'taffy index',
|
|
33
|
+
defaultValue: {
|
|
34
|
+
uri: '/path/to/my.taf.gz.tai',
|
|
35
|
+
locationType: 'UriLocation',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* #slot
|
|
40
|
+
*/
|
|
41
|
+
nhLocation: {
|
|
42
|
+
type: 'fileLocation',
|
|
43
|
+
description: 'newick tree',
|
|
44
|
+
defaultValue: {
|
|
45
|
+
uri: '/path/to/my.nh',
|
|
46
|
+
locationType: 'UriLocation',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}, {
|
|
50
|
+
explicitlyTyped: true,
|
|
51
|
+
});
|
|
52
|
+
export default configSchema;
|
|
53
|
+
//# sourceMappingURL=configSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configSchema.js","sourceRoot":"","sources":["../../src/BgzipTaffyAdapter/configSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE;;;GAGG;AACH,SAAS,CAAC,KAAI,CAAC,CAAC,wDAAwD;AAExE,MAAM,YAAY,GAAG,mBAAmB,CACtC,mBAAmB,EACnB;IACE;;OAEG;IACH,OAAO,EAAE;QACP,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,sDAAsD;QACnE,YAAY,EAAE,EAAE;KACjB;IACD;;OAEG;IACH,aAAa,EAAE;QACb,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,kBAAkB;QAC/B,YAAY,EAAE;YACZ,GAAG,EAAE,iBAAiB;YACtB,YAAY,EAAE,aAAa;SAC5B;KACF;IACD;;OAEG;IACH,WAAW,EAAE;QACX,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE;YACZ,GAAG,EAAE,wBAAwB;YAC7B,YAAY,EAAE,aAAa;SAC5B;KACF;IACD;;OAEG;IACH,UAAU,EAAE;QACV,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE;YACZ,GAAG,EAAE,gBAAgB;YACrB,YAAY,EAAE,aAAa;SAC5B;KACF;CACF,EACD;IACE,eAAe,EAAE,IAAI;CACtB,CACF,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AdapterType } from '@jbrowse/core/pluggableElementTypes';
|
|
2
|
+
import BgzipTaffyAdapter from './BgzipTaffyAdapter';
|
|
3
|
+
import configSchema from './configSchema';
|
|
4
|
+
export default function BgzipTaffyAdapterF(pluginManager) {
|
|
5
|
+
return pluginManager.addAdapterType(() => new AdapterType({
|
|
6
|
+
name: 'BgzipTaffyAdapter',
|
|
7
|
+
AdapterClass: BgzipTaffyAdapter,
|
|
8
|
+
configSchema,
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/BgzipTaffyAdapter/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAA;AAEjE,OAAO,iBAAiB,MAAM,qBAAqB,CAAA;AACnD,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAEzC,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,aAA4B;IACrE,OAAO,aAAa,CAAC,cAAc,CACjC,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;QACd,IAAI,EAAE,mBAAmB;QACzB,YAAY,EAAE,iBAAiB;QAC/B,YAAY;KACb,CAAC,CACL,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
interface RowInsert {
|
|
2
|
+
type: 'i';
|
|
3
|
+
row: number;
|
|
4
|
+
asm: string;
|
|
5
|
+
ref: string;
|
|
6
|
+
start: number;
|
|
7
|
+
strand: number;
|
|
8
|
+
length: number;
|
|
9
|
+
}
|
|
10
|
+
interface RowSubstitute {
|
|
11
|
+
type: 's';
|
|
12
|
+
row: number;
|
|
13
|
+
asm: string;
|
|
14
|
+
ref: string;
|
|
15
|
+
start: number;
|
|
16
|
+
strand: number;
|
|
17
|
+
length: number;
|
|
18
|
+
}
|
|
19
|
+
interface RowDelete {
|
|
20
|
+
type: 'd';
|
|
21
|
+
row: number;
|
|
22
|
+
}
|
|
23
|
+
interface RowGap {
|
|
24
|
+
type: 'g';
|
|
25
|
+
row: number;
|
|
26
|
+
gapLen: number;
|
|
27
|
+
}
|
|
28
|
+
interface RowGapSubstring {
|
|
29
|
+
type: 'G';
|
|
30
|
+
row: number;
|
|
31
|
+
gapSubstring: string;
|
|
32
|
+
}
|
|
33
|
+
type RowInstruction = RowInsert | RowDelete | RowGap | RowGapSubstring | RowSubstitute;
|
|
34
|
+
export declare function parseRowInstructions(meta: string): RowInstruction[];
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export function parseRowInstructions(meta) {
|
|
2
|
+
const ret = meta.split(' ');
|
|
3
|
+
const rows = [];
|
|
4
|
+
for (let i = 0; i < ret.length;) {
|
|
5
|
+
const type = ret[i++];
|
|
6
|
+
if (type === 'i') {
|
|
7
|
+
const row = +ret[i++];
|
|
8
|
+
const [asm, ref] = ret[i++].split('.');
|
|
9
|
+
rows.push({
|
|
10
|
+
type,
|
|
11
|
+
row,
|
|
12
|
+
asm: asm,
|
|
13
|
+
ref: ref,
|
|
14
|
+
start: +ret[i++],
|
|
15
|
+
strand: ret[i++] === '-' ? -1 : 1,
|
|
16
|
+
length: +ret[i++],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (type === 's') {
|
|
20
|
+
const row = +ret[i++];
|
|
21
|
+
const [asm, ref] = ret[i++].split('.');
|
|
22
|
+
rows.push({
|
|
23
|
+
type,
|
|
24
|
+
row,
|
|
25
|
+
asm: asm,
|
|
26
|
+
ref: ref,
|
|
27
|
+
start: +ret[i++],
|
|
28
|
+
strand: ret[i++] === '-' ? -1 : 1,
|
|
29
|
+
length: +ret[i++],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else if (type === 'd') {
|
|
33
|
+
rows.push({
|
|
34
|
+
type,
|
|
35
|
+
row: +ret[i++],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else if (type === 'g') {
|
|
39
|
+
rows.push({
|
|
40
|
+
type,
|
|
41
|
+
row: +ret[i++],
|
|
42
|
+
gapLen: +ret[i++],
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else if (type === 'G') {
|
|
46
|
+
rows.push({
|
|
47
|
+
type,
|
|
48
|
+
row: +ret[i++],
|
|
49
|
+
gapSubstring: ret[i++],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return rows;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=rowInstructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowInstructions.js","sourceRoot":"","sources":["../../src/BgzipTaffyAdapter/rowInstructions.ts"],"names":[],"mappings":"AAuCA,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3B,MAAM,IAAI,GAAG,EAAsB,CAAA;IAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,GAAI,CAAC;QACjC,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAA;QACrB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAE,CAAA;YACtB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACvC,IAAI,CAAC,IAAI,CAAC;gBACR,IAAI;gBACJ,GAAG;gBACH,GAAG,EAAE,GAAI;gBACT,GAAG,EAAE,GAAI;gBACT,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAE;gBACjB,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjC,MAAM,EAAE,CAAC,GA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AAA;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import VirtualOffset from './virtualOffset';
|
|
2
|
+
export interface OrganismRecord {
|
|
3
|
+
chr: string;
|
|
4
|
+
start: number;
|
|
5
|
+
srcSize: number;
|
|
6
|
+
strand: number;
|
|
7
|
+
data: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ByteRange {
|
|
10
|
+
chrStart: number;
|
|
11
|
+
virtualOffset: VirtualOffset;
|
|
12
|
+
}
|
|
13
|
+
export type IndexData = Record<string, ByteRange[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/BgzipTaffyAdapter/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default class VirtualOffset {
|
|
2
|
+
blockPosition: number;
|
|
3
|
+
dataPosition: number;
|
|
4
|
+
constructor(blockPosition: number, dataPosition: number);
|
|
5
|
+
toString(): string;
|
|
6
|
+
compareTo(b: VirtualOffset): number;
|
|
7
|
+
}
|
|
8
|
+
export declare function fromBytes(bytes: Uint8Array, offset?: number): VirtualOffset;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default class VirtualOffset {
|
|
2
|
+
blockPosition;
|
|
3
|
+
dataPosition;
|
|
4
|
+
constructor(blockPosition, dataPosition) {
|
|
5
|
+
this.blockPosition = blockPosition; // < offset of the compressed data block
|
|
6
|
+
this.dataPosition = dataPosition; // < offset into the uncompressed data
|
|
7
|
+
}
|
|
8
|
+
toString() {
|
|
9
|
+
return `${this.blockPosition}:${this.dataPosition}`;
|
|
10
|
+
}
|
|
11
|
+
compareTo(b) {
|
|
12
|
+
return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function fromBytes(bytes, offset = 0) {
|
|
16
|
+
return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +
|
|
17
|
+
bytes[offset + 6] * 0x100000000 +
|
|
18
|
+
bytes[offset + 5] * 0x1000000 +
|
|
19
|
+
bytes[offset + 4] * 0x10000 +
|
|
20
|
+
bytes[offset + 3] * 0x100 +
|
|
21
|
+
bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=virtualOffset.js.map
|