@jbrowse/plugin-comparative-adapters 2.6.1 → 2.6.3
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/ChainAdapter/ChainAdapter.js +0 -1
- package/dist/ChainAdapter/configSchema.js +0 -1
- package/dist/ChainAdapter/index.js +0 -1
- package/dist/ChainAdapter/util.js +0 -1
- package/dist/DeltaAdapter/DeltaAdapter.js +0 -1
- package/dist/DeltaAdapter/configSchema.js +0 -1
- package/dist/DeltaAdapter/index.js +0 -1
- package/dist/DeltaAdapter/util.js +0 -1
- package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +0 -1
- package/dist/MCScanAnchorsAdapter/configSchema.js +0 -1
- package/dist/MCScanAnchorsAdapter/index.js +0 -1
- package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +0 -1
- package/dist/MCScanSimpleAnchorsAdapter/configSchema.js +0 -1
- package/dist/MCScanSimpleAnchorsAdapter/index.js +0 -1
- package/dist/MashMapAdapter/MashMapAdapter.js +0 -1
- package/dist/MashMapAdapter/configSchema.js +0 -1
- package/dist/MashMapAdapter/index.js +0 -1
- package/dist/PAFAdapter/PAFAdapter.js +0 -1
- package/dist/PAFAdapter/SyntenyFeature.js +0 -1
- package/dist/PAFAdapter/configSchema.js +0 -1
- package/dist/PAFAdapter/index.js +0 -1
- package/dist/PAFAdapter/util.js +0 -1
- package/dist/index.js +0 -1
- package/dist/util.js +0 -1
- package/esm/ChainAdapter/ChainAdapter.js +0 -1
- package/esm/ChainAdapter/configSchema.js +0 -1
- package/esm/ChainAdapter/index.js +0 -1
- package/esm/ChainAdapter/util.js +0 -1
- package/esm/DeltaAdapter/DeltaAdapter.js +0 -1
- package/esm/DeltaAdapter/configSchema.js +0 -1
- package/esm/DeltaAdapter/index.js +0 -1
- package/esm/DeltaAdapter/util.js +0 -1
- package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +0 -1
- package/esm/MCScanAnchorsAdapter/configSchema.js +0 -1
- package/esm/MCScanAnchorsAdapter/index.js +0 -1
- package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +0 -1
- package/esm/MCScanSimpleAnchorsAdapter/configSchema.js +0 -1
- package/esm/MCScanSimpleAnchorsAdapter/index.js +0 -1
- package/esm/MashMapAdapter/MashMapAdapter.js +0 -1
- package/esm/MashMapAdapter/configSchema.js +0 -1
- package/esm/MashMapAdapter/index.js +0 -1
- package/esm/PAFAdapter/PAFAdapter.js +0 -1
- package/esm/PAFAdapter/SyntenyFeature.js +0 -1
- package/esm/PAFAdapter/configSchema.js +0 -1
- package/esm/PAFAdapter/index.js +0 -1
- package/esm/PAFAdapter/util.js +0 -1
- package/esm/index.js +0 -1
- package/esm/util.js +0 -1
- package/package.json +3 -4
- package/dist/ChainAdapter/ChainAdapter.js.map +0 -1
- package/dist/ChainAdapter/configSchema.js.map +0 -1
- package/dist/ChainAdapter/index.js.map +0 -1
- package/dist/ChainAdapter/util.js.map +0 -1
- package/dist/DeltaAdapter/DeltaAdapter.js.map +0 -1
- package/dist/DeltaAdapter/configSchema.js.map +0 -1
- package/dist/DeltaAdapter/index.js.map +0 -1
- package/dist/DeltaAdapter/util.js.map +0 -1
- package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js.map +0 -1
- package/dist/MCScanAnchorsAdapter/configSchema.js.map +0 -1
- package/dist/MCScanAnchorsAdapter/index.js.map +0 -1
- package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js.map +0 -1
- package/dist/MCScanSimpleAnchorsAdapter/configSchema.js.map +0 -1
- package/dist/MCScanSimpleAnchorsAdapter/index.js.map +0 -1
- package/dist/MashMapAdapter/MashMapAdapter.js.map +0 -1
- package/dist/MashMapAdapter/configSchema.js.map +0 -1
- package/dist/MashMapAdapter/index.js.map +0 -1
- package/dist/PAFAdapter/PAFAdapter.js.map +0 -1
- package/dist/PAFAdapter/SyntenyFeature.js.map +0 -1
- package/dist/PAFAdapter/configSchema.js.map +0 -1
- package/dist/PAFAdapter/index.js.map +0 -1
- package/dist/PAFAdapter/util.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/util.js.map +0 -1
- package/esm/ChainAdapter/ChainAdapter.js.map +0 -1
- package/esm/ChainAdapter/configSchema.js.map +0 -1
- package/esm/ChainAdapter/index.js.map +0 -1
- package/esm/ChainAdapter/util.js.map +0 -1
- package/esm/DeltaAdapter/DeltaAdapter.js.map +0 -1
- package/esm/DeltaAdapter/configSchema.js.map +0 -1
- package/esm/DeltaAdapter/index.js.map +0 -1
- package/esm/DeltaAdapter/util.js.map +0 -1
- package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js.map +0 -1
- package/esm/MCScanAnchorsAdapter/configSchema.js.map +0 -1
- package/esm/MCScanAnchorsAdapter/index.js.map +0 -1
- package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js.map +0 -1
- package/esm/MCScanSimpleAnchorsAdapter/configSchema.js.map +0 -1
- package/esm/MCScanSimpleAnchorsAdapter/index.js.map +0 -1
- package/esm/MashMapAdapter/MashMapAdapter.js.map +0 -1
- package/esm/MashMapAdapter/configSchema.js.map +0 -1
- package/esm/MashMapAdapter/index.js.map +0 -1
- package/esm/PAFAdapter/PAFAdapter.js.map +0 -1
- package/esm/PAFAdapter/SyntenyFeature.js.map +0 -1
- package/esm/PAFAdapter/configSchema.js.map +0 -1
- package/esm/PAFAdapter/index.js.map +0 -1
- package/esm/PAFAdapter/util.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/util.js.map +0 -1
- package/src/ChainAdapter/ChainAdapter.ts +0 -18
- package/src/ChainAdapter/configSchema.ts +0 -50
- package/src/ChainAdapter/index.ts +0 -18
- package/src/ChainAdapter/util.ts +0 -170
- package/src/DeltaAdapter/DeltaAdapter.ts +0 -18
- package/src/DeltaAdapter/configSchema.ts +0 -50
- package/src/DeltaAdapter/index.ts +0 -18
- package/src/DeltaAdapter/util.ts +0 -149
- package/src/MCScanAnchorsAdapter/MCScanAnchorsAdapter.test.ts +0 -45
- package/src/MCScanAnchorsAdapter/MCScanAnchorsAdapter.ts +0 -134
- package/src/MCScanAnchorsAdapter/configSchema.ts +0 -52
- package/src/MCScanAnchorsAdapter/index.ts +0 -20
- package/src/MCScanAnchorsAdapter/test_data/grape.bed.gz +0 -0
- package/src/MCScanAnchorsAdapter/test_data/grape.peach.anchors.gz +0 -0
- package/src/MCScanAnchorsAdapter/test_data/peach.bed.gz +0 -0
- package/src/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.ts +0 -157
- package/src/MCScanSimpleAnchorsAdapter/configSchema.ts +0 -52
- package/src/MCScanSimpleAnchorsAdapter/index.ts +0 -19
- package/src/MashMapAdapter/MashMapAdapter.ts +0 -40
- package/src/MashMapAdapter/configSchema.ts +0 -51
- package/src/MashMapAdapter/index.ts +0 -18
- package/src/PAFAdapter/PAFAdapter.test.ts +0 -37
- package/src/PAFAdapter/PAFAdapter.ts +0 -181
- package/src/PAFAdapter/SyntenyFeature.ts +0 -15
- package/src/PAFAdapter/configSchema.ts +0 -50
- package/src/PAFAdapter/index.ts +0 -18
- package/src/PAFAdapter/test_data/grape.peach.anchors +0 -14966
- package/src/PAFAdapter/test_data/peach_grape.paf +0 -30
- package/src/PAFAdapter/util.test.ts +0 -7
- package/src/PAFAdapter/util.ts +0 -176
- package/src/index.ts +0 -62
- package/src/util.ts +0 -66
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseFeatureDataAdapter,
|
|
3
|
-
BaseOptions,
|
|
4
|
-
} from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
5
|
-
import { Region } from '@jbrowse/core/util/types'
|
|
6
|
-
import { doesIntersect2 } from '@jbrowse/core/util/range'
|
|
7
|
-
import { openLocation } from '@jbrowse/core/util/io'
|
|
8
|
-
import { ObservableCreate } from '@jbrowse/core/util/rxjs'
|
|
9
|
-
import { Feature } from '@jbrowse/core/util'
|
|
10
|
-
import {
|
|
11
|
-
AnyConfigurationModel,
|
|
12
|
-
readConfObject,
|
|
13
|
-
} from '@jbrowse/core/configuration'
|
|
14
|
-
import { unzip } from '@gmod/bgzf-filehandle'
|
|
15
|
-
import { MismatchParser } from '@jbrowse/plugin-alignments'
|
|
16
|
-
|
|
17
|
-
// locals
|
|
18
|
-
import SyntenyFeature from './SyntenyFeature'
|
|
19
|
-
import { isGzip, parseLineByLine } from '../util'
|
|
20
|
-
import {
|
|
21
|
-
getWeightedMeans,
|
|
22
|
-
flipCigar,
|
|
23
|
-
swapIndelCigar,
|
|
24
|
-
parsePAFLine,
|
|
25
|
-
PAFRecord,
|
|
26
|
-
} from './util'
|
|
27
|
-
|
|
28
|
-
const { parseCigar } = MismatchParser
|
|
29
|
-
|
|
30
|
-
interface PAFOptions extends BaseOptions {
|
|
31
|
-
config?: AnyConfigurationModel
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default class PAFAdapter extends BaseFeatureDataAdapter {
|
|
35
|
-
private setupP?: Promise<PAFRecord[]>
|
|
36
|
-
|
|
37
|
-
public static capabilities = ['getFeatures', 'getRefNames']
|
|
38
|
-
|
|
39
|
-
async setup(opts?: BaseOptions) {
|
|
40
|
-
if (!this.setupP) {
|
|
41
|
-
this.setupP = this.setupPre(opts).catch(e => {
|
|
42
|
-
this.setupP = undefined
|
|
43
|
-
throw e
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
return this.setupP
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async setupPre(opts?: BaseOptions) {
|
|
50
|
-
const pm = this.pluginManager
|
|
51
|
-
const pafLocation = openLocation(this.getConf('pafLocation'), pm)
|
|
52
|
-
const buffer = (await pafLocation.readFile(opts)) as Buffer
|
|
53
|
-
const buf = isGzip(buffer) ? await unzip(buffer) : buffer
|
|
54
|
-
return parseLineByLine(buf, parsePAFLine)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async hasDataForRefName() {
|
|
58
|
-
// determining this properly is basically a call to getFeatures
|
|
59
|
-
// so is not really that important, and has to be true or else
|
|
60
|
-
// getFeatures is never called (BaseAdapter filters it out)
|
|
61
|
-
return true
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
getAssemblyNames() {
|
|
65
|
-
const assemblyNames = this.getConf('assemblyNames') as string[]
|
|
66
|
-
if (assemblyNames.length === 0) {
|
|
67
|
-
const query = this.getConf('queryAssembly') as string
|
|
68
|
-
const target = this.getConf('targetAssembly') as string
|
|
69
|
-
return [query, target]
|
|
70
|
-
}
|
|
71
|
-
return assemblyNames
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async getRefNames(opts: BaseOptions = {}) {
|
|
75
|
-
// @ts-expect-error
|
|
76
|
-
const r1 = opts.regions?.[0].assemblyName
|
|
77
|
-
const feats = await this.setup(opts)
|
|
78
|
-
|
|
79
|
-
const idx = this.getAssemblyNames().indexOf(r1)
|
|
80
|
-
if (idx !== -1) {
|
|
81
|
-
const set = new Set<string>()
|
|
82
|
-
for (const feat of feats) {
|
|
83
|
-
set.add(idx === 0 ? feat.qname : feat.tname)
|
|
84
|
-
}
|
|
85
|
-
return [...set]
|
|
86
|
-
}
|
|
87
|
-
console.warn('Unable to do ref renaming on adapter')
|
|
88
|
-
return []
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
getFeatures(query: Region, opts: PAFOptions = {}) {
|
|
92
|
-
return ObservableCreate<Feature>(async observer => {
|
|
93
|
-
let pafRecords = await this.setup(opts)
|
|
94
|
-
const { config } = opts
|
|
95
|
-
|
|
96
|
-
// note: this is not the adapter config, it is responding to a display
|
|
97
|
-
// setting passed in via the opts parameter
|
|
98
|
-
if (config && readConfObject(config, 'colorBy') === 'meanQueryIdentity') {
|
|
99
|
-
pafRecords = getWeightedMeans(pafRecords)
|
|
100
|
-
}
|
|
101
|
-
const assemblyNames = this.getAssemblyNames()
|
|
102
|
-
|
|
103
|
-
// The index of the assembly name in the query list corresponds to the
|
|
104
|
-
// adapter in the subadapters list
|
|
105
|
-
const index = assemblyNames.indexOf(query.assemblyName)
|
|
106
|
-
const { start: qstart, end: qend, refName: qref, assemblyName } = query
|
|
107
|
-
if (index === -1) {
|
|
108
|
-
console.warn(`${assemblyName} not found in this adapter`)
|
|
109
|
-
observer.complete()
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
for (let i = 0; i < pafRecords.length; i++) {
|
|
113
|
-
const r = pafRecords[i]
|
|
114
|
-
let start = 0
|
|
115
|
-
let end = 0
|
|
116
|
-
let refName = ''
|
|
117
|
-
let mateName = ''
|
|
118
|
-
let mateStart = 0
|
|
119
|
-
let mateEnd = 0
|
|
120
|
-
const flip = index === 0
|
|
121
|
-
const assemblyName = assemblyNames[+!flip]
|
|
122
|
-
if (index === 0) {
|
|
123
|
-
start = r.qstart
|
|
124
|
-
end = r.qend
|
|
125
|
-
refName = r.qname
|
|
126
|
-
mateName = r.tname
|
|
127
|
-
mateStart = r.tstart
|
|
128
|
-
mateEnd = r.tend
|
|
129
|
-
} else {
|
|
130
|
-
start = r.tstart
|
|
131
|
-
end = r.tend
|
|
132
|
-
refName = r.tname
|
|
133
|
-
mateName = r.qname
|
|
134
|
-
mateStart = r.qstart
|
|
135
|
-
mateEnd = r.qend
|
|
136
|
-
}
|
|
137
|
-
const { extra, strand } = r
|
|
138
|
-
if (refName === qref && doesIntersect2(qstart, qend, start, end)) {
|
|
139
|
-
const { numMatches = 0, blockLen = 1, cg, ...rest } = extra
|
|
140
|
-
|
|
141
|
-
let CIGAR = extra.cg
|
|
142
|
-
if (extra.cg) {
|
|
143
|
-
if (flip && strand === -1) {
|
|
144
|
-
CIGAR = flipCigar(parseCigar(extra.cg)).join('')
|
|
145
|
-
} else if (flip) {
|
|
146
|
-
CIGAR = swapIndelCigar(extra.cg)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
observer.next(
|
|
151
|
-
new SyntenyFeature({
|
|
152
|
-
uniqueId: i + assemblyName,
|
|
153
|
-
assemblyName,
|
|
154
|
-
start,
|
|
155
|
-
end,
|
|
156
|
-
type: 'match',
|
|
157
|
-
refName,
|
|
158
|
-
strand,
|
|
159
|
-
...rest,
|
|
160
|
-
CIGAR,
|
|
161
|
-
syntenyId: i,
|
|
162
|
-
identity: numMatches / blockLen,
|
|
163
|
-
numMatches,
|
|
164
|
-
blockLen,
|
|
165
|
-
mate: {
|
|
166
|
-
start: mateStart,
|
|
167
|
-
end: mateEnd,
|
|
168
|
-
refName: mateName,
|
|
169
|
-
assemblyName: assemblyNames[+flip],
|
|
170
|
-
},
|
|
171
|
-
}),
|
|
172
|
-
)
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
observer.complete()
|
|
177
|
-
})
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
freeResources(/* { query } */): void {}
|
|
181
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SimpleFeature } from '@jbrowse/core/util'
|
|
2
|
-
import { MismatchParser } from '@jbrowse/plugin-alignments'
|
|
3
|
-
|
|
4
|
-
// locals
|
|
5
|
-
const { getMismatches } = MismatchParser
|
|
6
|
-
|
|
7
|
-
export default class SyntenyFeature extends SimpleFeature {
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
get(arg: string): any {
|
|
10
|
-
if (arg === 'mismatches') {
|
|
11
|
-
return getMismatches(this.get('CIGAR'))
|
|
12
|
-
}
|
|
13
|
-
return super.get(arg)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* #config PAFAdapter
|
|
5
|
-
*/
|
|
6
|
-
function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
7
|
-
|
|
8
|
-
const PAFAdapter = ConfigurationSchema(
|
|
9
|
-
'PAFAdapter',
|
|
10
|
-
{
|
|
11
|
-
/**
|
|
12
|
-
* #slot
|
|
13
|
-
*/
|
|
14
|
-
assemblyNames: {
|
|
15
|
-
type: 'stringArray',
|
|
16
|
-
defaultValue: [],
|
|
17
|
-
description:
|
|
18
|
-
'Array of assembly names to use for this file. The target assembly name is the first value in the array, query assembly name is the second',
|
|
19
|
-
},
|
|
20
|
-
/**
|
|
21
|
-
* #slot
|
|
22
|
-
*/
|
|
23
|
-
targetAssembly: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
defaultValue: '',
|
|
26
|
-
description: 'Alternative to assemblyNames: the target assembly name',
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* #slot
|
|
30
|
-
*/
|
|
31
|
-
queryAssembly: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
defaultValue: '',
|
|
34
|
-
description: 'Alternative to assemblyNames: the query assembly name',
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* #slot
|
|
38
|
-
*/
|
|
39
|
-
pafLocation: {
|
|
40
|
-
type: 'fileLocation',
|
|
41
|
-
defaultValue: {
|
|
42
|
-
uri: '/path/to/file.paf',
|
|
43
|
-
locationType: 'UriLocation',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
{ explicitlyTyped: true },
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
export default PAFAdapter
|
package/src/PAFAdapter/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
2
|
-
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'
|
|
3
|
-
import configSchema from './configSchema'
|
|
4
|
-
|
|
5
|
-
export default (pluginManager: PluginManager) => {
|
|
6
|
-
pluginManager.addAdapterType(
|
|
7
|
-
() =>
|
|
8
|
-
new AdapterType({
|
|
9
|
-
name: 'PAFAdapter',
|
|
10
|
-
displayName: 'PAF adapter',
|
|
11
|
-
configSchema,
|
|
12
|
-
adapterMetadata: {
|
|
13
|
-
hiddenFromGUI: true,
|
|
14
|
-
},
|
|
15
|
-
getAdapterClass: () => import('./PAFAdapter').then(r => r.default),
|
|
16
|
-
}),
|
|
17
|
-
)
|
|
18
|
-
}
|