@jbrowse/plugin-variants 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/ChordVariantDisplay/index.js +0 -1
- package/dist/ChordVariantDisplay/models/configSchema.js +0 -1
- package/dist/ChordVariantDisplay/models/stateModelFactory.js +0 -1
- package/dist/LinearVariantDisplay/configSchema.js +0 -1
- package/dist/LinearVariantDisplay/index.js +0 -1
- package/dist/LinearVariantDisplay/model.js +0 -1
- package/dist/StructuralVariantChordRenderer/Chord.js +0 -1
- package/dist/StructuralVariantChordRenderer/ReactComponent.js +0 -1
- package/dist/StructuralVariantChordRenderer/configSchema.js +0 -1
- package/dist/StructuralVariantChordRenderer/index.js +0 -1
- package/dist/VariantFeatureWidget/AnnotGrid.js +0 -1
- package/dist/VariantFeatureWidget/BreakendOptionDialog.js +0 -1
- package/dist/VariantFeatureWidget/BreakendPanel.js +0 -1
- package/dist/VariantFeatureWidget/VariantAnnotationTable.js +0 -1
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +0 -1
- package/dist/VariantFeatureWidget/VariantSampleGrid.js +0 -1
- package/dist/VariantFeatureWidget/index.js +0 -1
- package/dist/VariantTrack/configSchema.js +0 -1
- package/dist/VariantTrack/index.js +0 -1
- package/dist/VcfAdapter/VcfAdapter.js +0 -1
- package/dist/VcfAdapter/configSchema.js +0 -1
- package/dist/VcfAdapter/index.js +0 -1
- package/dist/VcfFeature/index.js +2 -2
- package/dist/VcfFeature/util.js +0 -1
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +0 -1
- package/dist/VcfTabixAdapter/configSchema.js +0 -1
- package/dist/VcfTabixAdapter/index.js +0 -1
- package/dist/extensionPoints.js +0 -1
- package/dist/index.js +0 -1
- package/esm/ChordVariantDisplay/index.js +0 -1
- package/esm/ChordVariantDisplay/models/configSchema.js +0 -1
- package/esm/ChordVariantDisplay/models/stateModelFactory.js +0 -1
- package/esm/LinearVariantDisplay/configSchema.js +0 -1
- package/esm/LinearVariantDisplay/index.js +0 -1
- package/esm/LinearVariantDisplay/model.js +0 -1
- package/esm/StructuralVariantChordRenderer/Chord.js +0 -1
- package/esm/StructuralVariantChordRenderer/ReactComponent.js +0 -1
- package/esm/StructuralVariantChordRenderer/configSchema.js +0 -1
- package/esm/StructuralVariantChordRenderer/index.js +0 -1
- package/esm/VariantFeatureWidget/AnnotGrid.js +0 -1
- package/esm/VariantFeatureWidget/BreakendOptionDialog.js +0 -1
- package/esm/VariantFeatureWidget/BreakendPanel.js +0 -1
- package/esm/VariantFeatureWidget/VariantAnnotationTable.js +0 -1
- package/esm/VariantFeatureWidget/VariantFeatureWidget.js +0 -1
- package/esm/VariantFeatureWidget/VariantSampleGrid.js +0 -1
- package/esm/VariantFeatureWidget/index.js +0 -1
- package/esm/VariantTrack/configSchema.js +0 -1
- package/esm/VariantTrack/index.js +0 -1
- package/esm/VcfAdapter/VcfAdapter.js +0 -1
- package/esm/VcfAdapter/configSchema.js +0 -1
- package/esm/VcfAdapter/index.js +0 -1
- package/esm/VcfFeature/index.js +2 -2
- package/esm/VcfFeature/util.js +0 -1
- package/esm/VcfTabixAdapter/VcfTabixAdapter.js +0 -1
- package/esm/VcfTabixAdapter/configSchema.js +0 -1
- package/esm/VcfTabixAdapter/index.js +0 -1
- package/esm/extensionPoints.js +0 -1
- package/esm/index.js +0 -1
- package/package.json +3 -4
- package/dist/ChordVariantDisplay/index.js.map +0 -1
- package/dist/ChordVariantDisplay/models/configSchema.js.map +0 -1
- package/dist/ChordVariantDisplay/models/stateModelFactory.js.map +0 -1
- package/dist/LinearVariantDisplay/configSchema.js.map +0 -1
- package/dist/LinearVariantDisplay/index.js.map +0 -1
- package/dist/LinearVariantDisplay/model.js.map +0 -1
- package/dist/StructuralVariantChordRenderer/Chord.js.map +0 -1
- package/dist/StructuralVariantChordRenderer/ReactComponent.js.map +0 -1
- package/dist/StructuralVariantChordRenderer/configSchema.js.map +0 -1
- package/dist/StructuralVariantChordRenderer/index.js.map +0 -1
- package/dist/VariantFeatureWidget/AnnotGrid.js.map +0 -1
- package/dist/VariantFeatureWidget/BreakendOptionDialog.js.map +0 -1
- package/dist/VariantFeatureWidget/BreakendPanel.js.map +0 -1
- package/dist/VariantFeatureWidget/VariantAnnotationTable.js.map +0 -1
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js.map +0 -1
- package/dist/VariantFeatureWidget/VariantSampleGrid.js.map +0 -1
- package/dist/VariantFeatureWidget/index.js.map +0 -1
- package/dist/VariantTrack/configSchema.js.map +0 -1
- package/dist/VariantTrack/index.js.map +0 -1
- package/dist/VcfAdapter/VcfAdapter.js.map +0 -1
- package/dist/VcfAdapter/configSchema.js.map +0 -1
- package/dist/VcfAdapter/index.js.map +0 -1
- package/dist/VcfFeature/index.js.map +0 -1
- package/dist/VcfFeature/util.js.map +0 -1
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js.map +0 -1
- package/dist/VcfTabixAdapter/configSchema.js.map +0 -1
- package/dist/VcfTabixAdapter/index.js.map +0 -1
- package/dist/extensionPoints.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/esm/ChordVariantDisplay/index.js.map +0 -1
- package/esm/ChordVariantDisplay/models/configSchema.js.map +0 -1
- package/esm/ChordVariantDisplay/models/stateModelFactory.js.map +0 -1
- package/esm/LinearVariantDisplay/configSchema.js.map +0 -1
- package/esm/LinearVariantDisplay/index.js.map +0 -1
- package/esm/LinearVariantDisplay/model.js.map +0 -1
- package/esm/StructuralVariantChordRenderer/Chord.js.map +0 -1
- package/esm/StructuralVariantChordRenderer/ReactComponent.js.map +0 -1
- package/esm/StructuralVariantChordRenderer/configSchema.js.map +0 -1
- package/esm/StructuralVariantChordRenderer/index.js.map +0 -1
- package/esm/VariantFeatureWidget/AnnotGrid.js.map +0 -1
- package/esm/VariantFeatureWidget/BreakendOptionDialog.js.map +0 -1
- package/esm/VariantFeatureWidget/BreakendPanel.js.map +0 -1
- package/esm/VariantFeatureWidget/VariantAnnotationTable.js.map +0 -1
- package/esm/VariantFeatureWidget/VariantFeatureWidget.js.map +0 -1
- package/esm/VariantFeatureWidget/VariantSampleGrid.js.map +0 -1
- package/esm/VariantFeatureWidget/index.js.map +0 -1
- package/esm/VariantTrack/configSchema.js.map +0 -1
- package/esm/VariantTrack/index.js.map +0 -1
- package/esm/VcfAdapter/VcfAdapter.js.map +0 -1
- package/esm/VcfAdapter/configSchema.js.map +0 -1
- package/esm/VcfAdapter/index.js.map +0 -1
- package/esm/VcfFeature/index.js.map +0 -1
- package/esm/VcfFeature/util.js.map +0 -1
- package/esm/VcfTabixAdapter/VcfTabixAdapter.js.map +0 -1
- package/esm/VcfTabixAdapter/configSchema.js.map +0 -1
- package/esm/VcfTabixAdapter/index.js.map +0 -1
- package/esm/extensionPoints.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/src/ChordVariantDisplay/index.ts +0 -23
- package/src/ChordVariantDisplay/models/configSchema.ts +0 -33
- package/src/ChordVariantDisplay/models/stateModelFactory.ts +0 -63
- package/src/LinearVariantDisplay/configSchema.ts +0 -30
- package/src/LinearVariantDisplay/index.ts +0 -20
- package/src/LinearVariantDisplay/model.ts +0 -76
- package/src/StructuralVariantChordRenderer/Chord.tsx +0 -141
- package/src/StructuralVariantChordRenderer/ReactComponent.tsx +0 -78
- package/src/StructuralVariantChordRenderer/configSchema.ts +0 -42
- package/src/StructuralVariantChordRenderer/index.ts +0 -17
- package/src/VariantFeatureWidget/AnnotGrid.tsx +0 -51
- package/src/VariantFeatureWidget/BreakendOptionDialog.tsx +0 -117
- package/src/VariantFeatureWidget/BreakendPanel.tsx +0 -93
- package/src/VariantFeatureWidget/VariantAnnotationTable.tsx +0 -27
- package/src/VariantFeatureWidget/VariantFeatureWidget.test.tsx +0 -42
- package/src/VariantFeatureWidget/VariantFeatureWidget.tsx +0 -112
- package/src/VariantFeatureWidget/VariantSampleGrid.tsx +0 -151
- package/src/VariantFeatureWidget/__snapshots__/VariantFeatureWidget.test.tsx.snap +0 -244
- package/src/VariantFeatureWidget/index.ts +0 -32
- package/src/VariantTrack/configSchema.ts +0 -24
- package/src/VariantTrack/index.ts +0 -16
- package/src/VcfAdapter/VcfAdapter.test.ts +0 -28
- package/src/VcfAdapter/VcfAdapter.ts +0 -125
- package/src/VcfAdapter/__snapshots__/VcfAdapter.test.ts.snap +0 -325
- package/src/VcfAdapter/configSchema.ts +0 -22
- package/src/VcfAdapter/index.ts +0 -15
- package/src/VcfAdapter/test_data/volvox.filtered.vcf +0 -73
- package/src/VcfFeature/index.test.ts +0 -132
- package/src/VcfFeature/index.ts +0 -104
- package/src/VcfFeature/util.ts +0 -138
- package/src/VcfTabixAdapter/VcfTabixAdapter.test.ts +0 -69
- package/src/VcfTabixAdapter/VcfTabixAdapter.ts +0 -90
- package/src/VcfTabixAdapter/__snapshots__/VcfTabixAdapter.test.ts.snap +0 -325
- package/src/VcfTabixAdapter/configSchema.ts +0 -43
- package/src/VcfTabixAdapter/index.ts +0 -17
- package/src/VcfTabixAdapter/test_data/volvox.filtered.vcf.gz +0 -0
- package/src/VcfTabixAdapter/test_data/volvox.filtered.vcf.gz.csi +0 -0
- package/src/VcfTabixAdapter/test_data/volvox.filtered.vcf.gz.tbi +0 -0
- package/src/__snapshots__/index.test.ts.snap +0 -20
- package/src/extensionPoints.ts +0 -74
- package/src/index.test.ts +0 -32
- package/src/index.ts +0 -27
package/src/VcfFeature/util.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import VCF, { parseBreakend } from '@gmod/vcf'
|
|
2
|
-
|
|
3
|
-
const altTypeToSO: { [key: string]: string | undefined } = {
|
|
4
|
-
DEL: 'deletion',
|
|
5
|
-
INS: 'insertion',
|
|
6
|
-
DUP: 'duplication',
|
|
7
|
-
INV: 'inversion',
|
|
8
|
-
INVDUP: 'inverted duplication',
|
|
9
|
-
CNV: 'copy_number_variation',
|
|
10
|
-
TRA: 'translocation',
|
|
11
|
-
'DUP:TANDEM': 'tandem_duplication',
|
|
12
|
-
NON_REF: 'sequence_variant',
|
|
13
|
-
'*': 'sequence_variant',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Get a sequence ontology (SO) term that describes the variant type
|
|
18
|
-
*/
|
|
19
|
-
export function getSOTermAndDescription(
|
|
20
|
-
ref: string,
|
|
21
|
-
alt: string[],
|
|
22
|
-
parser: VCF,
|
|
23
|
-
): string[] {
|
|
24
|
-
// it's just a remark if there are no alternate alleles
|
|
25
|
-
if (!alt || alt.length === 0) {
|
|
26
|
-
return ['remark', 'no alternative alleles']
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const soTerms = new Set<string>()
|
|
30
|
-
let descriptions = new Set<string>()
|
|
31
|
-
alt.forEach(a => {
|
|
32
|
-
let [soTerm, description] = getSOAndDescFromAltDefs(ref, a, parser)
|
|
33
|
-
if (!soTerm) {
|
|
34
|
-
;[soTerm, description] = getSOAndDescByExamination(ref, a)
|
|
35
|
-
}
|
|
36
|
-
if (soTerm && description) {
|
|
37
|
-
soTerms.add(soTerm)
|
|
38
|
-
descriptions.add(description)
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
// Combine descriptions like ["SNV G -> A", "SNV G -> T"] to ["SNV G -> A,T"]
|
|
43
|
-
if (descriptions.size > 1) {
|
|
44
|
-
const descs = [...descriptions]
|
|
45
|
-
const prefixes = new Set(
|
|
46
|
-
descs.map(desc => {
|
|
47
|
-
const prefix = desc.split('->')
|
|
48
|
-
return prefix[1] ? prefix[0] : desc
|
|
49
|
-
}),
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
descriptions = new Set(
|
|
53
|
-
[...prefixes].map(prefix => {
|
|
54
|
-
const suffixes = descs
|
|
55
|
-
.map(desc => {
|
|
56
|
-
const pref = desc.split('-> ')
|
|
57
|
-
return pref[1] && pref[0] === prefix ? pref[1] : ''
|
|
58
|
-
})
|
|
59
|
-
.filter(f => !!f)
|
|
60
|
-
|
|
61
|
-
return suffixes.length ? prefix + '-> ' + suffixes.join(',') : prefix
|
|
62
|
-
}),
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
if (soTerms.size) {
|
|
66
|
-
return [[...soTerms].join(','), [...descriptions].join(',')]
|
|
67
|
-
}
|
|
68
|
-
return []
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function getSOAndDescFromAltDefs(
|
|
72
|
-
ref: string,
|
|
73
|
-
alt: string,
|
|
74
|
-
parser: VCF,
|
|
75
|
-
): string[] {
|
|
76
|
-
if (typeof alt === 'string' && !alt.startsWith('<')) {
|
|
77
|
-
return []
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// look for a definition with an SO type for this
|
|
81
|
-
let soTerm = altTypeToSO[alt]
|
|
82
|
-
// if no SO term but ALT is in metadata, assume sequence_variant
|
|
83
|
-
if (!soTerm && parser.getMetadata('ALT', alt)) {
|
|
84
|
-
soTerm = 'sequence_variant'
|
|
85
|
-
}
|
|
86
|
-
if (soTerm) {
|
|
87
|
-
return [soTerm, alt]
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// try to look for a definition for a parent term if we can
|
|
91
|
-
const modAlt = alt.split(':')
|
|
92
|
-
if (modAlt.length > 1) {
|
|
93
|
-
return getSOAndDescFromAltDefs(
|
|
94
|
-
ref,
|
|
95
|
-
`<${modAlt.slice(0, -1).join(':')}>`,
|
|
96
|
-
parser,
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// no parent
|
|
101
|
-
return []
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// note: term SNV is used instead of SNP because SO definition of SNP says
|
|
105
|
-
// abundance must be at least 1% in population, and can't be sure we meet
|
|
106
|
-
// that
|
|
107
|
-
export function getSOAndDescByExamination(ref: string, alt: string) {
|
|
108
|
-
const bnd = parseBreakend(alt)
|
|
109
|
-
if (bnd) {
|
|
110
|
-
return ['breakend', alt]
|
|
111
|
-
} else if (ref.length === 1 && alt.length === 1) {
|
|
112
|
-
return ['SNV', makeDescriptionString('SNV', ref, alt)]
|
|
113
|
-
} else if (alt === '<INS>') {
|
|
114
|
-
return ['insertion', alt]
|
|
115
|
-
} else if (alt === '<DEL>') {
|
|
116
|
-
return ['deletion', alt]
|
|
117
|
-
} else if (alt === '<INV>') {
|
|
118
|
-
return ['deletion', alt]
|
|
119
|
-
} else if (alt === '<TRA>') {
|
|
120
|
-
return ['translocation', alt]
|
|
121
|
-
} else if (alt.includes('<')) {
|
|
122
|
-
return ['sv', alt]
|
|
123
|
-
} else if (ref.length === alt.length) {
|
|
124
|
-
return ref.split('').reverse().join('') === alt
|
|
125
|
-
? ['inversion', makeDescriptionString('inversion', ref, alt)]
|
|
126
|
-
: ['substitution', makeDescriptionString('substitution', ref, alt)]
|
|
127
|
-
} else if (ref.length <= alt.length) {
|
|
128
|
-
return ['insertion', makeDescriptionString('insertion', ref, alt)]
|
|
129
|
-
} else if (ref.length > alt.length) {
|
|
130
|
-
return ['deletion', makeDescriptionString('deletion', ref, alt)]
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return ['indel', makeDescriptionString('indel', ref, alt)]
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function makeDescriptionString(soTerm: string, ref: string, alt: string) {
|
|
137
|
-
return `${soTerm} ${ref} -> ${alt}`
|
|
138
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { toArray } from 'rxjs/operators'
|
|
2
|
-
import { firstValueFrom } from 'rxjs'
|
|
3
|
-
import Adapter from './VcfTabixAdapter'
|
|
4
|
-
import configSchema from './configSchema'
|
|
5
|
-
|
|
6
|
-
test('adapter can fetch variants from volvox.vcf.gz', async () => {
|
|
7
|
-
const adapter = new Adapter(
|
|
8
|
-
configSchema.create({
|
|
9
|
-
vcfGzLocation: {
|
|
10
|
-
localPath: require.resolve('./test_data/volvox.filtered.vcf.gz'),
|
|
11
|
-
locationType: 'LocalPathLocation',
|
|
12
|
-
},
|
|
13
|
-
index: {
|
|
14
|
-
indexType: 'TBI',
|
|
15
|
-
location: {
|
|
16
|
-
localPath: require.resolve('./test_data/volvox.filtered.vcf.gz.tbi'),
|
|
17
|
-
locationType: 'LocalPathLocation',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
}),
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
const csiAdapter = new Adapter(
|
|
24
|
-
configSchema.create({
|
|
25
|
-
vcfGzLocation: {
|
|
26
|
-
localPath: require.resolve('./test_data/volvox.filtered.vcf.gz'),
|
|
27
|
-
locationType: 'LocalPathLocation',
|
|
28
|
-
},
|
|
29
|
-
index: {
|
|
30
|
-
indexType: 'CSI',
|
|
31
|
-
location: {
|
|
32
|
-
localPath: require.resolve('./test_data/volvox.filtered.vcf.gz.csi'),
|
|
33
|
-
locationType: 'LocalPathLocation',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
const csiFeatures = csiAdapter.getFeatures({
|
|
40
|
-
refName: 'ctgA',
|
|
41
|
-
start: 0,
|
|
42
|
-
end: 20000,
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
const names = await adapter.getRefNames()
|
|
46
|
-
const csiNames = await csiAdapter.getRefNames()
|
|
47
|
-
expect(names).toEqual(csiNames)
|
|
48
|
-
expect(names).toMatchSnapshot()
|
|
49
|
-
|
|
50
|
-
const feat = adapter.getFeatures({
|
|
51
|
-
refName: 'ctgA',
|
|
52
|
-
start: 0,
|
|
53
|
-
end: 20000,
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const featArray = await firstValueFrom(feat.pipe(toArray()))
|
|
57
|
-
const csiFeaturesArray = await firstValueFrom(csiFeatures.pipe(toArray()))
|
|
58
|
-
expect(featArray.slice(0, 5)).toMatchSnapshot()
|
|
59
|
-
expect(csiFeaturesArray.slice(0, 5)).toEqual(featArray.slice(0, 5))
|
|
60
|
-
|
|
61
|
-
const featNonExist = adapter.getFeatures({
|
|
62
|
-
refName: 'ctgC',
|
|
63
|
-
start: 0,
|
|
64
|
-
end: 20000,
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
const featArrayNonExist = await firstValueFrom(featNonExist.pipe(toArray()))
|
|
68
|
-
expect(featArrayNonExist).toEqual([])
|
|
69
|
-
})
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseFeatureDataAdapter,
|
|
3
|
-
BaseOptions,
|
|
4
|
-
} from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
5
|
-
import { NoAssemblyRegion } from '@jbrowse/core/util/types'
|
|
6
|
-
import { openLocation } from '@jbrowse/core/util/io'
|
|
7
|
-
import { ObservableCreate } from '@jbrowse/core/util/rxjs'
|
|
8
|
-
import { Feature } from '@jbrowse/core/util'
|
|
9
|
-
import { TabixIndexedFile } from '@gmod/tabix'
|
|
10
|
-
import VcfParser from '@gmod/vcf'
|
|
11
|
-
|
|
12
|
-
// local
|
|
13
|
-
import VcfFeature from '../VcfFeature'
|
|
14
|
-
|
|
15
|
-
export default class extends BaseFeatureDataAdapter {
|
|
16
|
-
private configured?: Promise<{
|
|
17
|
-
vcf: TabixIndexedFile
|
|
18
|
-
parser: VcfParser
|
|
19
|
-
}>
|
|
20
|
-
|
|
21
|
-
private async configurePre() {
|
|
22
|
-
const pm = this.pluginManager
|
|
23
|
-
const vcfGzLocation = this.getConf('vcfGzLocation')
|
|
24
|
-
const location = this.getConf(['index', 'location'])
|
|
25
|
-
const indexType = this.getConf(['index', 'indexType'])
|
|
26
|
-
|
|
27
|
-
const filehandle = openLocation(vcfGzLocation, pm)
|
|
28
|
-
const isCSI = indexType === 'CSI'
|
|
29
|
-
const vcf = new TabixIndexedFile({
|
|
30
|
-
filehandle,
|
|
31
|
-
csiFilehandle: isCSI ? openLocation(location, pm) : undefined,
|
|
32
|
-
tbiFilehandle: !isCSI ? openLocation(location, pm) : undefined,
|
|
33
|
-
chunkCacheSize: 50 * 2 ** 20,
|
|
34
|
-
chunkSizeLimit: 1000000000,
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const header = await vcf.getHeader()
|
|
38
|
-
return {
|
|
39
|
-
vcf,
|
|
40
|
-
parser: new VcfParser({ header }),
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
protected async configure() {
|
|
45
|
-
if (!this.configured) {
|
|
46
|
-
this.configured = this.configurePre().catch(e => {
|
|
47
|
-
this.configured = undefined
|
|
48
|
-
throw e
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
return this.configured
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public async getRefNames(opts: BaseOptions = {}) {
|
|
55
|
-
const { vcf } = await this.configure()
|
|
56
|
-
return vcf.getReferenceSequenceNames(opts)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async getHeader() {
|
|
60
|
-
const { vcf } = await this.configure()
|
|
61
|
-
return vcf.getHeader()
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async getMetadata() {
|
|
65
|
-
const { parser } = await this.configure()
|
|
66
|
-
return parser.getMetadata()
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public getFeatures(query: NoAssemblyRegion, opts: BaseOptions = {}) {
|
|
70
|
-
return ObservableCreate<Feature>(async observer => {
|
|
71
|
-
const { refName, start, end } = query
|
|
72
|
-
const { vcf, parser } = await this.configure()
|
|
73
|
-
await vcf.getLines(refName, start, end, {
|
|
74
|
-
lineCallback: (line, fileOffset) => {
|
|
75
|
-
observer.next(
|
|
76
|
-
new VcfFeature({
|
|
77
|
-
variant: parser.parseLine(line),
|
|
78
|
-
parser,
|
|
79
|
-
id: `${this.id}-vcf-${fileOffset}`,
|
|
80
|
-
}),
|
|
81
|
-
)
|
|
82
|
-
},
|
|
83
|
-
...opts,
|
|
84
|
-
})
|
|
85
|
-
observer.complete()
|
|
86
|
-
}, opts.signal)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public freeResources(/* { region } */): void {}
|
|
90
|
-
}
|
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`adapter can fetch variants from volvox.vcf.gz 1`] = `
|
|
4
|
-
[
|
|
5
|
-
"ctgA",
|
|
6
|
-
]
|
|
7
|
-
`;
|
|
8
|
-
|
|
9
|
-
exports[`adapter can fetch variants from volvox.vcf.gz 2`] = `
|
|
10
|
-
[
|
|
11
|
-
{
|
|
12
|
-
"ALT": [
|
|
13
|
-
"C",
|
|
14
|
-
],
|
|
15
|
-
"CHROM": "ctgA",
|
|
16
|
-
"FILTER": null,
|
|
17
|
-
"ID": null,
|
|
18
|
-
"INFO": {
|
|
19
|
-
"AC1": [
|
|
20
|
-
2,
|
|
21
|
-
],
|
|
22
|
-
"AF1": [
|
|
23
|
-
1,
|
|
24
|
-
],
|
|
25
|
-
"DP": [
|
|
26
|
-
3,
|
|
27
|
-
],
|
|
28
|
-
"DP4": [
|
|
29
|
-
0,
|
|
30
|
-
0,
|
|
31
|
-
3,
|
|
32
|
-
0,
|
|
33
|
-
],
|
|
34
|
-
"FQ": [
|
|
35
|
-
-36,
|
|
36
|
-
],
|
|
37
|
-
"MQ": [
|
|
38
|
-
37,
|
|
39
|
-
],
|
|
40
|
-
"VDB": [
|
|
41
|
-
0.0186,
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
"POS": 277,
|
|
45
|
-
"QUAL": 10.4,
|
|
46
|
-
"REF": "T",
|
|
47
|
-
"aliases": undefined,
|
|
48
|
-
"description": "SNV T -> C",
|
|
49
|
-
"end": 277,
|
|
50
|
-
"name": undefined,
|
|
51
|
-
"refName": "ctgA",
|
|
52
|
-
"samples": {
|
|
53
|
-
"sample_data/raw/volvox/volvox-sorted.bam": {
|
|
54
|
-
"GQ": [
|
|
55
|
-
13,
|
|
56
|
-
],
|
|
57
|
-
"GT": [
|
|
58
|
-
"1/1",
|
|
59
|
-
],
|
|
60
|
-
"PL": [
|
|
61
|
-
42,
|
|
62
|
-
9,
|
|
63
|
-
0,
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
"start": 276,
|
|
68
|
-
"type": "SNV",
|
|
69
|
-
"uniqueId": "test-vcf-604453",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"ALT": [
|
|
73
|
-
"C",
|
|
74
|
-
],
|
|
75
|
-
"CHROM": "ctgA",
|
|
76
|
-
"FILTER": null,
|
|
77
|
-
"ID": null,
|
|
78
|
-
"INFO": {
|
|
79
|
-
"AC1": [
|
|
80
|
-
2,
|
|
81
|
-
],
|
|
82
|
-
"AF1": [
|
|
83
|
-
1,
|
|
84
|
-
],
|
|
85
|
-
"DP": [
|
|
86
|
-
23,
|
|
87
|
-
],
|
|
88
|
-
"DP4": [
|
|
89
|
-
0,
|
|
90
|
-
1,
|
|
91
|
-
8,
|
|
92
|
-
14,
|
|
93
|
-
],
|
|
94
|
-
"FQ": [
|
|
95
|
-
-73,
|
|
96
|
-
],
|
|
97
|
-
"MQ": [
|
|
98
|
-
37,
|
|
99
|
-
],
|
|
100
|
-
"PV4": [
|
|
101
|
-
1,
|
|
102
|
-
1,
|
|
103
|
-
0.42,
|
|
104
|
-
1,
|
|
105
|
-
],
|
|
106
|
-
"VDB": [
|
|
107
|
-
0.0308,
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
"POS": 1694,
|
|
111
|
-
"QUAL": 107,
|
|
112
|
-
"REF": "T",
|
|
113
|
-
"aliases": undefined,
|
|
114
|
-
"description": "SNV T -> C",
|
|
115
|
-
"end": 1694,
|
|
116
|
-
"name": undefined,
|
|
117
|
-
"refName": "ctgA",
|
|
118
|
-
"samples": {
|
|
119
|
-
"sample_data/raw/volvox/volvox-sorted.bam": {
|
|
120
|
-
"GQ": [
|
|
121
|
-
89,
|
|
122
|
-
],
|
|
123
|
-
"GT": [
|
|
124
|
-
"1/1",
|
|
125
|
-
],
|
|
126
|
-
"PL": [
|
|
127
|
-
140,
|
|
128
|
-
46,
|
|
129
|
-
0,
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
"start": 1693,
|
|
134
|
-
"type": "SNV",
|
|
135
|
-
"uniqueId": "test-vcf-604551",
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"ALT": [
|
|
139
|
-
"G",
|
|
140
|
-
],
|
|
141
|
-
"CHROM": "ctgA",
|
|
142
|
-
"FILTER": null,
|
|
143
|
-
"ID": null,
|
|
144
|
-
"INFO": {
|
|
145
|
-
"AC1": [
|
|
146
|
-
1,
|
|
147
|
-
],
|
|
148
|
-
"AF1": [
|
|
149
|
-
0.5,
|
|
150
|
-
],
|
|
151
|
-
"DP": [
|
|
152
|
-
22,
|
|
153
|
-
],
|
|
154
|
-
"DP4": [
|
|
155
|
-
6,
|
|
156
|
-
5,
|
|
157
|
-
3,
|
|
158
|
-
8,
|
|
159
|
-
],
|
|
160
|
-
"FQ": [
|
|
161
|
-
45.3,
|
|
162
|
-
],
|
|
163
|
-
"MQ": [
|
|
164
|
-
37,
|
|
165
|
-
],
|
|
166
|
-
"PV4": [
|
|
167
|
-
0.39,
|
|
168
|
-
1,
|
|
169
|
-
1,
|
|
170
|
-
1,
|
|
171
|
-
],
|
|
172
|
-
"VDB": [
|
|
173
|
-
0.0253,
|
|
174
|
-
],
|
|
175
|
-
},
|
|
176
|
-
"POS": 2644,
|
|
177
|
-
"QUAL": 44,
|
|
178
|
-
"REF": "T",
|
|
179
|
-
"aliases": undefined,
|
|
180
|
-
"description": "SNV T -> G",
|
|
181
|
-
"end": 2644,
|
|
182
|
-
"name": undefined,
|
|
183
|
-
"refName": "ctgA",
|
|
184
|
-
"samples": {
|
|
185
|
-
"sample_data/raw/volvox/volvox-sorted.bam": {
|
|
186
|
-
"GQ": [
|
|
187
|
-
75,
|
|
188
|
-
],
|
|
189
|
-
"GT": [
|
|
190
|
-
"0/1",
|
|
191
|
-
],
|
|
192
|
-
"PL": [
|
|
193
|
-
74,
|
|
194
|
-
0,
|
|
195
|
-
77,
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
"start": 2643,
|
|
200
|
-
"type": "SNV",
|
|
201
|
-
"uniqueId": "test-vcf-604668",
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"ALT": [
|
|
205
|
-
"A",
|
|
206
|
-
],
|
|
207
|
-
"CHROM": "ctgA",
|
|
208
|
-
"FILTER": null,
|
|
209
|
-
"ID": null,
|
|
210
|
-
"INFO": {
|
|
211
|
-
"AC1": [
|
|
212
|
-
2,
|
|
213
|
-
],
|
|
214
|
-
"AF1": [
|
|
215
|
-
1,
|
|
216
|
-
],
|
|
217
|
-
"DP": [
|
|
218
|
-
19,
|
|
219
|
-
],
|
|
220
|
-
"DP4": [
|
|
221
|
-
0,
|
|
222
|
-
0,
|
|
223
|
-
8,
|
|
224
|
-
11,
|
|
225
|
-
],
|
|
226
|
-
"FQ": [
|
|
227
|
-
-84,
|
|
228
|
-
],
|
|
229
|
-
"MQ": [
|
|
230
|
-
36,
|
|
231
|
-
],
|
|
232
|
-
"VDB": [
|
|
233
|
-
0.0384,
|
|
234
|
-
],
|
|
235
|
-
},
|
|
236
|
-
"POS": 3213,
|
|
237
|
-
"QUAL": 124,
|
|
238
|
-
"REF": "T",
|
|
239
|
-
"aliases": undefined,
|
|
240
|
-
"description": "SNV T -> A",
|
|
241
|
-
"end": 3213,
|
|
242
|
-
"name": undefined,
|
|
243
|
-
"refName": "ctgA",
|
|
244
|
-
"samples": {
|
|
245
|
-
"sample_data/raw/volvox/volvox-sorted.bam": {
|
|
246
|
-
"GQ": [
|
|
247
|
-
99,
|
|
248
|
-
],
|
|
249
|
-
"GT": [
|
|
250
|
-
"1/1",
|
|
251
|
-
],
|
|
252
|
-
"PL": [
|
|
253
|
-
157,
|
|
254
|
-
57,
|
|
255
|
-
0,
|
|
256
|
-
],
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
"start": 3212,
|
|
260
|
-
"type": "SNV",
|
|
261
|
-
"uniqueId": "test-vcf-604785",
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
"ALT": [
|
|
265
|
-
"ct",
|
|
266
|
-
],
|
|
267
|
-
"CHROM": "ctgA",
|
|
268
|
-
"FILTER": null,
|
|
269
|
-
"ID": null,
|
|
270
|
-
"INFO": {
|
|
271
|
-
"AC1": [
|
|
272
|
-
2,
|
|
273
|
-
],
|
|
274
|
-
"AF1": [
|
|
275
|
-
1,
|
|
276
|
-
],
|
|
277
|
-
"DP": [
|
|
278
|
-
15,
|
|
279
|
-
],
|
|
280
|
-
"DP4": [
|
|
281
|
-
0,
|
|
282
|
-
0,
|
|
283
|
-
5,
|
|
284
|
-
6,
|
|
285
|
-
],
|
|
286
|
-
"FQ": [
|
|
287
|
-
-67.5,
|
|
288
|
-
],
|
|
289
|
-
"INDEL": true,
|
|
290
|
-
"MQ": [
|
|
291
|
-
37,
|
|
292
|
-
],
|
|
293
|
-
"VDB": [
|
|
294
|
-
0.0384,
|
|
295
|
-
],
|
|
296
|
-
},
|
|
297
|
-
"POS": 3858,
|
|
298
|
-
"QUAL": 160,
|
|
299
|
-
"REF": "ctt",
|
|
300
|
-
"aliases": undefined,
|
|
301
|
-
"description": "deletion ctt -> ct",
|
|
302
|
-
"end": 3860,
|
|
303
|
-
"name": undefined,
|
|
304
|
-
"refName": "ctgA",
|
|
305
|
-
"samples": {
|
|
306
|
-
"sample_data/raw/volvox/volvox-sorted.bam": {
|
|
307
|
-
"GQ": [
|
|
308
|
-
63,
|
|
309
|
-
],
|
|
310
|
-
"GT": [
|
|
311
|
-
"1/1",
|
|
312
|
-
],
|
|
313
|
-
"PL": [
|
|
314
|
-
201,
|
|
315
|
-
33,
|
|
316
|
-
0,
|
|
317
|
-
],
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
|
-
"start": 3857,
|
|
321
|
-
"type": "deletion",
|
|
322
|
-
"uniqueId": "test-vcf-604887",
|
|
323
|
-
},
|
|
324
|
-
]
|
|
325
|
-
`;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { types } from 'mobx-state-tree'
|
|
2
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* #config VcfTabixAdapter
|
|
6
|
-
*/
|
|
7
|
-
function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
8
|
-
|
|
9
|
-
const VcfTabixAdapter = ConfigurationSchema(
|
|
10
|
-
'VcfTabixAdapter',
|
|
11
|
-
{
|
|
12
|
-
/**
|
|
13
|
-
* #slot
|
|
14
|
-
*/
|
|
15
|
-
vcfGzLocation: {
|
|
16
|
-
type: 'fileLocation',
|
|
17
|
-
defaultValue: { uri: '/path/to/my.vcf.gz', locationType: 'UriLocation' },
|
|
18
|
-
},
|
|
19
|
-
index: ConfigurationSchema('VcfIndex', {
|
|
20
|
-
/**
|
|
21
|
-
* #slot index.indexType
|
|
22
|
-
*/
|
|
23
|
-
indexType: {
|
|
24
|
-
model: types.enumeration('IndexType', ['TBI', 'CSI']),
|
|
25
|
-
type: 'stringEnum',
|
|
26
|
-
defaultValue: 'TBI',
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* #slot index.location
|
|
30
|
-
*/
|
|
31
|
-
location: {
|
|
32
|
-
type: 'fileLocation',
|
|
33
|
-
defaultValue: {
|
|
34
|
-
uri: '/path/to/my.vcf.gz.tbi',
|
|
35
|
-
locationType: 'UriLocation',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
|
-
},
|
|
40
|
-
{ explicitlyTyped: true },
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
export default VcfTabixAdapter
|
|
@@ -1,17 +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 as configSchema } from './configSchema'
|
|
6
|
-
|
|
7
|
-
export default (pluginManager: PluginManager) => {
|
|
8
|
-
pluginManager.addAdapterType(
|
|
9
|
-
() =>
|
|
10
|
-
new AdapterType({
|
|
11
|
-
name: 'VcfTabixAdapter',
|
|
12
|
-
displayName: 'VCF tabix adapter',
|
|
13
|
-
configSchema,
|
|
14
|
-
getAdapterClass: () => import('./VcfTabixAdapter').then(r => r.default),
|
|
15
|
-
}),
|
|
16
|
-
)
|
|
17
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`plugin in a stock JBrowse 1`] = `{}`;
|
|
4
|
-
|
|
5
|
-
exports[`plugin in a stock JBrowse 2`] = `
|
|
6
|
-
{
|
|
7
|
-
"displays": [
|
|
8
|
-
{
|
|
9
|
-
"displayId": "trackId0-LinearVariantDisplay",
|
|
10
|
-
"type": "LinearVariantDisplay",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"displayId": "trackId0-ChordVariantDisplay",
|
|
14
|
-
"type": "ChordVariantDisplay",
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
"trackId": "trackId0",
|
|
18
|
-
"type": "VariantTrack",
|
|
19
|
-
}
|
|
20
|
-
`;
|