@jbrowse/plugin-legacy-jbrowse 2.6.1 → 2.6.2
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/GuessNCList/index.js +0 -1
- package/dist/JBrowse1Connection/configSchema.js +0 -1
- package/dist/JBrowse1Connection/index.js +0 -1
- package/dist/JBrowse1Connection/jb1ConfigLoad.js +0 -1
- package/dist/JBrowse1Connection/jb1ConfigParse.js +0 -1
- package/dist/JBrowse1Connection/jb1ToJb2.js +0 -1
- package/dist/JBrowse1Connection/model.js +0 -1
- package/dist/JBrowse1Connection/types.js +0 -1
- package/dist/JBrowse1Connection/util.js +0 -1
- package/dist/JBrowse1TextSearchAdapter/HttpMap.js +0 -1
- package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +0 -1
- package/dist/JBrowse1TextSearchAdapter/configSchema.js +0 -1
- package/dist/JBrowse1TextSearchAdapter/index.js +0 -1
- package/dist/NCListAdapter/NCListAdapter.js +0 -1
- package/dist/NCListAdapter/NCListFeature.js +0 -1
- package/dist/NCListAdapter/configSchema.js +0 -1
- package/dist/NCListAdapter/index.js +0 -1
- package/dist/index.js +0 -1
- package/esm/GuessNCList/index.js +0 -1
- package/esm/JBrowse1Connection/configSchema.js +0 -1
- package/esm/JBrowse1Connection/index.js +0 -1
- package/esm/JBrowse1Connection/jb1ConfigLoad.js +0 -1
- package/esm/JBrowse1Connection/jb1ConfigParse.js +0 -1
- package/esm/JBrowse1Connection/jb1ToJb2.js +0 -1
- package/esm/JBrowse1Connection/model.js +0 -1
- package/esm/JBrowse1Connection/types.js +0 -1
- package/esm/JBrowse1Connection/util.js +0 -1
- package/esm/JBrowse1TextSearchAdapter/HttpMap.js +0 -1
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +0 -1
- package/esm/JBrowse1TextSearchAdapter/configSchema.js +0 -1
- package/esm/JBrowse1TextSearchAdapter/index.js +0 -1
- package/esm/NCListAdapter/NCListAdapter.js +0 -1
- package/esm/NCListAdapter/NCListFeature.js +0 -1
- package/esm/NCListAdapter/configSchema.js +0 -1
- package/esm/NCListAdapter/index.js +0 -1
- package/esm/index.js +0 -1
- package/package.json +3 -4
- package/dist/GuessNCList/index.js.map +0 -1
- package/dist/JBrowse1Connection/configSchema.js.map +0 -1
- package/dist/JBrowse1Connection/index.js.map +0 -1
- package/dist/JBrowse1Connection/jb1ConfigLoad.js.map +0 -1
- package/dist/JBrowse1Connection/jb1ConfigParse.js.map +0 -1
- package/dist/JBrowse1Connection/jb1ToJb2.js.map +0 -1
- package/dist/JBrowse1Connection/model.js.map +0 -1
- package/dist/JBrowse1Connection/types.js.map +0 -1
- package/dist/JBrowse1Connection/util.js.map +0 -1
- package/dist/JBrowse1TextSearchAdapter/HttpMap.js.map +0 -1
- package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js.map +0 -1
- package/dist/JBrowse1TextSearchAdapter/configSchema.js.map +0 -1
- package/dist/JBrowse1TextSearchAdapter/index.js.map +0 -1
- package/dist/NCListAdapter/NCListAdapter.js.map +0 -1
- package/dist/NCListAdapter/NCListFeature.js.map +0 -1
- package/dist/NCListAdapter/configSchema.js.map +0 -1
- package/dist/NCListAdapter/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/esm/GuessNCList/index.js.map +0 -1
- package/esm/JBrowse1Connection/configSchema.js.map +0 -1
- package/esm/JBrowse1Connection/index.js.map +0 -1
- package/esm/JBrowse1Connection/jb1ConfigLoad.js.map +0 -1
- package/esm/JBrowse1Connection/jb1ConfigParse.js.map +0 -1
- package/esm/JBrowse1Connection/jb1ToJb2.js.map +0 -1
- package/esm/JBrowse1Connection/model.js.map +0 -1
- package/esm/JBrowse1Connection/types.js.map +0 -1
- package/esm/JBrowse1Connection/util.js.map +0 -1
- package/esm/JBrowse1TextSearchAdapter/HttpMap.js.map +0 -1
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js.map +0 -1
- package/esm/JBrowse1TextSearchAdapter/configSchema.js.map +0 -1
- package/esm/JBrowse1TextSearchAdapter/index.js.map +0 -1
- package/esm/NCListAdapter/NCListAdapter.js.map +0 -1
- package/esm/NCListAdapter/NCListFeature.js.map +0 -1
- package/esm/NCListAdapter/configSchema.js.map +0 -1
- package/esm/NCListAdapter/index.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/src/GuessNCList/index.ts +0 -27
- package/src/JBrowse1Connection/configSchema.ts +0 -42
- package/src/JBrowse1Connection/index.ts +0 -20
- package/src/JBrowse1Connection/jb1ConfigLoad.ts +0 -342
- package/src/JBrowse1Connection/jb1ConfigParse.ts +0 -423
- package/src/JBrowse1Connection/jb1ToJb2.ts +0 -529
- package/src/JBrowse1Connection/model.tsx +0 -69
- package/src/JBrowse1Connection/types.ts +0 -105
- package/src/JBrowse1Connection/util.ts +0 -149
- package/src/JBrowse1TextSearchAdapter/HttpMap.test.ts +0 -49
- package/src/JBrowse1TextSearchAdapter/HttpMap.ts +0 -100
- package/src/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.test.ts +0 -101
- package/src/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.ts +0 -100
- package/src/JBrowse1TextSearchAdapter/configSchema.ts +0 -44
- package/src/JBrowse1TextSearchAdapter/index.ts +0 -18
- package/src/NCListAdapter/NCListAdapter.test.ts +0 -58
- package/src/NCListAdapter/NCListAdapter.ts +0 -92
- package/src/NCListAdapter/NCListFeature.ts +0 -94
- package/src/NCListAdapter/__snapshots__/NCListAdapter.test.ts.snap +0 -30671
- package/src/NCListAdapter/configSchema.ts +0 -32
- package/src/NCListAdapter/index.ts +0 -16
- package/src/__snapshots__/index.test.ts.snap +0 -16
- package/src/index.test.ts +0 -35
- package/src/index.ts +0 -17
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import NCListStore from '@gmod/nclist'
|
|
2
|
-
import { Region } from '@jbrowse/core/util/types'
|
|
3
|
-
import {
|
|
4
|
-
BaseFeatureDataAdapter,
|
|
5
|
-
BaseOptions,
|
|
6
|
-
} from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
7
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature'
|
|
8
|
-
import { ObservableCreate } from '@jbrowse/core/util/rxjs'
|
|
9
|
-
import { checkAbortSignal } from '@jbrowse/core/util'
|
|
10
|
-
import { RemoteFile } from 'generic-filehandle'
|
|
11
|
-
import NCListFeature from './NCListFeature'
|
|
12
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
13
|
-
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'
|
|
14
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
15
|
-
|
|
16
|
-
export default class NCListAdapter extends BaseFeatureDataAdapter {
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
private nclist: any
|
|
19
|
-
|
|
20
|
-
private configRefNames?: string[]
|
|
21
|
-
|
|
22
|
-
constructor(
|
|
23
|
-
config: AnyConfigurationModel,
|
|
24
|
-
getSubAdapter?: getSubAdapterType,
|
|
25
|
-
pluginManager?: PluginManager,
|
|
26
|
-
) {
|
|
27
|
-
super(config, getSubAdapter, pluginManager)
|
|
28
|
-
const refNames = this.getConf('refNames')
|
|
29
|
-
const rootUrlTemplate = this.getConf('rootUrlTemplate')
|
|
30
|
-
this.configRefNames = refNames
|
|
31
|
-
|
|
32
|
-
this.nclist = new NCListStore({
|
|
33
|
-
baseUrl: '',
|
|
34
|
-
urlTemplate: rootUrlTemplate.uri,
|
|
35
|
-
readFile: (url: string) =>
|
|
36
|
-
new RemoteFile(
|
|
37
|
-
String(
|
|
38
|
-
rootUrlTemplate.baseUri
|
|
39
|
-
? new URL(url, rootUrlTemplate.baseUri).toString()
|
|
40
|
-
: url,
|
|
41
|
-
),
|
|
42
|
-
).readFile(),
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Fetch features for a certain region. Use getFeaturesInRegion() if you also
|
|
48
|
-
* want to verify that the store has features for the given reference sequence
|
|
49
|
-
* before fetching.
|
|
50
|
-
* @param region -
|
|
51
|
-
* @param opts - [signal] optional signalling object for aborting the fetch
|
|
52
|
-
* @returns Observable of Feature objects in the region
|
|
53
|
-
*/
|
|
54
|
-
getFeatures(region: Region, opts: BaseOptions = {}) {
|
|
55
|
-
return ObservableCreate<Feature>(async observer => {
|
|
56
|
-
const { signal } = opts
|
|
57
|
-
for await (const feature of this.nclist.getFeatures(region, opts)) {
|
|
58
|
-
checkAbortSignal(signal)
|
|
59
|
-
observer.next(this.wrapFeature(feature))
|
|
60
|
-
}
|
|
61
|
-
observer.complete()
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
|
-
wrapFeature(ncFeature: any): NCListFeature {
|
|
67
|
-
return new NCListFeature(
|
|
68
|
-
ncFeature,
|
|
69
|
-
undefined,
|
|
70
|
-
`${this.id}-${ncFeature.id()}`,
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async hasDataForRefName(refName: string) {
|
|
75
|
-
const root = await this.nclist.getDataRoot(refName)
|
|
76
|
-
return !!(root && root.stats && root.stats.featureCount)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* NCList is unable to get list of ref names so returns empty
|
|
81
|
-
*/
|
|
82
|
-
async getRefNames() {
|
|
83
|
-
return this.configRefNames || []
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* called to provide a hint that data tied to a certain region
|
|
88
|
-
* will not be needed for the foreseeable future and can be purged
|
|
89
|
-
* from caches, etc
|
|
90
|
-
*/
|
|
91
|
-
freeResources() {}
|
|
92
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Feature,
|
|
3
|
-
SimpleFeatureSerialized,
|
|
4
|
-
} from '@jbrowse/core/util/simpleFeature'
|
|
5
|
-
|
|
6
|
-
const jb2ToJb1 = { refName: 'seq_id' }
|
|
7
|
-
|
|
8
|
-
const jb1ToJb2 = { seq_id: 'refName' }
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* wrapper to adapt nclist features to act like jbrowse 2 features
|
|
12
|
-
*/
|
|
13
|
-
export default class NCListFeature implements Feature {
|
|
14
|
-
private parentHandle?: Feature
|
|
15
|
-
|
|
16
|
-
private uniqueId: string
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
constructor(private ncFeature: any, parent?: Feature, id?: string) {
|
|
20
|
-
this.uniqueId = id || ncFeature.id()
|
|
21
|
-
this.parentHandle = parent
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
set(): void {
|
|
25
|
-
throw new Error('not implemented')
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
jb2TagToJb1Tag(tag: string): string {
|
|
29
|
-
// @ts-expect-error
|
|
30
|
-
const mapped = jb2ToJb1[tag] || tag
|
|
31
|
-
return mapped.toLowerCase()
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
jb1TagToJb2Tag(tag: string): string {
|
|
35
|
-
const t = tag.toLowerCase()
|
|
36
|
-
// @ts-expect-error
|
|
37
|
-
return jb1ToJb2[t] || t
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
-
get(attrName: string): any {
|
|
42
|
-
const attr = this.ncFeature.get(this.jb2TagToJb1Tag(attrName))
|
|
43
|
-
if (attr && attrName === 'subfeatures') {
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
-
return attr.map((subfeature: any) => new NCListFeature(subfeature, this))
|
|
46
|
-
}
|
|
47
|
-
return attr
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get an array listing which data keys are present in this feature.
|
|
52
|
-
*/
|
|
53
|
-
tags(): string[] {
|
|
54
|
-
return this.ncFeature.tags().map((t: string) => this.jb1TagToJb2Tag(t))
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Get the unique ID of this feature.
|
|
59
|
-
*/
|
|
60
|
-
id(): string {
|
|
61
|
-
return this.uniqueId
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Get this feature's parent feature, or undefined if none.
|
|
66
|
-
*/
|
|
67
|
-
parent(): Feature | undefined {
|
|
68
|
-
return this.parentHandle
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Get an array of child features, or undefined if none.
|
|
73
|
-
*/
|
|
74
|
-
children(): Feature[] | undefined {
|
|
75
|
-
return this.get('subfeatures')
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
toJSON(): SimpleFeatureSerialized {
|
|
79
|
-
const data: SimpleFeatureSerialized = { uniqueId: this.id() }
|
|
80
|
-
this.ncFeature.tags().forEach((tag: string) => {
|
|
81
|
-
const mappedTag = this.jb1TagToJb2Tag(tag)
|
|
82
|
-
const value = this.ncFeature.get(tag)
|
|
83
|
-
if (mappedTag === 'subfeatures') {
|
|
84
|
-
data.subfeatures = (value || []).map((f: Feature) => {
|
|
85
|
-
// note: was new NCListFeature(f, `${this.id()}-${i}`, this).toJSON()
|
|
86
|
-
return new NCListFeature(f, this).toJSON()
|
|
87
|
-
})
|
|
88
|
-
} else {
|
|
89
|
-
data[mappedTag] = value
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
return data
|
|
93
|
-
}
|
|
94
|
-
}
|