jbrowse-plugin-mafviewer 1.0.8 → 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 +54 -20
- package/dist/{TaffyAdapter/TaffyAdapter.d.ts → BgzipTaffyAdapter/BgzipTaffyAdapter.d.ts} +11 -7
- package/dist/BgzipTaffyAdapter/BgzipTaffyAdapter.js +197 -0
- package/dist/BgzipTaffyAdapter/BgzipTaffyAdapter.js.map +1 -0
- package/dist/{TaffyAdapter → BgzipTaffyAdapter}/configSchema.d.ts +14 -1
- package/dist/{TaffyAdapter → BgzipTaffyAdapter}/configSchema.js +21 -6
- 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.js +1 -1
- package/dist/BigMafAdapter/BigMafAdapter.js.map +1 -1
- package/dist/BigMafAdapter/configSchema.d.ts +11 -0
- package/dist/BigMafAdapter/configSchema.js +11 -0
- package/dist/BigMafAdapter/configSchema.js.map +1 -1
- package/dist/BigMafAdapter/index.js +1 -1
- package/dist/BigMafAdapter/index.js.map +1 -1
- package/dist/LinearMafDisplay/components/ColorLegend.js +10 -6
- package/dist/LinearMafDisplay/components/ColorLegend.js.map +1 -1
- package/dist/LinearMafDisplay/components/ReactComponent.js +39 -4
- package/dist/LinearMafDisplay/components/ReactComponent.js.map +1 -1
- package/dist/LinearMafDisplay/components/SetRowHeight.js +7 -7
- package/dist/LinearMafDisplay/components/SetRowHeight.js.map +1 -1
- 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 +0 -1
- package/dist/LinearMafDisplay/components/YScaleBars.js +6 -27
- package/dist/LinearMafDisplay/components/YScaleBars.js.map +1 -1
- 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/index.js +1 -1
- package/dist/LinearMafDisplay/index.js.map +1 -1
- package/dist/LinearMafDisplay/renderSvg.js +1 -0
- package/dist/LinearMafDisplay/renderSvg.js.map +1 -1
- package/dist/LinearMafDisplay/stateModel.d.ts +76 -14
- package/dist/LinearMafDisplay/stateModel.js +118 -18
- package/dist/LinearMafDisplay/stateModel.js.map +1 -1
- 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 +3 -3
- package/dist/LinearMafRenderer/LinearMafRenderer.js +11 -9
- package/dist/LinearMafRenderer/LinearMafRenderer.js.map +1 -1
- package/dist/LinearMafRenderer/components/ReactComponent.js +1 -1
- package/dist/LinearMafRenderer/components/ReactComponent.js.map +1 -1
- package/dist/LinearMafRenderer/index.js +1 -1
- package/dist/LinearMafRenderer/index.js.map +1 -1
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js +42 -25
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js.map +1 -1
- 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 +8 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.js +18 -19
- package/dist/MafTabixAdapter/MafTabixAdapter.js.map +1 -1
- package/dist/MafTabixAdapter/configSchema.d.ts +17 -0
- package/dist/MafTabixAdapter/configSchema.js +17 -1
- package/dist/MafTabixAdapter/configSchema.js.map +1 -1
- package/dist/MafTabixAdapter/index.js +1 -1
- package/dist/MafTabixAdapter/index.js.map +1 -1
- package/dist/MafTrack/index.js.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +65 -4
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +4 -4
- 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 +18 -5
- package/src/BgzipTaffyAdapter/BgzipTaffyAdapter.ts +227 -0
- package/src/{TaffyAdapter → BgzipTaffyAdapter}/configSchema.ts +21 -6
- package/src/{TaffyAdapter → BgzipTaffyAdapter}/index.ts +5 -4
- 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 +11 -11
- package/src/BigMafAdapter/configSchema.ts +11 -0
- package/src/BigMafAdapter/index.ts +2 -1
- package/src/LinearMafDisplay/components/ColorLegend.tsx +36 -25
- package/src/LinearMafDisplay/components/ReactComponent.tsx +68 -3
- package/src/LinearMafDisplay/components/SetRowHeight.tsx +6 -5
- package/src/LinearMafDisplay/components/SvgWrapper.tsx +39 -0
- package/src/LinearMafDisplay/components/Tree.tsx +33 -0
- package/src/LinearMafDisplay/components/YScaleBars.tsx +8 -43
- 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 +139 -18
- package/src/LinearMafDisplay/types.ts +41 -0
- package/src/LinearMafRenderer/LinearMafRenderer.ts +13 -10
- package/src/LinearMafRenderer/components/ReactComponent.tsx +2 -1
- package/src/LinearMafRenderer/index.ts +2 -1
- package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +109 -65
- package/src/MafRPC/index.ts +39 -0
- package/src/MafTabixAdapter/MafTabixAdapter.ts +31 -25
- 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 -4
- package/src/parseNewick.ts +94 -0
- package/src/util.ts +11 -0
- package/LICENSE +0 -201
- package/dist/TaffyAdapter/TaffyAdapter.js +0 -89
- package/dist/TaffyAdapter/TaffyAdapter.js.map +0 -1
- package/dist/TaffyAdapter/configSchema.js.map +0 -1
- package/dist/TaffyAdapter/index.d.ts +0 -2
- package/dist/TaffyAdapter/index.js +0 -11
- package/dist/TaffyAdapter/index.js.map +0 -1
- package/src/TaffyAdapter/TaffyAdapter.ts +0 -112
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
|
|
@@ -153,30 +180,24 @@ the case
|
|
|
153
180
|
|
|
154
181
|
## Prepare data
|
|
155
182
|
|
|
156
|
-
This is the same as the jbrowse 1 mafviewer plugin (currently the similar to
|
|
157
|
-
the). This plugin supports two formats
|
|
158
|
-
|
|
159
183
|
1. BigMaf format, which can be created following UCSC guidelines
|
|
184
|
+
(https://genome.ucsc.edu/FAQ/FAQformat.html#format9.3)
|
|
160
185
|
|
|
161
186
|
2. MAF tabix based format, based on a custom BED created via conversion tools in
|
|
162
|
-
this repo
|
|
187
|
+
this repo (see maf2bed)
|
|
163
188
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
newer for it's BigBed support. The custom BED format only requires JBrowse
|
|
167
|
-
1.12.3 or newer, so therefore some slightly older JBrowse versions can support
|
|
168
|
-
it.
|
|
189
|
+
3. TAF format (new!). Currently only supports bgzip'd TAF. This is pioneered by
|
|
190
|
+
https://github.com/ComparativeGenomicsToolkit/taffy
|
|
169
191
|
|
|
170
|
-
_Note:
|
|
171
|
-
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
|
|
172
194
|
sequence identifiers._
|
|
173
195
|
|
|
174
|
-
### Preparing BigMaf
|
|
196
|
+
### Option 1. Preparing BigMaf
|
|
175
197
|
|
|
176
198
|
Follow instructions from https://genome.ucsc.edu/FAQ/FAQformat.html#format9.3
|
|
177
|
-
and set the storeType of your track as MAFViewer/Store/SeqFeature/BigMaf
|
|
178
199
|
|
|
179
|
-
### Preparing
|
|
200
|
+
### Option 2. Preparing MAF tabix
|
|
180
201
|
|
|
181
202
|
Start by converting the MAF into a pseudo-BED format using the maf2bed tool
|
|
182
203
|
|
|
@@ -191,7 +212,8 @@ The second argument to maf2bed is the genome version e.g. hg38 used for the main
|
|
|
191
212
|
species in the MAF (if your MAF comes from a pipeline like Ensembl or UCSC, the
|
|
192
213
|
identifiers in the MAF file will say something like hg38.chr1, therefore, the
|
|
193
214
|
argument to maf2bed should just be hg38 to remove hg38 part of the identifier.
|
|
194
|
-
|
|
215
|
+
|
|
216
|
+
If your MAF file does not include the species name as part of the identifier,
|
|
195
217
|
you should add the species into them the those scaffold/chromosome e.g. create
|
|
196
218
|
hg38.chr1 if it was just chr1 before)
|
|
197
219
|
|
|
@@ -200,7 +222,19 @@ If all is well, your BED file should have 6 columns, with
|
|
|
200
222
|
separated between each species by `;` and each field in the alignment is
|
|
201
223
|
separated by `:`.
|
|
202
224
|
|
|
203
|
-
|
|
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"
|
|
204
239
|
|
|
205
|
-
|
|
206
|
-
perl version of it in this repo
|
|
240
|
+
Note that the TAF support is beta, let me know if you run into any issues
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
import { Feature, Region } from '@jbrowse/core/util';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
fileOffst: number;
|
|
6
|
-
}
|
|
7
|
-
type IndexData = Record<string, ByteRange[]>;
|
|
8
|
-
export default class TaffyAdapter extends BaseFeatureDataAdapter {
|
|
3
|
+
import type { IndexData } from './types';
|
|
4
|
+
export default class BgzipTaffyAdapter extends BaseFeatureDataAdapter {
|
|
9
5
|
setupP?: Promise<IndexData>;
|
|
10
6
|
getRefNames(): Promise<string[]>;
|
|
11
7
|
setup(): Promise<IndexData>;
|
|
12
8
|
readTaiFile(): Promise<IndexData>;
|
|
13
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[]>;
|
|
14
19
|
freeResources(): void;
|
|
15
20
|
}
|
|
16
|
-
export {};
|
|
@@ -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;AAEvB,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,WAAW,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAYxD,MAAM,CAAC,OAA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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"}
|
|
@@ -10,8 +10,9 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
10
10
|
/**
|
|
11
11
|
* #slot
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
tafGzLocation: {
|
|
14
14
|
type: string;
|
|
15
|
+
description: string;
|
|
15
16
|
defaultValue: {
|
|
16
17
|
uri: string;
|
|
17
18
|
locationType: string;
|
|
@@ -22,6 +23,18 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
22
23
|
*/
|
|
23
24
|
taiLocation: {
|
|
24
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;
|
|
25
38
|
defaultValue: {
|
|
26
39
|
uri: string;
|
|
27
40
|
locationType: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
/**
|
|
3
|
-
* #config
|
|
4
|
-
* used to configure
|
|
3
|
+
* #config BgzipTaffyAdapter
|
|
4
|
+
* used to configure BgzipTaffy adapter
|
|
5
5
|
*/
|
|
6
6
|
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
7
|
-
const configSchema = ConfigurationSchema('
|
|
7
|
+
const configSchema = ConfigurationSchema('BgzipTaffyAdapter', {
|
|
8
8
|
/**
|
|
9
9
|
* #slot
|
|
10
10
|
*/
|
|
@@ -16,8 +16,9 @@ const configSchema = ConfigurationSchema('TaffyAdapter', {
|
|
|
16
16
|
/**
|
|
17
17
|
* #slot
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
tafGzLocation: {
|
|
20
20
|
type: 'fileLocation',
|
|
21
|
+
description: 'bgzip taffy file',
|
|
21
22
|
defaultValue: {
|
|
22
23
|
uri: '/path/to/my.taf',
|
|
23
24
|
locationType: 'UriLocation',
|
|
@@ -28,11 +29,25 @@ const configSchema = ConfigurationSchema('TaffyAdapter', {
|
|
|
28
29
|
*/
|
|
29
30
|
taiLocation: {
|
|
30
31
|
type: 'fileLocation',
|
|
32
|
+
description: 'taffy index',
|
|
31
33
|
defaultValue: {
|
|
32
|
-
uri: '/path/to/my.taf.tai',
|
|
34
|
+
uri: '/path/to/my.taf.gz.tai',
|
|
33
35
|
locationType: 'UriLocation',
|
|
34
36
|
},
|
|
35
37
|
},
|
|
36
|
-
|
|
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
|
+
});
|
|
37
52
|
export default configSchema;
|
|
38
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,MA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AE,CAAE;gBACjB,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAE;aACnB,CAAC,CAAA;QACJ,CAAC;aAAM,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC;gBACR,IAAI;gBACJ,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAE;aAChB,CAAC,CAAA;QACJ,CAAC;aAAM,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC;gBACR,IAAI;gBACJ,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAE;gBACf,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAE;aACnB,CAAC,CAAA;QACJ,CAAC;aAAM,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC;gBACR,IAAI;gBACJ,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAE;gBACf,YAAY,EAAE,GAAG,CAAC,CAAC,EAAE,CAAE;aACxB,CAAC,CAAA;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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtualOffset.js","sourceRoot":"","sources":["../../src/BgzipTaffyAdapter/virtualOffset.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,aAAa;IACzB,aAAa,CAAQ;IACrB,YAAY,CAAQ;IAC3B,YAAY,aAAqB,EAAE,YAAoB;QACrD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA,CAAC,wCAAwC;QAC3E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA,CAAC,sCAAsC;IACzE,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,YAAY,EAAE,CAAA;IACrD,CAAC;IAED,SAAS,CAAC,CAAgB;QACxB,OAAO,CACL,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY,CAC3E,CAAA;IACH,CAAC;CACF;AACD,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,MAAM,GAAG,CAAC;IACrD,OAAO,IAAI,aAAa,CACtB,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,aAAa;QAChC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,WAAW;QAChC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,SAAS;QAC9B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,OAAO;QAC5B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,KAAK;QAC1B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,EACpB,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAE,CAC3C,CAAA;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import { getSnapshot } from 'mobx-state-tree';
|
|
3
2
|
import { SimpleFeature } from '@jbrowse/core/util';
|
|
4
3
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
4
|
+
import { getSnapshot } from 'mobx-state-tree';
|
|
5
5
|
import { firstValueFrom, toArray } from 'rxjs';
|
|
6
6
|
export default class BigMafAdapter extends BaseFeatureDataAdapter {
|
|
7
7
|
setupP;
|