jbrowse-plugin-mafviewer 1.1.4 → 1.2.0
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.d.ts +5 -4
- package/dist/BgzipTaffyAdapter/BgzipTaffyAdapter.js +103 -82
- package/dist/BgzipTaffyAdapter/BgzipTaffyAdapter.js.map +1 -1
- package/dist/BgzipTaffyAdapter/util.d.ts +1 -0
- package/dist/BgzipTaffyAdapter/util.js +22 -0
- package/dist/BgzipTaffyAdapter/util.js.map +1 -0
- package/dist/BigMafAdapter/BigMafAdapter.d.ts +3 -2
- package/dist/BigMafAdapter/BigMafAdapter.js +4 -3
- package/dist/BigMafAdapter/BigMafAdapter.js.map +1 -1
- package/dist/LinearMafDisplay/components/ColorLegend.js +1 -1
- package/dist/LinearMafDisplay/components/ColorLegend.js.map +1 -1
- package/dist/LinearMafDisplay/components/ReactComponent.js +1 -1
- package/dist/LinearMafDisplay/components/ReactComponent.js.map +1 -1
- package/dist/LinearMafDisplay/components/SvgWrapper.js +2 -2
- package/dist/LinearMafDisplay/components/SvgWrapper.js.map +1 -1
- package/dist/LinearMafDisplay/components/YScaleBars.js +2 -2
- package/dist/LinearMafDisplay/components/YScaleBars.js.map +1 -1
- package/dist/LinearMafDisplay/renderSvg.d.ts +2 -2
- package/dist/LinearMafDisplay/renderSvg.js +0 -1
- package/dist/LinearMafDisplay/renderSvg.js.map +1 -1
- package/dist/LinearMafDisplay/stateModel.d.ts +19 -17
- package/dist/LinearMafDisplay/stateModel.js +17 -10
- package/dist/LinearMafDisplay/stateModel.js.map +1 -1
- package/dist/LinearMafRenderer/LinearMafRenderer.d.ts +8 -4
- package/dist/LinearMafRenderer/LinearMafRenderer.js +14 -148
- package/dist/LinearMafRenderer/LinearMafRenderer.js.map +1 -1
- package/dist/LinearMafRenderer/configSchema.d.ts +6 -1
- package/dist/LinearMafRenderer/configSchema.js +6 -1
- package/dist/LinearMafRenderer/configSchema.js.map +1 -1
- package/dist/LinearMafRenderer/makeImageData.d.ts +20 -0
- package/dist/LinearMafRenderer/makeImageData.js +144 -0
- package/dist/LinearMafRenderer/makeImageData.js.map +1 -0
- package/dist/LinearMafRenderer/util.d.ts +6 -1
- package/dist/LinearMafRenderer/util.js +17 -0
- package/dist/LinearMafRenderer/util.js.map +1 -1
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.d.ts +1 -1
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js.map +1 -1
- package/dist/MafTabixAdapter/MafTabixAdapter.d.ts +9 -6
- package/dist/MafTabixAdapter/MafTabixAdapter.js +74 -56
- package/dist/MafTabixAdapter/MafTabixAdapter.js.map +1 -1
- package/dist/MafTabixAdapter/configSchema.d.ts +7 -0
- package/dist/MafTabixAdapter/configSchema.js +7 -0
- package/dist/MafTabixAdapter/configSchema.js.map +1 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +7 -8
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +4 -4
- package/package.json +2 -2
- package/src/BgzipTaffyAdapter/BgzipTaffyAdapter.ts +123 -86
- package/src/BgzipTaffyAdapter/util.ts +25 -0
- package/src/BigMafAdapter/BigMafAdapter.ts +10 -4
- package/src/LinearMafDisplay/components/ColorLegend.tsx +1 -2
- package/src/LinearMafDisplay/components/ReactComponent.tsx +1 -1
- package/src/LinearMafDisplay/components/SvgWrapper.tsx +2 -2
- package/src/LinearMafDisplay/components/YScaleBars.tsx +3 -2
- package/src/LinearMafDisplay/renderSvg.tsx +5 -5
- package/src/LinearMafDisplay/stateModel.ts +30 -24
- package/src/LinearMafRenderer/LinearMafRenderer.ts +21 -176
- package/src/LinearMafRenderer/configSchema.ts +6 -1
- package/src/LinearMafRenderer/makeImageData.ts +211 -0
- package/src/LinearMafRenderer/util.ts +28 -1
- package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +2 -1
- package/src/MafTabixAdapter/MafTabixAdapter.ts +92 -55
- package/src/MafTabixAdapter/configSchema.ts +7 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
BaseFeatureDataAdapter,
|
|
3
|
+
BaseOptions,
|
|
4
|
+
} from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
5
|
+
import {
|
|
6
|
+
Feature,
|
|
7
|
+
Region,
|
|
8
|
+
SimpleFeature,
|
|
9
|
+
updateStatus,
|
|
10
|
+
} from '@jbrowse/core/util'
|
|
3
11
|
import { openLocation } from '@jbrowse/core/util/io'
|
|
4
12
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs'
|
|
5
13
|
import { getSnapshot } from 'mobx-state-tree'
|
|
@@ -20,7 +28,7 @@ interface OrganismRecord {
|
|
|
20
28
|
export default class MafTabixAdapter extends BaseFeatureDataAdapter {
|
|
21
29
|
public setupP?: Promise<{ adapter: BaseFeatureDataAdapter }>
|
|
22
30
|
|
|
23
|
-
async
|
|
31
|
+
async setupPre() {
|
|
24
32
|
const config = this.config
|
|
25
33
|
if (!this.getSubAdapter) {
|
|
26
34
|
throw new Error('no getSubAdapter available')
|
|
@@ -33,9 +41,9 @@ export default class MafTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
33
41
|
adapter: adapter.dataAdapter as BaseFeatureDataAdapter,
|
|
34
42
|
}
|
|
35
43
|
}
|
|
36
|
-
async
|
|
44
|
+
async setupPre2() {
|
|
37
45
|
if (!this.setupP) {
|
|
38
|
-
this.setupP = this.
|
|
46
|
+
this.setupP = this.setupPre().catch((e: unknown) => {
|
|
39
47
|
this.setupP = undefined
|
|
40
48
|
throw e
|
|
41
49
|
})
|
|
@@ -43,71 +51,100 @@ export default class MafTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
43
51
|
return this.setupP
|
|
44
52
|
}
|
|
45
53
|
|
|
46
|
-
async
|
|
47
|
-
const {
|
|
54
|
+
async setup(opts?: BaseOptions) {
|
|
55
|
+
const { statusCallback = () => {} } = opts || {}
|
|
56
|
+
return updateStatus('Downloading index', statusCallback, () =>
|
|
57
|
+
this.setupPre2(),
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async getRefNames(opts?: BaseOptions) {
|
|
62
|
+
const { adapter } = await this.setup(opts)
|
|
48
63
|
return adapter.getRefNames()
|
|
49
64
|
}
|
|
50
65
|
|
|
51
|
-
async getHeader() {
|
|
52
|
-
const { adapter } = await this.setup()
|
|
66
|
+
async getHeader(opts?: BaseOptions) {
|
|
67
|
+
const { adapter } = await this.setup(opts)
|
|
53
68
|
return adapter.getHeader()
|
|
54
69
|
}
|
|
55
70
|
|
|
56
|
-
getFeatures(query: Region) {
|
|
71
|
+
getFeatures(query: Region, opts?: BaseOptions) {
|
|
72
|
+
const { statusCallback = () => {} } = opts || {}
|
|
57
73
|
return ObservableCreate<Feature>(async observer => {
|
|
58
|
-
const { adapter } = await this.setup()
|
|
59
|
-
const features = await
|
|
60
|
-
|
|
74
|
+
const { adapter } = await this.setup(opts)
|
|
75
|
+
const features = await updateStatus(
|
|
76
|
+
'Downloading alignments',
|
|
77
|
+
statusCallback,
|
|
78
|
+
() => firstValueFrom(adapter.getFeatures(query).pipe(toArray())),
|
|
61
79
|
)
|
|
62
80
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
const
|
|
81
|
+
await updateStatus('Processing alignments', statusCallback, () => {
|
|
82
|
+
let firstAssemblyNameFound = ''
|
|
83
|
+
const refAssemblyName = this.getConf('refAssemblyName')
|
|
84
|
+
for (const feature of features) {
|
|
85
|
+
const data = (feature.get('field5') as string).split(',')
|
|
86
|
+
const alignments = {} as Record<string, OrganismRecord>
|
|
67
87
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
for (let j = 0; j < data.length; j++) {
|
|
89
|
+
const elt = data[j]!
|
|
90
|
+
const seq = elt.split(':')[5]!
|
|
91
|
+
const ad = elt.split(':')
|
|
92
|
+
const ag = ad[0]!.split('.')
|
|
93
|
+
const [n1, n2 = '', ...rest] = ag
|
|
94
|
+
let assemblyName
|
|
95
|
+
let last = ''
|
|
96
|
+
if (ag.length === 2) {
|
|
97
|
+
assemblyName = n1
|
|
98
|
+
last = n2!
|
|
99
|
+
} else if (!Number.isNaN(+n2)) {
|
|
100
|
+
assemblyName = `${n1}.${n2}`
|
|
101
|
+
last = rest.join('.')
|
|
102
|
+
} else {
|
|
103
|
+
assemblyName = n1
|
|
104
|
+
last = [n2, ...rest].join('.')
|
|
105
|
+
}
|
|
106
|
+
if (assemblyName) {
|
|
107
|
+
firstAssemblyNameFound = firstAssemblyNameFound || assemblyName
|
|
108
|
+
alignments[assemblyName] = {
|
|
109
|
+
chr: last,
|
|
110
|
+
start: +ad[1]!,
|
|
111
|
+
srcSize: +ad[2]!,
|
|
112
|
+
strand: ad[3] === '-' ? -1 : 1,
|
|
113
|
+
unknown: +ad[4]!,
|
|
114
|
+
data: seq,
|
|
115
|
+
}
|
|
92
116
|
}
|
|
93
117
|
}
|
|
94
|
-
}
|
|
95
118
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
id: feature.id(),
|
|
99
|
-
data: {
|
|
100
|
-
start: feature.get('start'),
|
|
101
|
-
end: feature.get('end'),
|
|
102
|
-
refName: feature.get('refName'),
|
|
103
|
-
name: feature.get('name'),
|
|
104
|
-
score: feature.get('score'),
|
|
119
|
+
console.log(
|
|
120
|
+
{
|
|
105
121
|
alignments,
|
|
106
|
-
|
|
122
|
+
firstAssemblyNameFound,
|
|
123
|
+
refAssemblyName,
|
|
124
|
+
q: query.assemblyName,
|
|
107
125
|
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
alignments[refAssemblyName],
|
|
127
|
+
alignments[query.assemblyName],
|
|
128
|
+
alignments[firstAssemblyNameFound],
|
|
129
|
+
)
|
|
130
|
+
observer.next(
|
|
131
|
+
new SimpleFeature({
|
|
132
|
+
id: feature.id(),
|
|
133
|
+
data: {
|
|
134
|
+
start: feature.get('start'),
|
|
135
|
+
end: feature.get('end'),
|
|
136
|
+
refName: feature.get('refName'),
|
|
137
|
+
name: feature.get('name'),
|
|
138
|
+
score: feature.get('score'),
|
|
139
|
+
alignments,
|
|
140
|
+
seq:
|
|
141
|
+
alignments[refAssemblyName || query.assemblyName]?.data ||
|
|
142
|
+
alignments[firstAssemblyNameFound]?.data,
|
|
143
|
+
},
|
|
144
|
+
}),
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
})
|
|
111
148
|
observer.complete()
|
|
112
149
|
})
|
|
113
150
|
}
|
|
@@ -26,6 +26,13 @@ const configSchema = ConfigurationSchema(
|
|
|
26
26
|
locationType: 'UriLocation',
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
|
+
/**
|
|
30
|
+
* #slot
|
|
31
|
+
*/
|
|
32
|
+
refAssemblyName: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
defaultValue: '',
|
|
35
|
+
},
|
|
29
36
|
index: ConfigurationSchema('Index', {
|
|
30
37
|
/**
|
|
31
38
|
* #slot index.location
|