jbrowse-plugin-mafviewer 1.1.2 → 1.1.4
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/BigMafAdapter/BigMafAdapter.d.ts +8 -0
- package/dist/BigMafAdapter/BigMafAdapter.js +15 -0
- package/dist/BigMafAdapter/BigMafAdapter.js.map +1 -1
- package/dist/LinearMafDisplay/components/Tree.js +5 -1
- package/dist/LinearMafDisplay/components/Tree.js.map +1 -1
- package/dist/LinearMafDisplay/stateModel.d.ts +2 -6
- package/dist/LinearMafDisplay/stateModel.js +6 -1
- package/dist/LinearMafDisplay/stateModel.js.map +1 -1
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js +2 -2
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js.map +1 -1
- package/dist/MafTabixAdapter/MafTabixAdapter.js +16 -3
- package/dist/MafTabixAdapter/MafTabixAdapter.js.map +1 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +8 -8
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +3 -3
- package/package.json +1 -1
- package/src/BigMafAdapter/BigMafAdapter.ts +20 -0
- package/src/LinearMafDisplay/components/Tree.tsx +9 -1
- package/src/LinearMafDisplay/stateModel.ts +3 -1
- package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +3 -1
- package/src/MafTabixAdapter/MafTabixAdapter.ts +14 -3
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
2
2
|
import { Feature, Region, SimpleFeature } from '@jbrowse/core/util'
|
|
3
|
+
import { openLocation } from '@jbrowse/core/util/io'
|
|
3
4
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs'
|
|
4
5
|
import { getSnapshot } from 'mobx-state-tree'
|
|
5
6
|
import { firstValueFrom, toArray } from 'rxjs'
|
|
6
7
|
|
|
8
|
+
import parseNewick from '../parseNewick'
|
|
9
|
+
import { normalize } from '../util'
|
|
10
|
+
|
|
7
11
|
interface OrganismRecord {
|
|
8
12
|
chr: string
|
|
9
13
|
start: number
|
|
@@ -105,5 +109,21 @@ export default class BigMafAdapter extends BaseFeatureDataAdapter {
|
|
|
105
109
|
observer.complete()
|
|
106
110
|
})
|
|
107
111
|
}
|
|
112
|
+
|
|
113
|
+
async getSamples(_query: Region) {
|
|
114
|
+
const nhLoc = this.getConf('nhLocation')
|
|
115
|
+
const nh =
|
|
116
|
+
nhLoc.uri === '/path/to/my.nh'
|
|
117
|
+
? undefined
|
|
118
|
+
: await openLocation(nhLoc).readFile('utf8')
|
|
119
|
+
|
|
120
|
+
// TODO: we may need to resolve the exact set of rows in the visible region
|
|
121
|
+
// here
|
|
122
|
+
return {
|
|
123
|
+
samples: normalize(this.getConf('samples')),
|
|
124
|
+
tree: nh ? parseNewick(nh) : undefined,
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
108
128
|
freeResources(): void {}
|
|
109
129
|
}
|
|
@@ -3,7 +3,15 @@ import React from 'react'
|
|
|
3
3
|
import { observer } from 'mobx-react'
|
|
4
4
|
|
|
5
5
|
const Tree = observer(function ({ model }: { model: any }) {
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
// this is needed for redrawing after zoom change, similar to react-msaview
|
|
8
|
+
// renderTreeCanvas
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
+
rowHeight: _rowHeight,
|
|
11
|
+
|
|
12
|
+
hierarchy,
|
|
13
|
+
showBranchLen,
|
|
14
|
+
} = model
|
|
7
15
|
|
|
8
16
|
return (
|
|
9
17
|
<>
|
|
@@ -213,8 +213,9 @@ export default function stateModelFactory(
|
|
|
213
213
|
}))
|
|
214
214
|
.views(self => {
|
|
215
215
|
const {
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
216
217
|
trackMenuItems: superTrackMenuItems,
|
|
217
|
-
|
|
218
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
218
219
|
renderProps: superRenderProps,
|
|
219
220
|
} = self
|
|
220
221
|
return {
|
|
@@ -316,6 +317,7 @@ export default function stateModelFactory(
|
|
|
316
317
|
},
|
|
317
318
|
}))
|
|
318
319
|
.actions(self => {
|
|
320
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
319
321
|
const { renderSvg: superRenderSvg } = self
|
|
320
322
|
return {
|
|
321
323
|
/**
|
|
@@ -71,6 +71,7 @@ export default function MultiMAFWidget({ model }: { model: AddTrackModel }) {
|
|
|
71
71
|
{['BigMafAdapter', 'MafTabixAdapter', 'BgzipTaffyAdapter'].map(
|
|
72
72
|
r => (
|
|
73
73
|
<FormControlLabel
|
|
74
|
+
key={r}
|
|
74
75
|
value={r}
|
|
75
76
|
control={<Radio />}
|
|
76
77
|
checked={fileTypeChoice === r}
|
|
@@ -101,9 +102,10 @@ export default function MultiMAFWidget({ model }: { model: AddTrackModel }) {
|
|
|
101
102
|
>
|
|
102
103
|
{['TBI', 'CSI'].map(r => (
|
|
103
104
|
<FormControlLabel
|
|
105
|
+
key={r}
|
|
104
106
|
value={r}
|
|
105
107
|
control={<Radio />}
|
|
106
|
-
checked={
|
|
108
|
+
checked={indexTypeChoice === r}
|
|
107
109
|
label={r}
|
|
108
110
|
/>
|
|
109
111
|
))}
|
|
@@ -67,9 +67,20 @@ export default class MafTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
67
67
|
|
|
68
68
|
for (const [j, elt] of data.entries()) {
|
|
69
69
|
const ad = elt.split(':')
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
70
|
+
const ag = ad[0]!.split('.')
|
|
71
|
+
const [n1, n2 = '', ...rest] = ag
|
|
72
|
+
let org
|
|
73
|
+
let last = ''
|
|
74
|
+
if (ag.length === 2) {
|
|
75
|
+
org = n1
|
|
76
|
+
last = n2!
|
|
77
|
+
} else if (!Number.isNaN(+n2!)) {
|
|
78
|
+
org = `${n1}.${n2}`
|
|
79
|
+
last = rest.join('.')
|
|
80
|
+
} else {
|
|
81
|
+
org = n1
|
|
82
|
+
last = [n2, ...rest].join('.')
|
|
83
|
+
}
|
|
73
84
|
if (org) {
|
|
74
85
|
alignments[org] = {
|
|
75
86
|
chr: last,
|