jbrowse-plugin-mafviewer 1.0.6 → 1.0.8
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 +17 -2
- 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 +21 -0
- package/dist/BigMafAdapter/configSchema.js +28 -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 +15 -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 +15 -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/YScaleBars.d.ts +9 -0
- package/dist/LinearMafDisplay/components/YScaleBars.js +41 -0
- package/dist/LinearMafDisplay/components/YScaleBars.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 +17 -0
- package/dist/LinearMafDisplay/renderSvg.js.map +1 -0
- package/dist/LinearMafDisplay/stateModel.d.ts +364 -0
- package/dist/LinearMafDisplay/stateModel.js +176 -0
- package/dist/LinearMafDisplay/stateModel.js.map +1 -0
- package/dist/LinearMafRenderer/LinearMafRenderer.d.ts +45 -0
- package/dist/LinearMafRenderer/LinearMafRenderer.js +181 -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 +111 -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/MafTabixAdapter/MafTabixAdapter.d.ts +17 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.js +96 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.js.map +1 -0
- package/dist/MafTabixAdapter/configSchema.d.ts +33 -0
- package/dist/MafTabixAdapter/configSchema.js +40 -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/TaffyAdapter/TaffyAdapter.d.ts +16 -0
- package/dist/TaffyAdapter/TaffyAdapter.js +89 -0
- package/dist/TaffyAdapter/TaffyAdapter.js.map +1 -0
- package/dist/TaffyAdapter/configSchema.d.ts +31 -0
- package/dist/TaffyAdapter/configSchema.js +38 -0
- package/dist/TaffyAdapter/configSchema.js.map +1 -0
- package/dist/TaffyAdapter/index.d.ts +2 -0
- package/dist/TaffyAdapter/index.js +11 -0
- package/dist/TaffyAdapter/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +4 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +7 -1
- package/package.json +21 -38
- package/src/BigMafAdapter/BigMafAdapter.ts +1 -2
- package/src/LinearMafDisplay/components/ColorLegend.tsx +2 -2
- package/src/LinearMafDisplay/components/SetRowHeight.tsx +9 -3
- package/src/LinearMafDisplay/components/YScaleBars.tsx +11 -3
- package/src/LinearMafDisplay/stateModel.ts +32 -2
- package/src/LinearMafRenderer/LinearMafRenderer.ts +38 -34
- package/src/LinearMafRenderer/util.ts +20 -0
- package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +60 -22
- package/src/MafTabixAdapter/MafTabixAdapter.ts +2 -2
- package/src/TaffyAdapter/TaffyAdapter.ts +112 -0
- package/src/TaffyAdapter/configSchema.ts +44 -0
- package/src/TaffyAdapter/index.ts +15 -0
- package/src/index.ts +2 -0
- package/dist/jbrowse-plugin-mafviewer.umd.development.js +0 -1439
- package/dist/jbrowse-plugin-mafviewer.umd.development.js.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
2
|
+
import { getSnapshot } from 'mobx-state-tree'
|
|
3
|
+
import { Feature, Region, SimpleFeature } from '@jbrowse/core/util'
|
|
4
|
+
import { ObservableCreate } from '@jbrowse/core/util/rxjs'
|
|
5
|
+
import { openLocation } from '@jbrowse/core/util/io'
|
|
6
|
+
|
|
7
|
+
interface OrganismRecord {
|
|
8
|
+
chr: string
|
|
9
|
+
start: number
|
|
10
|
+
srcSize: number
|
|
11
|
+
strand: number
|
|
12
|
+
unknown: number
|
|
13
|
+
data: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ByteRange {
|
|
17
|
+
chrStart: number
|
|
18
|
+
fileOffst: number
|
|
19
|
+
}
|
|
20
|
+
type IndexData = Record<string, ByteRange[]>
|
|
21
|
+
|
|
22
|
+
export default class TaffyAdapter extends BaseFeatureDataAdapter {
|
|
23
|
+
public setupP?: Promise<IndexData>
|
|
24
|
+
|
|
25
|
+
async getRefNames() {
|
|
26
|
+
const data = await this.setup()
|
|
27
|
+
return Object.keys(data)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setup() {
|
|
31
|
+
if (!this.setupP) {
|
|
32
|
+
this.setupP = this.readTaiFile().catch((e: unknown) => {
|
|
33
|
+
this.setupP = undefined
|
|
34
|
+
throw e
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
return this.setupP
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async readTaiFile() {
|
|
41
|
+
const text = await openLocation(this.getConf('taiLocation')).readFile(
|
|
42
|
+
'utf8',
|
|
43
|
+
)
|
|
44
|
+
const entries = {} as IndexData
|
|
45
|
+
let lastChr = ''
|
|
46
|
+
for (const line of text.split('\n').filter(line => line.trim())) {
|
|
47
|
+
const [chr, chrStart, fileOffset] = line.split('\t')
|
|
48
|
+
const ref = chr === '*' ? lastChr : chr
|
|
49
|
+
const r2 = ref.split('.').at(-1)!
|
|
50
|
+
|
|
51
|
+
if (!entries[r2]) {
|
|
52
|
+
entries[r2] = []
|
|
53
|
+
}
|
|
54
|
+
entries[r2].push({
|
|
55
|
+
chrStart: +chrStart,
|
|
56
|
+
fileOffst: +fileOffset,
|
|
57
|
+
})
|
|
58
|
+
lastChr = ref
|
|
59
|
+
}
|
|
60
|
+
return entries
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getFeatures(query: Region) {
|
|
64
|
+
return ObservableCreate<Feature>(async observer => {
|
|
65
|
+
try {
|
|
66
|
+
// const { tafLocation } = getSnapshot(this.config)
|
|
67
|
+
// const byteRanges = await this.setup()
|
|
68
|
+
//
|
|
69
|
+
// for (const range of byteRanges[query.refName] || []) {
|
|
70
|
+
// const response = await fetch(tafLocation, {
|
|
71
|
+
// headers: {
|
|
72
|
+
// Range: `bytes=${range.start}-${range.start + range.length - 1}`,
|
|
73
|
+
// },
|
|
74
|
+
// })
|
|
75
|
+
//
|
|
76
|
+
// const text = await response.text()
|
|
77
|
+
// const lines = text.split('\n').filter(line => line.trim())
|
|
78
|
+
//
|
|
79
|
+
// for (const line of lines) {
|
|
80
|
+
// const [chr, start, srcSize, strand, unknown, data] =
|
|
81
|
+
// line.split('\t')
|
|
82
|
+
//
|
|
83
|
+
// // Only emit features that overlap with query region
|
|
84
|
+
// const featureStart = parseInt(start, 10)
|
|
85
|
+
// const featureEnd = featureStart + parseInt(srcSize, 10)
|
|
86
|
+
//
|
|
87
|
+
// if (
|
|
88
|
+
// chr === query.refName &&
|
|
89
|
+
// featureEnd >= query.start &&
|
|
90
|
+
// featureStart <= query.end
|
|
91
|
+
// ) {
|
|
92
|
+
// observer.next(
|
|
93
|
+
// new SimpleFeature({
|
|
94
|
+
// uniqueId: `${chr}-${start}-${data}`,
|
|
95
|
+
// refName: chr,
|
|
96
|
+
// start: featureStart,
|
|
97
|
+
// end: featureEnd,
|
|
98
|
+
// strand: parseInt(strand, 10),
|
|
99
|
+
// data: data,
|
|
100
|
+
// }),
|
|
101
|
+
// )
|
|
102
|
+
// }
|
|
103
|
+
// }
|
|
104
|
+
// }
|
|
105
|
+
observer.complete()
|
|
106
|
+
} catch (e) {
|
|
107
|
+
observer.error(e)
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
freeResources(): void {}
|
|
112
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* #config TaffyAdapter
|
|
5
|
+
* used to configure Taffy adapter
|
|
6
|
+
*/
|
|
7
|
+
function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
8
|
+
|
|
9
|
+
const configSchema = ConfigurationSchema(
|
|
10
|
+
'TaffyAdapter',
|
|
11
|
+
{
|
|
12
|
+
/**
|
|
13
|
+
* #slot
|
|
14
|
+
*/
|
|
15
|
+
samples: {
|
|
16
|
+
type: 'frozen',
|
|
17
|
+
description: 'string[] or {id:string,label:string,color?:string}[]',
|
|
18
|
+
defaultValue: [],
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* #slot
|
|
22
|
+
*/
|
|
23
|
+
tafLocation: {
|
|
24
|
+
type: 'fileLocation',
|
|
25
|
+
defaultValue: {
|
|
26
|
+
uri: '/path/to/my.taf',
|
|
27
|
+
locationType: 'UriLocation',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* #slot
|
|
32
|
+
*/
|
|
33
|
+
taiLocation: {
|
|
34
|
+
type: 'fileLocation',
|
|
35
|
+
defaultValue: {
|
|
36
|
+
uri: '/path/to/my.taf.tai',
|
|
37
|
+
locationType: 'UriLocation',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{ explicitlyTyped: true },
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
export default configSchema
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
2
|
+
import { AdapterType } from '@jbrowse/core/pluggableElementTypes'
|
|
3
|
+
import configSchema from './configSchema'
|
|
4
|
+
import TaffyAdapter from './TaffyAdapter'
|
|
5
|
+
|
|
6
|
+
export default function TaffyAdapterF(pluginManager: PluginManager) {
|
|
7
|
+
return pluginManager.addAdapterType(
|
|
8
|
+
() =>
|
|
9
|
+
new AdapterType({
|
|
10
|
+
name: 'TaffyAdapter',
|
|
11
|
+
AdapterClass: TaffyAdapter,
|
|
12
|
+
configSchema,
|
|
13
|
+
}),
|
|
14
|
+
)
|
|
15
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import MafTrackF from './MafTrack'
|
|
|
7
7
|
import LinearMafDisplayF from './LinearMafDisplay'
|
|
8
8
|
import LinearMafRendererF from './LinearMafRenderer'
|
|
9
9
|
import MafTabixAdapterF from './MafTabixAdapter'
|
|
10
|
+
import TaffyAdapterF from './TaffyAdapter'
|
|
10
11
|
import MafAddTrackWorkflowF from './MafAddTrackWorkflow'
|
|
11
12
|
|
|
12
13
|
export default class MafViewerPlugin extends Plugin {
|
|
@@ -19,6 +20,7 @@ export default class MafViewerPlugin extends Plugin {
|
|
|
19
20
|
LinearMafDisplayF(pluginManager)
|
|
20
21
|
LinearMafRendererF(pluginManager)
|
|
21
22
|
MafTabixAdapterF(pluginManager)
|
|
23
|
+
TaffyAdapterF(pluginManager)
|
|
22
24
|
MafAddTrackWorkflowF(pluginManager)
|
|
23
25
|
}
|
|
24
26
|
|