jbrowse-plugin-mafviewer 1.4.3 → 1.4.6
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 +1 -1
- package/dist/BigMafAdapter/BigMafAdapter.js +4 -5
- package/dist/BigMafAdapter/BigMafAdapter.js.map +1 -1
- package/dist/BigMafAdapter/configSchema.d.ts +2 -2
- package/dist/LinearMafDisplay/components/LinearMafDisplayComponent.js +39 -109
- package/dist/LinearMafDisplay/components/LinearMafDisplayComponent.js.map +1 -1
- package/dist/LinearMafDisplay/components/MAFTooltip.d.ts +0 -3
- package/dist/LinearMafDisplay/components/MAFTooltip.js.map +1 -1
- package/dist/LinearMafDisplay/components/MsaHighlightOverlay.d.ts +9 -0
- package/dist/LinearMafDisplay/components/MsaHighlightOverlay.js +34 -0
- package/dist/LinearMafDisplay/components/MsaHighlightOverlay.js.map +1 -0
- package/dist/LinearMafDisplay/components/Sidebar/ColorLegend.js +2 -2
- package/dist/LinearMafDisplay/components/Sidebar/ColorLegend.js.map +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/RectBg.d.ts +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/RectBg.js +2 -3
- package/dist/LinearMafDisplay/components/Sidebar/RectBg.js.map +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/SvgWrapper.js +81 -11
- package/dist/LinearMafDisplay/components/Sidebar/SvgWrapper.js.map +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/Tree.js +30 -9
- package/dist/LinearMafDisplay/components/Sidebar/Tree.js.map +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/YScaleBars.d.ts +0 -1
- package/dist/LinearMafDisplay/components/Sidebar/YScaleBars.js.map +1 -1
- package/dist/LinearMafDisplay/components/useDragSelection.d.ts +25 -0
- package/dist/LinearMafDisplay/components/useDragSelection.js +103 -0
- package/dist/LinearMafDisplay/components/useDragSelection.js.map +1 -0
- package/dist/LinearMafDisplay/configSchema.d.ts +3 -30
- package/dist/LinearMafDisplay/renderSvg.js +1 -1
- package/dist/LinearMafDisplay/renderSvg.js.map +1 -1
- package/dist/LinearMafDisplay/stateModel.d.ts +1090 -102
- package/dist/LinearMafDisplay/stateModel.js +156 -17
- package/dist/LinearMafDisplay/stateModel.js.map +1 -1
- package/dist/LinearMafDisplay/types.d.ts +2 -2
- package/dist/LinearMafDisplay/util.d.ts +6 -0
- package/dist/LinearMafDisplay/util.js +28 -6
- package/dist/LinearMafDisplay/util.js.map +1 -1
- package/dist/LinearMafRenderer/LinearMafRenderer.d.ts +43 -10
- package/dist/LinearMafRenderer/LinearMafRenderer.js +1 -1
- package/dist/LinearMafRenderer/LinearMafRenderer.js.map +1 -1
- package/dist/LinearMafRenderer/components/LinearMafRendering.d.ts +14 -5
- package/dist/LinearMafRenderer/components/LinearMafRendering.js +40 -20
- package/dist/LinearMafRenderer/components/LinearMafRendering.js.map +1 -1
- package/dist/LinearMafRenderer/configSchema.d.ts +1 -6
- package/dist/LinearMafRenderer/configSchema.js +1 -6
- package/dist/LinearMafRenderer/configSchema.js.map +1 -1
- package/dist/LinearMafRenderer/makeImageData.js +6 -7
- package/dist/LinearMafRenderer/makeImageData.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/features.d.ts +0 -1
- package/dist/LinearMafRenderer/rendering/features.js +1 -14
- package/dist/LinearMafRenderer/rendering/features.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/insertions.d.ts +1 -1
- package/dist/LinearMafRenderer/rendering/insertions.js +10 -8
- package/dist/LinearMafRenderer/rendering/insertions.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/matches.d.ts +1 -1
- package/dist/LinearMafRenderer/rendering/matches.js +3 -15
- package/dist/LinearMafRenderer/rendering/matches.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/mismatches.d.ts +1 -1
- package/dist/LinearMafRenderer/rendering/mismatches.js +3 -3
- package/dist/LinearMafRenderer/rendering/spatialIndex.js +8 -2
- package/dist/LinearMafRenderer/rendering/spatialIndex.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/text.js +1 -3
- package/dist/LinearMafRenderer/rendering/text.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/types.d.ts +6 -5
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js +1 -1
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js.map +1 -1
- package/dist/MafAddTrackWorkflow/index.js +1 -1
- package/dist/MafAddTrackWorkflow/index.js.map +1 -1
- package/dist/MafGetSequences/MafGetSequences.d.ts +1 -0
- package/dist/MafGetSequences/MafGetSequences.js +2 -1
- package/dist/MafGetSequences/MafGetSequences.js.map +1 -1
- package/dist/MafSequenceWidget/LabelsCanvas.d.ts +8 -0
- package/dist/MafSequenceWidget/LabelsCanvas.js +37 -0
- package/dist/MafSequenceWidget/LabelsCanvas.js.map +1 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlight.d.ts +6 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlight.js +52 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlight.js.map +1 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlightExtension.d.ts +2 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlightExtension.js +12 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlightExtension.js.map +1 -0
- package/dist/MafSequenceWidget/MafSequenceWidget.d.ts +6 -0
- package/dist/MafSequenceWidget/MafSequenceWidget.js +189 -0
- package/dist/MafSequenceWidget/MafSequenceWidget.js.map +1 -0
- package/dist/MafSequenceWidget/SequenceCanvas.d.ts +12 -0
- package/dist/MafSequenceWidget/SequenceCanvas.js +86 -0
- package/dist/MafSequenceWidget/SequenceCanvas.js.map +1 -0
- package/dist/MafSequenceWidget/SequenceDisplay.d.ts +12 -0
- package/dist/MafSequenceWidget/SequenceDisplay.js +117 -0
- package/dist/MafSequenceWidget/SequenceDisplay.js.map +1 -0
- package/dist/MafSequenceWidget/SequenceTooltip.d.ts +11 -0
- package/dist/MafSequenceWidget/SequenceTooltip.js +39 -0
- package/dist/MafSequenceWidget/SequenceTooltip.js.map +1 -0
- package/dist/MafSequenceWidget/baseColors.d.ts +3 -0
- package/dist/MafSequenceWidget/baseColors.js +64 -0
- package/dist/MafSequenceWidget/baseColors.js.map +1 -0
- package/dist/MafSequenceWidget/colToGenomePos.d.ts +13 -0
- package/dist/MafSequenceWidget/colToGenomePos.js +32 -0
- package/dist/MafSequenceWidget/colToGenomePos.js.map +1 -0
- package/dist/MafSequenceWidget/colToGenomePos.test.d.ts +1 -0
- package/dist/MafSequenceWidget/colToGenomePos.test.js +136 -0
- package/dist/MafSequenceWidget/colToGenomePos.test.js.map +1 -0
- package/dist/MafSequenceWidget/configSchema.d.ts +1 -0
- package/dist/MafSequenceWidget/configSchema.js +3 -0
- package/dist/MafSequenceWidget/configSchema.js.map +1 -0
- package/dist/MafSequenceWidget/constants.d.ts +4 -0
- package/dist/MafSequenceWidget/constants.js +5 -0
- package/dist/MafSequenceWidget/constants.js.map +1 -0
- package/dist/MafSequenceWidget/index.d.ts +2 -0
- package/dist/MafSequenceWidget/index.js +16 -0
- package/dist/MafSequenceWidget/index.js.map +1 -0
- package/dist/MafSequenceWidget/stateModelFactory.d.ts +67 -0
- package/dist/MafSequenceWidget/stateModelFactory.js +21 -0
- package/dist/MafSequenceWidget/stateModelFactory.js.map +1 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.js +4 -35
- package/dist/MafTabixAdapter/MafTabixAdapter.js.map +1 -1
- package/dist/MafTabixAdapter/configSchema.d.ts +4 -4
- package/dist/MafTrack/configSchema.d.ts +16 -11
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +12 -24
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +4 -4
- package/dist/util/clipboard.d.ts +2 -0
- package/dist/util/clipboard.js +28 -0
- package/dist/util/clipboard.js.map +1 -0
- package/dist/util/fastaUtils.d.ts +2 -1
- package/dist/util/fastaUtils.js +93 -50
- package/dist/util/fastaUtils.js.map +1 -1
- package/dist/util/fastaUtils.test.js +190 -0
- package/dist/util/fastaUtils.test.js.map +1 -1
- package/dist/util/parseAssemblyName.d.ts +32 -0
- package/dist/util/parseAssemblyName.js +87 -0
- package/dist/util/parseAssemblyName.js.map +1 -0
- package/dist/util/parseAssemblyName.test.d.ts +1 -0
- package/dist/util/parseAssemblyName.test.js +269 -0
- package/dist/util/parseAssemblyName.test.js.map +1 -0
- package/package.json +12 -12
- package/src/BigMafAdapter/BigMafAdapter.ts +5 -5
- package/src/LinearMafDisplay/components/LinearMafDisplayComponent.tsx +63 -145
- package/src/LinearMafDisplay/components/MAFTooltip.tsx +0 -3
- package/src/LinearMafDisplay/components/MsaHighlightOverlay.tsx +62 -0
- package/src/LinearMafDisplay/components/Sidebar/ColorLegend.tsx +2 -6
- package/src/LinearMafDisplay/components/Sidebar/RectBg.tsx +8 -3
- package/src/LinearMafDisplay/components/Sidebar/SvgWrapper.tsx +117 -15
- package/src/LinearMafDisplay/components/Sidebar/Tree.tsx +53 -8
- package/src/LinearMafDisplay/components/Sidebar/YScaleBars.tsx +0 -1
- package/src/LinearMafDisplay/components/useDragSelection.ts +159 -0
- package/src/LinearMafDisplay/renderSvg.tsx +1 -1
- package/src/LinearMafDisplay/stateModel.ts +215 -20
- package/src/LinearMafDisplay/types.ts +2 -2
- package/src/LinearMafDisplay/util.ts +35 -7
- package/src/LinearMafRenderer/LinearMafRenderer.ts +3 -5
- package/src/LinearMafRenderer/components/LinearMafRendering.tsx +67 -33
- package/src/LinearMafRenderer/configSchema.ts +1 -6
- package/src/LinearMafRenderer/makeImageData.ts +5 -14
- package/src/LinearMafRenderer/rendering/features.ts +2 -36
- package/src/LinearMafRenderer/rendering/insertions.ts +13 -8
- package/src/LinearMafRenderer/rendering/matches.ts +2 -27
- package/src/LinearMafRenderer/rendering/mismatches.ts +3 -3
- package/src/LinearMafRenderer/rendering/spatialIndex.ts +9 -2
- package/src/LinearMafRenderer/rendering/text.ts +1 -2
- package/src/LinearMafRenderer/rendering/types.ts +8 -5
- package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +1 -1
- package/src/MafAddTrackWorkflow/index.ts +1 -1
- package/src/MafGetSequences/MafGetSequences.ts +10 -2
- package/src/MafSequenceWidget/LabelsCanvas.tsx +58 -0
- package/src/MafSequenceWidget/MafSequenceHoverHighlight.tsx +83 -0
- package/src/MafSequenceWidget/MafSequenceHoverHighlightExtension.tsx +24 -0
- package/src/MafSequenceWidget/MafSequenceWidget.tsx +294 -0
- package/src/MafSequenceWidget/SequenceCanvas.tsx +136 -0
- package/src/MafSequenceWidget/SequenceDisplay.tsx +188 -0
- package/src/MafSequenceWidget/SequenceTooltip.tsx +70 -0
- package/src/MafSequenceWidget/baseColors.ts +76 -0
- package/src/MafSequenceWidget/colToGenomePos.test.ts +166 -0
- package/src/MafSequenceWidget/colToGenomePos.ts +40 -0
- package/src/MafSequenceWidget/configSchema.ts +3 -0
- package/src/MafSequenceWidget/constants.ts +4 -0
- package/src/MafSequenceWidget/index.ts +24 -0
- package/src/MafSequenceWidget/stateModelFactory.ts +43 -0
- package/src/MafTabixAdapter/MafTabixAdapter.ts +12 -51
- package/src/index.ts +2 -0
- package/src/util/__snapshots__/fastaUtils.test.ts.snap +35 -0
- package/src/util/clipboard.ts +35 -0
- package/src/util/fastaUtils.test.ts +199 -0
- package/src/util/fastaUtils.ts +118 -51
- package/src/util/parseAssemblyName.test.ts +350 -0
- package/src/util/parseAssemblyName.ts +106 -0
- package/dist/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.d.ts +0 -11
- package/dist/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.js +0 -97
- package/dist/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.js.map +0 -1
- package/dist/LinearMafDisplay/components/util.d.ts +0 -1
- package/dist/LinearMafDisplay/components/util.js +0 -8
- package/dist/LinearMafDisplay/components/util.js.map +0 -1
- package/dist/LinearMafRenderer/components/util.d.ts +0 -1
- package/dist/LinearMafRenderer/components/util.js +0 -13
- package/dist/LinearMafRenderer/components/util.js.map +0 -1
- package/dist/util/fetchSequences.d.ts +0 -18
- package/dist/util/fetchSequences.js +0 -39
- package/dist/util/fetchSequences.js.map +0 -1
- package/dist/util/useSequences.d.ts +0 -21
- package/dist/util/useSequences.js +0 -64
- package/dist/util/useSequences.js.map +0 -1
- package/src/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.tsx +0 -175
- package/src/LinearMafDisplay/components/util.ts +0 -7
- package/src/LinearMafRenderer/components/util.ts +0 -13
- package/src/util/fetchSequences.ts +0 -57
- package/src/util/useSequences.ts +0 -90
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
parseAssemblyAndChr,
|
|
5
|
+
parseAssemblyAndChrSimple,
|
|
6
|
+
selectReferenceSequence,
|
|
7
|
+
} from './parseAssemblyName'
|
|
8
|
+
|
|
9
|
+
describe('parseAssemblyAndChr (MafTabix format)', () => {
|
|
10
|
+
test('no dot - entire string is assembly name', () => {
|
|
11
|
+
const result = parseAssemblyAndChr('hg38')
|
|
12
|
+
expect(result).toEqual({
|
|
13
|
+
assemblyName: 'hg38',
|
|
14
|
+
chr: '',
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('single dot - simple assembly.chr format', () => {
|
|
19
|
+
const result = parseAssemblyAndChr('hg38.chr1')
|
|
20
|
+
expect(result).toEqual({
|
|
21
|
+
assemblyName: 'hg38',
|
|
22
|
+
chr: 'chr1',
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test('single dot - assembly.refName format with non-chr name', () => {
|
|
27
|
+
const result = parseAssemblyAndChr('mm10.scaffold_1')
|
|
28
|
+
expect(result).toEqual({
|
|
29
|
+
assemblyName: 'mm10',
|
|
30
|
+
chr: 'scaffold_1',
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('two dots with numeric version - assembly.version.chr format', () => {
|
|
35
|
+
const result = parseAssemblyAndChr('hg38.1.chr1')
|
|
36
|
+
expect(result).toEqual({
|
|
37
|
+
assemblyName: 'hg38.1',
|
|
38
|
+
chr: 'chr1',
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
test('two dots with multi-digit numeric version', () => {
|
|
43
|
+
const result = parseAssemblyAndChr('GRCh38.123.chrX')
|
|
44
|
+
expect(result).toEqual({
|
|
45
|
+
assemblyName: 'GRCh38.123',
|
|
46
|
+
chr: 'chrX',
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
test('two dots with non-numeric middle - assembly.chr.more format', () => {
|
|
51
|
+
const result = parseAssemblyAndChr('mm10.chr1.random')
|
|
52
|
+
expect(result).toEqual({
|
|
53
|
+
assemblyName: 'mm10',
|
|
54
|
+
chr: 'chr1.random',
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test('two dots with non-numeric middle - chr_Un type naming', () => {
|
|
59
|
+
const result = parseAssemblyAndChr('hg38.chrUn_gl000220')
|
|
60
|
+
expect(result).toEqual({
|
|
61
|
+
assemblyName: 'hg38',
|
|
62
|
+
chr: 'chrUn_gl000220',
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test('three dots with numeric version - assembly.version.chr.more format', () => {
|
|
67
|
+
const result = parseAssemblyAndChr('GRCh38.1.chr1.random')
|
|
68
|
+
expect(result).toEqual({
|
|
69
|
+
assemblyName: 'GRCh38.1',
|
|
70
|
+
chr: 'chr1.random',
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
test('empty string', () => {
|
|
75
|
+
const result = parseAssemblyAndChr('')
|
|
76
|
+
expect(result).toEqual({
|
|
77
|
+
assemblyName: '',
|
|
78
|
+
chr: '',
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
test('just a dot', () => {
|
|
83
|
+
const result = parseAssemblyAndChr('.')
|
|
84
|
+
expect(result).toEqual({
|
|
85
|
+
assemblyName: '',
|
|
86
|
+
chr: '',
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
test('leading dot', () => {
|
|
91
|
+
const result = parseAssemblyAndChr('.chr1')
|
|
92
|
+
expect(result).toEqual({
|
|
93
|
+
assemblyName: '',
|
|
94
|
+
chr: 'chr1',
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
test('trailing dot', () => {
|
|
99
|
+
const result = parseAssemblyAndChr('hg38.')
|
|
100
|
+
expect(result).toEqual({
|
|
101
|
+
assemblyName: 'hg38',
|
|
102
|
+
chr: '',
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
test('real world example - UCSC style', () => {
|
|
107
|
+
const result = parseAssemblyAndChr('hg19.chr6_ssto_hap7')
|
|
108
|
+
expect(result).toEqual({
|
|
109
|
+
assemblyName: 'hg19',
|
|
110
|
+
chr: 'chr6_ssto_hap7',
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
test('real world example - Ensembl style with numeric', () => {
|
|
115
|
+
const result = parseAssemblyAndChr('GRCh37.1.1')
|
|
116
|
+
expect(result).toEqual({
|
|
117
|
+
assemblyName: 'GRCh37.1',
|
|
118
|
+
chr: '1',
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
describe('parseAssemblyAndChrSimple (BigMaf format)', () => {
|
|
124
|
+
test('no dot - entire string is assembly name', () => {
|
|
125
|
+
const result = parseAssemblyAndChrSimple('hg38')
|
|
126
|
+
expect(result).toEqual({
|
|
127
|
+
assemblyName: 'hg38',
|
|
128
|
+
chr: '',
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
test('single dot - simple org.chr format', () => {
|
|
133
|
+
const result = parseAssemblyAndChrSimple('hg38.chr1')
|
|
134
|
+
expect(result).toEqual({
|
|
135
|
+
assemblyName: 'hg38',
|
|
136
|
+
chr: 'chr1',
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
test('multiple dots - only splits on first dot', () => {
|
|
141
|
+
const result = parseAssemblyAndChrSimple('mm10.chr1.random')
|
|
142
|
+
expect(result).toEqual({
|
|
143
|
+
assemblyName: 'mm10',
|
|
144
|
+
chr: 'chr1.random',
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
test('empty string', () => {
|
|
149
|
+
const result = parseAssemblyAndChrSimple('')
|
|
150
|
+
expect(result).toEqual({
|
|
151
|
+
assemblyName: '',
|
|
152
|
+
chr: '',
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
describe('selectReferenceSequence', () => {
|
|
158
|
+
const alignments = {
|
|
159
|
+
hg38: { seq: 'ACGTACGT' },
|
|
160
|
+
mm10: { seq: 'TGCATGCA' },
|
|
161
|
+
panTro6: { seq: 'GGGGGGGG' },
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
test('uses refAssemblyName when provided and exists', () => {
|
|
165
|
+
const result = selectReferenceSequence(
|
|
166
|
+
alignments,
|
|
167
|
+
'mm10',
|
|
168
|
+
'hg38',
|
|
169
|
+
'panTro6',
|
|
170
|
+
)
|
|
171
|
+
expect(result).toBe('TGCATGCA')
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
test('falls back to queryAssemblyName when refAssemblyName is empty', () => {
|
|
175
|
+
const result = selectReferenceSequence(alignments, '', 'hg38', 'panTro6')
|
|
176
|
+
expect(result).toBe('ACGTACGT')
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
test('falls back to queryAssemblyName when refAssemblyName is undefined', () => {
|
|
180
|
+
const result = selectReferenceSequence(
|
|
181
|
+
alignments,
|
|
182
|
+
undefined,
|
|
183
|
+
'hg38',
|
|
184
|
+
'panTro6',
|
|
185
|
+
)
|
|
186
|
+
expect(result).toBe('ACGTACGT')
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
test('falls back to firstAssemblyNameFound when queryAssemblyName does not match', () => {
|
|
190
|
+
const result = selectReferenceSequence(
|
|
191
|
+
alignments,
|
|
192
|
+
undefined,
|
|
193
|
+
'galGal6', // not in alignments
|
|
194
|
+
'hg38',
|
|
195
|
+
)
|
|
196
|
+
expect(result).toBe('ACGTACGT')
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
test('falls back to firstAssemblyNameFound when both config values are empty', () => {
|
|
200
|
+
const result = selectReferenceSequence(alignments, '', '', 'panTro6')
|
|
201
|
+
expect(result).toBe('GGGGGGGG')
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
test('returns undefined when refAssemblyName does not exist in alignments', () => {
|
|
205
|
+
const result = selectReferenceSequence(
|
|
206
|
+
alignments,
|
|
207
|
+
'nonexistent',
|
|
208
|
+
undefined,
|
|
209
|
+
undefined,
|
|
210
|
+
)
|
|
211
|
+
expect(result).toBeUndefined()
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
test('returns undefined when no matches and all params undefined', () => {
|
|
215
|
+
const result = selectReferenceSequence(
|
|
216
|
+
alignments,
|
|
217
|
+
undefined,
|
|
218
|
+
undefined,
|
|
219
|
+
undefined,
|
|
220
|
+
)
|
|
221
|
+
expect(result).toBeUndefined()
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
test('returns undefined for empty alignments object', () => {
|
|
225
|
+
const result = selectReferenceSequence({}, 'hg38', 'mm10', 'panTro6')
|
|
226
|
+
expect(result).toBeUndefined()
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
test('skips refAssemblyName when it does not exist and uses queryAssemblyName', () => {
|
|
230
|
+
const result = selectReferenceSequence(
|
|
231
|
+
alignments,
|
|
232
|
+
'galGal6', // not in alignments
|
|
233
|
+
'hg38',
|
|
234
|
+
'panTro6',
|
|
235
|
+
)
|
|
236
|
+
expect(result).toBe('ACGTACGT')
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
test('skips both refAssemblyName and queryAssemblyName when neither exists', () => {
|
|
240
|
+
const result = selectReferenceSequence(
|
|
241
|
+
alignments,
|
|
242
|
+
'galGal6', // not in alignments
|
|
243
|
+
'rn6', // not in alignments
|
|
244
|
+
'mm10',
|
|
245
|
+
)
|
|
246
|
+
expect(result).toBe('TGCATGCA')
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
describe('assembly name lookup integration scenarios', () => {
|
|
251
|
+
test('refAssemblyName config takes precedence over query.assemblyName', () => {
|
|
252
|
+
const alignments = {
|
|
253
|
+
hg38: { seq: 'REFERENCE_SEQ' },
|
|
254
|
+
mm10: { seq: 'QUERY_SEQ' },
|
|
255
|
+
}
|
|
256
|
+
const result = selectReferenceSequence(alignments, 'hg38', 'mm10', 'mm10')
|
|
257
|
+
expect(result).toBe('REFERENCE_SEQ')
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
test('query.assemblyName works when refAssemblyName not configured', () => {
|
|
261
|
+
const alignments = {
|
|
262
|
+
hg38: { seq: 'QUERY_SEQ' },
|
|
263
|
+
mm10: { seq: 'OTHER_SEQ' },
|
|
264
|
+
}
|
|
265
|
+
const result = selectReferenceSequence(alignments, '', 'hg38', 'mm10')
|
|
266
|
+
expect(result).toBe('QUERY_SEQ')
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
test('firstAssemblyNameFound is used as last resort fallback', () => {
|
|
270
|
+
const alignments = {
|
|
271
|
+
panTro6: { seq: 'FIRST_FOUND' },
|
|
272
|
+
mm10: { seq: 'OTHER_SEQ' },
|
|
273
|
+
}
|
|
274
|
+
// When query assemblyName does not match any alignment
|
|
275
|
+
const result = selectReferenceSequence(alignments, '', 'hg38', 'panTro6')
|
|
276
|
+
expect(result).toBe('FIRST_FOUND')
|
|
277
|
+
})
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
describe('real-world MAF format parsing', () => {
|
|
281
|
+
test('ce10.chrI from UCSC 7-way alignment', () => {
|
|
282
|
+
const result = parseAssemblyAndChr('ce10.chrI')
|
|
283
|
+
expect(result).toEqual({
|
|
284
|
+
assemblyName: 'ce10',
|
|
285
|
+
chr: 'chrI',
|
|
286
|
+
})
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
test('caePb3.Scfld02_18 scaffold format', () => {
|
|
290
|
+
const result = parseAssemblyAndChr('caePb3.Scfld02_18')
|
|
291
|
+
expect(result).toEqual({
|
|
292
|
+
assemblyName: 'caePb3',
|
|
293
|
+
chr: 'Scfld02_18',
|
|
294
|
+
})
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
test('caeRem4.Crem_Contig16 contig format', () => {
|
|
298
|
+
const result = parseAssemblyAndChr('caeRem4.Crem_Contig16')
|
|
299
|
+
expect(result).toEqual({
|
|
300
|
+
assemblyName: 'caeRem4',
|
|
301
|
+
chr: 'Crem_Contig16',
|
|
302
|
+
})
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
test('cb4.chrI C. briggsae format', () => {
|
|
306
|
+
const result = parseAssemblyAndChr('cb4.chrI')
|
|
307
|
+
expect(result).toEqual({
|
|
308
|
+
assemblyName: 'cb4',
|
|
309
|
+
chr: 'chrI',
|
|
310
|
+
})
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
test('multiple assemblies from same MAF block produce correct lookup', () => {
|
|
314
|
+
const alignments = {
|
|
315
|
+
ce10: { seq: 'TCTTTTAGTATTTGTAA' },
|
|
316
|
+
caePb3: { seq: 'tcTTTTCGC-TTTATAA' },
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// When querying with ce10 assembly
|
|
320
|
+
expect(selectReferenceSequence(alignments, '', 'ce10', 'ce10')).toBe(
|
|
321
|
+
'TCTTTTAGTATTTGTAA',
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
// When refAssemblyName is configured to override
|
|
325
|
+
expect(selectReferenceSequence(alignments, 'caePb3', 'ce10', 'ce10')).toBe(
|
|
326
|
+
'tcTTTTCGC-TTTATAA',
|
|
327
|
+
)
|
|
328
|
+
})
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
describe('refName renaming compatibility', () => {
|
|
332
|
+
test('parseAssemblyAndChr extracts chr correctly for refName alias matching', () => {
|
|
333
|
+
// When a file uses "chrI" but assembly has alias "I" -> "chrI"
|
|
334
|
+
// The chr portion extracted here should match what renameRegionsIfNeeded expects
|
|
335
|
+
const { chr } = parseAssemblyAndChr('ce10.chrI')
|
|
336
|
+
expect(chr).toBe('chrI')
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
test('parseAssemblyAndChrSimple extracts chr correctly for refName alias matching', () => {
|
|
340
|
+
const { chr } = parseAssemblyAndChrSimple('ce10.chrI')
|
|
341
|
+
expect(chr).toBe('chrI')
|
|
342
|
+
})
|
|
343
|
+
|
|
344
|
+
test('assembly name is isolated from chr for assembly-based lookups', () => {
|
|
345
|
+
// The assembly name (e.g., "ce10") is used to look up reference sequence
|
|
346
|
+
// It should not include the chr portion
|
|
347
|
+
const { assemblyName } = parseAssemblyAndChr('ce10.chrI')
|
|
348
|
+
expect(assemblyName).toBe('ce10')
|
|
349
|
+
})
|
|
350
|
+
})
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export interface ParsedAssemblyName {
|
|
2
|
+
assemblyName: string
|
|
3
|
+
chr: string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Parses assembly name and chromosome from a combined string in MAF tabix format.
|
|
8
|
+
*
|
|
9
|
+
* Handles multiple formats:
|
|
10
|
+
* - Single string with no dots: assemblyName is the entire string, chr is empty
|
|
11
|
+
* - `assembly.chr`: Single dot separates assembly name from chromosome
|
|
12
|
+
* - `assembly.version.chr`: Two dots where middle part is numeric (version number)
|
|
13
|
+
* - assemblyName includes the version (e.g., "hg38.1" from "hg38.1.chr1")
|
|
14
|
+
* - `assembly.chr.more`: Two dots where middle part is non-numeric
|
|
15
|
+
* - assemblyName is first part, chr includes rest (e.g., "mm10" and "chr1.random")
|
|
16
|
+
*/
|
|
17
|
+
export function parseAssemblyAndChr(
|
|
18
|
+
assemblyAndChr: string,
|
|
19
|
+
): ParsedAssemblyName {
|
|
20
|
+
const firstDotIndex = assemblyAndChr.indexOf('.')
|
|
21
|
+
if (firstDotIndex === -1) {
|
|
22
|
+
return {
|
|
23
|
+
assemblyName: assemblyAndChr,
|
|
24
|
+
chr: '',
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const secondDotIndex = assemblyAndChr.indexOf('.', firstDotIndex + 1)
|
|
29
|
+
if (secondDotIndex === -1) {
|
|
30
|
+
return {
|
|
31
|
+
assemblyName: assemblyAndChr.slice(0, firstDotIndex),
|
|
32
|
+
chr: assemblyAndChr.slice(firstDotIndex + 1),
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const secondPart = assemblyAndChr.slice(firstDotIndex + 1, secondDotIndex)
|
|
37
|
+
const isNumeric = secondPart.length > 0 && !Number.isNaN(+secondPart)
|
|
38
|
+
|
|
39
|
+
if (isNumeric) {
|
|
40
|
+
return {
|
|
41
|
+
assemblyName: assemblyAndChr.slice(0, secondDotIndex),
|
|
42
|
+
chr: assemblyAndChr.slice(secondDotIndex + 1),
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
assemblyName: assemblyAndChr.slice(0, firstDotIndex),
|
|
48
|
+
chr: assemblyAndChr.slice(firstDotIndex + 1),
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Parses assembly name and chromosome from a combined string in BigMaf format.
|
|
54
|
+
*
|
|
55
|
+
* Uses simple dot splitting: org.chr where org is before the first dot,
|
|
56
|
+
* chr is everything after the first dot.
|
|
57
|
+
*/
|
|
58
|
+
export function parseAssemblyAndChrSimple(
|
|
59
|
+
organismChr: string,
|
|
60
|
+
): ParsedAssemblyName {
|
|
61
|
+
const dotIndex = organismChr.indexOf('.')
|
|
62
|
+
if (dotIndex === -1) {
|
|
63
|
+
return {
|
|
64
|
+
assemblyName: organismChr,
|
|
65
|
+
chr: '',
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
assemblyName: organismChr.slice(0, dotIndex),
|
|
70
|
+
chr: organismChr.slice(dotIndex + 1),
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Selects the appropriate sequence from alignments based on the lookup order:
|
|
76
|
+
* 1. refAssemblyName config value (if provided)
|
|
77
|
+
* 2. query.assemblyName (from the region being queried)
|
|
78
|
+
* 3. firstAssemblyNameFound (fallback to first assembly in data)
|
|
79
|
+
*/
|
|
80
|
+
export function selectReferenceSequence(
|
|
81
|
+
alignments: Record<string, { seq: string }>,
|
|
82
|
+
refAssemblyName: string | undefined,
|
|
83
|
+
queryAssemblyName: string | undefined,
|
|
84
|
+
firstAssemblyNameFound: string | undefined,
|
|
85
|
+
): string | undefined {
|
|
86
|
+
let entry
|
|
87
|
+
if (refAssemblyName) {
|
|
88
|
+
entry = alignments[refAssemblyName]
|
|
89
|
+
if (entry) {
|
|
90
|
+
return entry.seq
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (queryAssemblyName) {
|
|
94
|
+
entry = alignments[queryAssemblyName]
|
|
95
|
+
if (entry) {
|
|
96
|
+
return entry.seq
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (firstAssemblyNameFound) {
|
|
100
|
+
entry = alignments[firstAssemblyNameFound]
|
|
101
|
+
if (entry) {
|
|
102
|
+
return entry.seq
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return undefined
|
|
106
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { LinearMafDisplayModel } from '../../stateModel';
|
|
3
|
-
declare const GetSequenceDialog: ({ onClose, model, selectionCoords, }: {
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
model: LinearMafDisplayModel;
|
|
6
|
-
selectionCoords?: {
|
|
7
|
-
dragStartX: number;
|
|
8
|
-
dragEndX: number;
|
|
9
|
-
};
|
|
10
|
-
}) => React.JSX.Element;
|
|
11
|
-
export default GetSequenceDialog;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Dialog, ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
|
|
3
|
-
import { getSession } from '@jbrowse/core/util';
|
|
4
|
-
import { Button, DialogActions, DialogContent, TextField, ToggleButton, ToggleButtonGroup, } from '@mui/material';
|
|
5
|
-
import { observer } from 'mobx-react';
|
|
6
|
-
import { makeStyles } from 'tss-react/mui';
|
|
7
|
-
import { useSequences } from '../../../util/useSequences';
|
|
8
|
-
const useStyles = makeStyles()({
|
|
9
|
-
dialogContent: {
|
|
10
|
-
width: '80em',
|
|
11
|
-
},
|
|
12
|
-
textAreaInput: {
|
|
13
|
-
fontFamily: 'monospace',
|
|
14
|
-
whiteSpace: 'pre',
|
|
15
|
-
overflowX: 'auto',
|
|
16
|
-
},
|
|
17
|
-
ml: {
|
|
18
|
-
marginLeft: 10,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
const GetSequenceDialog = observer(function ({ onClose, model, selectionCoords, }) {
|
|
22
|
-
const [showAllLetters, setShowAllLetters] = useState(true);
|
|
23
|
-
const { classes } = useStyles();
|
|
24
|
-
const { sequence, loading, error } = useSequences({
|
|
25
|
-
model,
|
|
26
|
-
selectionCoords,
|
|
27
|
-
showAllLetters,
|
|
28
|
-
});
|
|
29
|
-
const sequenceTooLarge = sequence ? sequence.length > 1_000_000 : false;
|
|
30
|
-
return (React.createElement(Dialog, { open: true, onClose: onClose, title: "Subsequence Data", maxWidth: "xl" },
|
|
31
|
-
React.createElement(DialogContent, null,
|
|
32
|
-
React.createElement("div", { style: {
|
|
33
|
-
display: 'flex',
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
marginBottom: '16px',
|
|
36
|
-
} },
|
|
37
|
-
React.createElement(ToggleButtonGroup, { value: showAllLetters, exclusive: true, size: "small", onChange: (_event, newDisplayMode) => {
|
|
38
|
-
if (newDisplayMode !== null) {
|
|
39
|
-
setShowAllLetters(newDisplayMode);
|
|
40
|
-
}
|
|
41
|
-
} },
|
|
42
|
-
React.createElement(ToggleButton, { value: true }, "Show All Letters"),
|
|
43
|
-
React.createElement(ToggleButton, { value: false }, "Show Only Differences")),
|
|
44
|
-
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
45
|
-
React.createElement(Button, { variant: "contained", color: "primary", disabled: loading || !sequence, onClick: () => {
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
47
|
-
;
|
|
48
|
-
(async () => {
|
|
49
|
-
try {
|
|
50
|
-
await navigator.clipboard.writeText(sequence);
|
|
51
|
-
getSession(model).notify('Sequence copied to clipboard', 'info');
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
console.error(e);
|
|
55
|
-
getSession(model).notifyError(`${e}`, e);
|
|
56
|
-
}
|
|
57
|
-
})();
|
|
58
|
-
} }, "Copy to Clipboard"),
|
|
59
|
-
React.createElement(Button, { variant: "contained", color: "secondary", disabled: loading || !sequence, onClick: () => {
|
|
60
|
-
try {
|
|
61
|
-
const url = URL.createObjectURL(new Blob([sequence], { type: 'text/plain' }));
|
|
62
|
-
// Create a temporary anchor element
|
|
63
|
-
const a = document.createElement('a');
|
|
64
|
-
a.href = url;
|
|
65
|
-
a.download = 'sequence.fasta';
|
|
66
|
-
// Trigger the download
|
|
67
|
-
document.body.append(a);
|
|
68
|
-
a.click();
|
|
69
|
-
// Clean up
|
|
70
|
-
a.remove();
|
|
71
|
-
URL.revokeObjectURL(url);
|
|
72
|
-
getSession(model).notify('Sequence downloaded', 'info');
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
console.error(e);
|
|
76
|
-
getSession(model).notifyError(`${e}`, e);
|
|
77
|
-
}
|
|
78
|
-
} }, "Download")),
|
|
79
|
-
error ? (React.createElement(ErrorMessage, { error: error })) : (React.createElement(React.Fragment, null,
|
|
80
|
-
loading ? React.createElement(LoadingEllipses, null) : null,
|
|
81
|
-
React.createElement(TextField, { variant: "outlined", multiline: true, minRows: 5, maxRows: 10, disabled: sequenceTooLarge, className: classes.dialogContent, fullWidth: true, value: loading
|
|
82
|
-
? 'Loading...'
|
|
83
|
-
: sequenceTooLarge
|
|
84
|
-
? 'Reference sequence too large to display, use the download FASTA button'
|
|
85
|
-
: sequence, slotProps: {
|
|
86
|
-
input: {
|
|
87
|
-
readOnly: true,
|
|
88
|
-
classes: {
|
|
89
|
-
input: classes.textAreaInput,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
} })))),
|
|
93
|
-
React.createElement(DialogActions, null,
|
|
94
|
-
React.createElement(Button, { color: "primary", variant: "outlined", onClick: onClose }, "Close"))));
|
|
95
|
-
});
|
|
96
|
-
export default GetSequenceDialog;
|
|
97
|
-
//# sourceMappingURL=GetSequenceDialog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetSequenceDialog.js","sourceRoot":"","sources":["../../../../src/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EACL,MAAM,EACN,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,iBAAiB,GAClB,MAAM,eAAe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AAO,EAAE;gCACP,KAAK,EAAE,OAAO,CAAC,aAAa;6BAC7B;yBACF;qBACF,GACD,CACD,CACJ,CACa;QAChB,oBAAC,aAAa;YACZ,oBAAC,MAAM,IAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAC,UAAU,EAAC,OAAO,EAAE,OAAO,YAElD,CACK,CACT,CACV,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,iBAAiB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function max(arr: number[], init?: number): number;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/LinearMafDisplay/components/util.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,CAAC,GAAa,EAAE,IAAI,GAAG,MAAM,CAAC,iBAAiB;IAChE,IAAI,GAAG,GAAG,IAAI,CAAA;IACd,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACxB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function minElt<T>(arr: Iterable<T>, cb: (arg: T) => number): T | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/LinearMafRenderer/components/util.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAI,GAAgB,EAAE,EAAsB;IAChE,IAAI,GAAG,GAAG,QAAQ,CAAA;IAClB,IAAI,UAAyB,CAAA;IAC7B,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACxB,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;QAErB,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;YACd,GAAG,GAAG,GAAG,CAAA;YACT,UAAU,GAAG,KAAK,CAAA;QACpB,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { LinearMafDisplayModel } from '../LinearMafDisplay/stateModel';
|
|
2
|
-
interface SelectionCoords {
|
|
3
|
-
dragStartX: number;
|
|
4
|
-
dragEndX: number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Fetch sequences for the given selection coordinates
|
|
8
|
-
* @param model - The LinearMafDisplayModel
|
|
9
|
-
* @param selectionCoords - The selection coordinates (dragStartX and dragEndX)
|
|
10
|
-
* @param showAllLetters - Whether to show all letters or just the differences
|
|
11
|
-
* @returns Promise that resolves to the FASTA sequence
|
|
12
|
-
*/
|
|
13
|
-
export declare function fetchSequences({ model, selectionCoords, showAllLetters, }: {
|
|
14
|
-
model: LinearMafDisplayModel;
|
|
15
|
-
selectionCoords: SelectionCoords;
|
|
16
|
-
showAllLetters: boolean;
|
|
17
|
-
}): Promise<string>;
|
|
18
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { getContainingView, getSession } from '@jbrowse/core/util';
|
|
2
|
-
import { getRpcSessionId } from '@jbrowse/core/util/tracks';
|
|
3
|
-
/**
|
|
4
|
-
* Fetch sequences for the given selection coordinates
|
|
5
|
-
* @param model - The LinearMafDisplayModel
|
|
6
|
-
* @param selectionCoords - The selection coordinates (dragStartX and dragEndX)
|
|
7
|
-
* @param showAllLetters - Whether to show all letters or just the differences
|
|
8
|
-
* @returns Promise that resolves to the FASTA sequence
|
|
9
|
-
*/
|
|
10
|
-
export async function fetchSequences({ model, selectionCoords, showAllLetters, }) {
|
|
11
|
-
const { samples, adapterConfig } = model;
|
|
12
|
-
const { rpcManager } = getSession(model);
|
|
13
|
-
const sessionId = getRpcSessionId(model);
|
|
14
|
-
const view = getContainingView(model);
|
|
15
|
-
const { refName, assemblyName } = view.displayedRegions[0];
|
|
16
|
-
const { dragStartX, dragEndX } = selectionCoords;
|
|
17
|
-
const [s, e] = [
|
|
18
|
-
Math.min(dragStartX, dragEndX),
|
|
19
|
-
Math.max(dragStartX, dragEndX),
|
|
20
|
-
];
|
|
21
|
-
const fastaSequence = (await rpcManager.call(sessionId, 'MafGetSequences', {
|
|
22
|
-
sessionId,
|
|
23
|
-
adapterConfig,
|
|
24
|
-
samples,
|
|
25
|
-
showAllLetters,
|
|
26
|
-
regions: [
|
|
27
|
-
{
|
|
28
|
-
refName,
|
|
29
|
-
start: view.pxToBp(s).coord - 1,
|
|
30
|
-
end: view.pxToBp(e).coord,
|
|
31
|
-
assemblyName,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
}));
|
|
35
|
-
return fastaSequence
|
|
36
|
-
.map((r, idx) => `>${samples[idx].label}\n${r}`)
|
|
37
|
-
.join('\n');
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=fetchSequences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchSequences.js","sourceRoot":"","sources":["../../src/util/fetchSequences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAU3D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,KAAK,EACL,eAAe,EACf,cAAc,GAKf;IACC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK,CAAA;IACxC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IACxC,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IACxC,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAA0B,CAAA;IAC9D,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAE,CAAA;IAC3D,MAAM,EAAE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