jbrowse-plugin-msaview 2.4.4 → 2.5.0
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/AddHighlightModel/GenomeMouseoverHighlight.js +2 -2
- package/dist/AddHighlightModel/HighlightComponents.js +0 -1
- package/dist/AddHighlightModel/MsaToGenomeHighlight.js +5 -3
- package/dist/AddHighlightModel/index.js +2 -2
- package/dist/AddHighlightModel/util.d.ts +1 -6
- package/dist/AddHighlightModel/util.js +1 -7
- package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.js +0 -1
- package/dist/BgzipFastaMsaAdapter/configSchema.js +0 -1
- package/dist/BgzipFastaMsaAdapter/index.js +0 -1
- package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +0 -1
- package/dist/LaunchMsaView/components/LaunchPanelContent.js +0 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +0 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/fetchGeneList.js +0 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/launchView.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/MsaAlgorithmSelect.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js +0 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +0 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.js +0 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.js +0 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/types.js +0 -1
- package/dist/LaunchMsaView/components/SubmitCancelActions.js +0 -1
- package/dist/LaunchMsaView/components/TabPanel.js +1 -2
- package/dist/LaunchMsaView/components/TranscriptSelector.js +0 -1
- package/dist/LaunchMsaView/components/calculateProteinSequence.js +0 -1
- package/dist/LaunchMsaView/components/fetchSeq.js +0 -1
- package/dist/LaunchMsaView/components/types.js +0 -1
- package/dist/LaunchMsaView/components/useFeatureSequence.js +0 -1
- package/dist/LaunchMsaView/components/useSWRFeatureSequence.js +0 -1
- package/dist/LaunchMsaView/components/useTranscriptSelection.js +0 -1
- package/dist/LaunchMsaView/components/util.js +0 -1
- package/dist/LaunchMsaView/index.js +0 -1
- package/dist/LaunchMsaView/util.js +1 -2
- package/dist/LaunchMsaViewExtensionPoint/index.js +0 -1
- package/dist/MsaViewPanel/afterCreateAutoruns.d.ts +8 -1
- package/dist/MsaViewPanel/afterCreateAutoruns.js +25 -21
- package/dist/MsaViewPanel/blosum62.js +0 -1
- package/dist/MsaViewPanel/components/ConnectStructureDialog.js +0 -1
- package/dist/MsaViewPanel/components/ErrorBoundary.d.ts +1 -1
- package/dist/MsaViewPanel/components/ErrorBoundary.js +0 -1
- package/dist/MsaViewPanel/components/LoadingBLAST.js +0 -1
- package/dist/MsaViewPanel/components/MsaViewPanel.js +0 -1
- package/dist/MsaViewPanel/components/RIDLink.js +0 -1
- package/dist/MsaViewPanel/doLaunchBlast.js +0 -1
- package/dist/MsaViewPanel/genomeToMSA.d.ts +0 -6
- package/dist/MsaViewPanel/genomeToMSA.js +8 -30
- package/dist/MsaViewPanel/genomeToMSA.test.js +0 -1
- package/dist/MsaViewPanel/index.js +0 -1
- package/dist/MsaViewPanel/model.d.ts +143 -514
- package/dist/MsaViewPanel/model.js +18 -61
- package/dist/MsaViewPanel/msaCoordToGenomeCoord.js +5 -22
- package/dist/MsaViewPanel/msaCoordToGenomeCoord.test.js +0 -1
- package/dist/MsaViewPanel/msaDataStore.js +0 -1
- package/dist/MsaViewPanel/pairwiseAlignment.js +2 -10
- package/dist/MsaViewPanel/pairwiseAlignment.test.js +0 -1
- package/dist/MsaViewPanel/structureConnection.d.ts +0 -6
- package/dist/MsaViewPanel/structureConnection.js +0 -17
- package/dist/MsaViewPanel/structureConnection.test.js +1 -52
- package/dist/MsaViewPanel/syncGenomeHoverToMsaColumn.test.d.ts +1 -0
- package/dist/MsaViewPanel/syncGenomeHoverToMsaColumn.test.js +92 -0
- package/dist/MsaViewPanel/types.js +0 -1
- package/dist/MsaViewPanel/util.d.ts +1 -3
- package/dist/MsaViewPanel/util.js +1 -3
- package/dist/components/ExternalLink.js +0 -1
- package/dist/components/ReadOnlyTextField2.js +0 -1
- package/dist/components/TextField2.js +0 -1
- package/dist/index.js +0 -1
- package/dist/jbrowse-plugin-msaview.umd.production.min.js +40 -40
- package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
- package/dist/utils/blastCache.js +2 -5
- package/dist/utils/fetch.js +0 -1
- package/dist/utils/msa.js +9 -9
- package/dist/utils/ncbiBlast.js +5 -6
- package/dist/utils/swrConfig.js +0 -1
- package/dist/utils/taxonomyNames.js +0 -1
- package/dist/utils/types.js +0 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -2
- package/package.json +11 -11
- package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +4 -1
- package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +5 -8
- package/src/AddHighlightModel/index.tsx +4 -1
- package/src/AddHighlightModel/util.ts +1 -10
- package/src/LaunchMsaView/components/TabPanel.tsx +1 -1
- package/src/LaunchMsaView/util.ts +1 -3
- package/src/MsaViewPanel/afterCreateAutoruns.ts +24 -21
- package/src/MsaViewPanel/genomeToMSA.ts +10 -29
- package/src/MsaViewPanel/model.ts +21 -66
- package/src/MsaViewPanel/msaCoordToGenomeCoord.ts +5 -21
- package/src/MsaViewPanel/pairwiseAlignment.ts +2 -7
- package/src/MsaViewPanel/structureConnection.test.ts +1 -61
- package/src/MsaViewPanel/structureConnection.ts +0 -22
- package/src/MsaViewPanel/syncGenomeHoverToMsaColumn.test.ts +112 -0
- package/src/MsaViewPanel/util.ts +3 -7
- package/src/utils/blastCache.ts +2 -4
- package/src/utils/msa.ts +10 -8
- package/src/utils/ncbiBlast.ts +5 -6
- package/src/version.ts +1 -1
- package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +0 -1
- package/dist/AddHighlightModel/HighlightComponents.js.map +0 -1
- package/dist/AddHighlightModel/MsaToGenomeHighlight.js.map +0 -1
- package/dist/AddHighlightModel/index.js.map +0 -1
- package/dist/AddHighlightModel/util.js.map +0 -1
- package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.js.map +0 -1
- package/dist/BgzipFastaMsaAdapter/configSchema.js.map +0 -1
- package/dist/BgzipFastaMsaAdapter/index.js.map +0 -1
- package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +0 -1
- package/dist/LaunchMsaView/components/LaunchPanelContent.js.map +0 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +0 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/fetchGeneList.js.map +0 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/launchView.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/MsaAlgorithmSelect.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js.map +0 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js.map +0 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +0 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.js.map +0 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.js.map +0 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/types.js.map +0 -1
- package/dist/LaunchMsaView/components/SubmitCancelActions.js.map +0 -1
- package/dist/LaunchMsaView/components/TabPanel.js.map +0 -1
- package/dist/LaunchMsaView/components/TranscriptSelector.js.map +0 -1
- package/dist/LaunchMsaView/components/calculateProteinSequence.js.map +0 -1
- package/dist/LaunchMsaView/components/fetchSeq.js.map +0 -1
- package/dist/LaunchMsaView/components/types.js.map +0 -1
- package/dist/LaunchMsaView/components/useFeatureSequence.js.map +0 -1
- package/dist/LaunchMsaView/components/useSWRFeatureSequence.js.map +0 -1
- package/dist/LaunchMsaView/components/useTranscriptSelection.js.map +0 -1
- package/dist/LaunchMsaView/components/util.js.map +0 -1
- package/dist/LaunchMsaView/index.js.map +0 -1
- package/dist/LaunchMsaView/util.js.map +0 -1
- package/dist/LaunchMsaViewExtensionPoint/index.js.map +0 -1
- package/dist/MsaViewPanel/afterCreateAutoruns.js.map +0 -1
- package/dist/MsaViewPanel/blosum62.js.map +0 -1
- package/dist/MsaViewPanel/components/ConnectStructureDialog.js.map +0 -1
- package/dist/MsaViewPanel/components/ErrorBoundary.js.map +0 -1
- package/dist/MsaViewPanel/components/LoadingBLAST.js.map +0 -1
- package/dist/MsaViewPanel/components/MsaViewPanel.js.map +0 -1
- package/dist/MsaViewPanel/components/RIDLink.js.map +0 -1
- package/dist/MsaViewPanel/doLaunchBlast.js.map +0 -1
- package/dist/MsaViewPanel/genomeToMSA.js.map +0 -1
- package/dist/MsaViewPanel/genomeToMSA.test.js.map +0 -1
- package/dist/MsaViewPanel/index.js.map +0 -1
- package/dist/MsaViewPanel/model.js.map +0 -1
- package/dist/MsaViewPanel/msaCoordToGenomeCoord.js.map +0 -1
- package/dist/MsaViewPanel/msaCoordToGenomeCoord.test.js.map +0 -1
- package/dist/MsaViewPanel/msaDataStore.js.map +0 -1
- package/dist/MsaViewPanel/pairwiseAlignment.js.map +0 -1
- package/dist/MsaViewPanel/pairwiseAlignment.test.js.map +0 -1
- package/dist/MsaViewPanel/structureConnection.js.map +0 -1
- package/dist/MsaViewPanel/structureConnection.test.js.map +0 -1
- package/dist/MsaViewPanel/types.js.map +0 -1
- package/dist/MsaViewPanel/util.js.map +0 -1
- package/dist/components/ExternalLink.js.map +0 -1
- package/dist/components/ReadOnlyTextField2.js.map +0 -1
- package/dist/components/TextField2.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/utils/blastCache.js.map +0 -1
- package/dist/utils/fetch.js.map +0 -1
- package/dist/utils/msa.js.map +0 -1
- package/dist/utils/ncbiBlast.js.map +0 -1
- package/dist/utils/swrConfig.js.map +0 -1
- package/dist/utils/taxonomyNames.js.map +0 -1
- package/dist/utils/types.js.map +0 -1
- package/dist/version.js.map +0 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
2
|
import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes';
|
|
3
3
|
import { getSession } from '@jbrowse/core/util';
|
|
4
|
-
import { addDisposer,
|
|
4
|
+
import { addDisposer, types } from '@jbrowse/mobx-state-tree';
|
|
5
5
|
import { genomeToTranscriptSeqMapping } from 'g2p_mapper';
|
|
6
6
|
import { autorun } from 'mobx';
|
|
7
7
|
import { MSAModelF } from 'react-msaview';
|
|
8
|
-
import { autoConnectStructures, highlightConnectedStructures, launchBlastIfNeeded, loadStoredData, observeProteinHighlights, processInit, runCleanup, storeDataToIndexedDB,
|
|
9
|
-
import { genomeToMSA } from './genomeToMSA';
|
|
8
|
+
import { autoConnectStructures, highlightConnectedStructures, launchBlastIfNeeded, loadStoredData, observeProteinHighlights, processInit, runCleanup, storeDataToIndexedDB, syncGenomeHoverToMsaColumn, } from './afterCreateAutoruns';
|
|
10
9
|
import { msaCoordToGenomeCoord } from './msaCoordToGenomeCoord';
|
|
11
10
|
import { buildAlignmentMaps, runPairwiseAlignment } from './pairwiseAlignment';
|
|
12
|
-
import { getProteinViews
|
|
11
|
+
import { getProteinViews } from './structureConnection';
|
|
13
12
|
import { getCanonicalRefName } from './util';
|
|
14
13
|
const ConnectStructureDialog = lazy(() => import('./components/ConnectStructureDialog'));
|
|
15
14
|
/**
|
|
@@ -31,11 +30,6 @@ export default function stateModelFactory() {
|
|
|
31
30
|
/**
|
|
32
31
|
* #property
|
|
33
32
|
*/
|
|
34
|
-
connectedHighlights: types.array(types.model({
|
|
35
|
-
refName: types.string,
|
|
36
|
-
start: types.number,
|
|
37
|
-
end: types.number,
|
|
38
|
-
})),
|
|
39
33
|
/**
|
|
40
34
|
* #property
|
|
41
35
|
*/
|
|
@@ -140,36 +134,16 @@ export default function stateModelFactory() {
|
|
|
140
134
|
/**
|
|
141
135
|
* #getter
|
|
142
136
|
*/
|
|
143
|
-
get
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (globalCol !== undefined) {
|
|
154
|
-
return self.globalColToVisibleCol(globalCol);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return undefined;
|
|
161
|
-
},
|
|
162
|
-
}))
|
|
163
|
-
.views(self => ({
|
|
164
|
-
/**
|
|
165
|
-
* #getter
|
|
166
|
-
*/
|
|
167
|
-
get mouseCol2() {
|
|
168
|
-
const structureCol = self.structureHoverCol;
|
|
169
|
-
if (structureCol !== undefined) {
|
|
170
|
-
return structureCol;
|
|
171
|
-
}
|
|
172
|
-
return genomeToMSA({ model: self });
|
|
137
|
+
get connectedHighlights() {
|
|
138
|
+
const { mouseCol, mouseClickCol } = self;
|
|
139
|
+
return [
|
|
140
|
+
mouseCol === undefined
|
|
141
|
+
? undefined
|
|
142
|
+
: msaCoordToGenomeCoord({ model: self, coord: mouseCol }),
|
|
143
|
+
mouseClickCol === undefined
|
|
144
|
+
? undefined
|
|
145
|
+
: msaCoordToGenomeCoord({ model: self, coord: mouseClickCol }),
|
|
146
|
+
].filter((r) => r !== undefined);
|
|
173
147
|
},
|
|
174
148
|
}))
|
|
175
149
|
.actions(self => ({
|
|
@@ -197,24 +171,6 @@ export default function stateModelFactory() {
|
|
|
197
171
|
setRid(arg) {
|
|
198
172
|
self.rid = arg;
|
|
199
173
|
},
|
|
200
|
-
/**
|
|
201
|
-
* #action
|
|
202
|
-
*/
|
|
203
|
-
setConnectedHighlights(r) {
|
|
204
|
-
self.connectedHighlights = cast(r);
|
|
205
|
-
},
|
|
206
|
-
/**
|
|
207
|
-
* #action
|
|
208
|
-
*/
|
|
209
|
-
addToConnectedHighlights(r) {
|
|
210
|
-
self.connectedHighlights.push(r);
|
|
211
|
-
},
|
|
212
|
-
/**
|
|
213
|
-
* #action
|
|
214
|
-
*/
|
|
215
|
-
clearConnectedHighlights() {
|
|
216
|
-
self.connectedHighlights = cast([]);
|
|
217
|
-
},
|
|
218
174
|
/**
|
|
219
175
|
* #action
|
|
220
176
|
*/
|
|
@@ -308,13 +264,12 @@ export default function stateModelFactory() {
|
|
|
308
264
|
throw new Error('Structure sequence not available');
|
|
309
265
|
}
|
|
310
266
|
const alignment = runPairwiseAlignment(ungappedMsaSequence, structureSequence);
|
|
311
|
-
const { seq1ToSeq2
|
|
267
|
+
const { seq1ToSeq2 } = buildAlignmentMaps(alignment);
|
|
312
268
|
const connection = {
|
|
313
269
|
proteinViewId,
|
|
314
270
|
structureIdx,
|
|
315
271
|
msaRowName: rowName,
|
|
316
272
|
msaToStructure: Object.fromEntries(seq1ToSeq2),
|
|
317
|
-
structureToMsa: Object.fromEntries(seq2ToSeq1),
|
|
318
273
|
};
|
|
319
274
|
self.connectedStructures.push(connection);
|
|
320
275
|
},
|
|
@@ -396,7 +351,6 @@ export default function stateModelFactory() {
|
|
|
396
351
|
storeDataToIndexedDB,
|
|
397
352
|
launchBlastIfNeeded,
|
|
398
353
|
processInit,
|
|
399
|
-
updateGenomeHighlights,
|
|
400
354
|
highlightConnectedStructures,
|
|
401
355
|
autoConnectStructures,
|
|
402
356
|
observeProteinHighlights,
|
|
@@ -405,7 +359,10 @@ export default function stateModelFactory() {
|
|
|
405
359
|
fn(self);
|
|
406
360
|
}));
|
|
407
361
|
}
|
|
362
|
+
addDisposer(self, autorun(syncGenomeHoverToMsaColumn(self)));
|
|
408
363
|
},
|
|
409
364
|
}));
|
|
410
365
|
}
|
|
411
|
-
|
|
366
|
+
export function isMsaView(view) {
|
|
367
|
+
return view.type === 'MsaView';
|
|
368
|
+
}
|
|
@@ -1,44 +1,27 @@
|
|
|
1
1
|
import { gappedToUngappedPosition } from './structureConnection';
|
|
2
2
|
export function msaCoordToGenomeCoord({ model, coord: mouseCol, }) {
|
|
3
3
|
const { querySeqName, transcriptToMsaMap, mafRegion } = model;
|
|
4
|
-
|
|
5
|
-
const queryRow = model.rows.find(f => f[0] === querySeqName);
|
|
6
|
-
const querySeq = queryRow?.[1];
|
|
4
|
+
const querySeq = model.rows.find(f => f[0] === querySeqName)?.[1];
|
|
7
5
|
if (!querySeq) {
|
|
8
6
|
return undefined;
|
|
9
7
|
}
|
|
10
|
-
// Convert gapped MSA column to ungapped sequence coordinate
|
|
11
|
-
// Returns undefined if the position is a gap
|
|
12
8
|
const ungappedPos = gappedToUngappedPosition(querySeq, mouseCol);
|
|
13
9
|
if (ungappedPos === undefined) {
|
|
14
10
|
return undefined;
|
|
15
11
|
}
|
|
16
|
-
// Handle MAF region mapping
|
|
17
12
|
if (mafRegion) {
|
|
18
13
|
const genomePos = mafRegion.start + ungappedPos;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
refName: mafRegion.refName,
|
|
25
|
-
start: genomePos,
|
|
26
|
-
end: genomePos + 1,
|
|
27
|
-
};
|
|
14
|
+
return genomePos < mafRegion.end
|
|
15
|
+
? { refName: mafRegion.refName, start: genomePos, end: genomePos + 1 }
|
|
16
|
+
: undefined;
|
|
28
17
|
}
|
|
29
|
-
// Handle transcript mapping (original behavior)
|
|
30
18
|
if (transcriptToMsaMap) {
|
|
31
19
|
const { refName, p2g } = transcriptToMsaMap;
|
|
32
20
|
const s = p2g[ungappedPos];
|
|
33
21
|
const e = p2g[ungappedPos + 1];
|
|
34
22
|
return s !== undefined && e !== undefined
|
|
35
|
-
? {
|
|
36
|
-
refName,
|
|
37
|
-
start: Math.min(s, e),
|
|
38
|
-
end: Math.max(s, e),
|
|
39
|
-
}
|
|
23
|
+
? { refName, start: Math.min(s, e), end: Math.max(s, e) }
|
|
40
24
|
: undefined;
|
|
41
25
|
}
|
|
42
26
|
return undefined;
|
|
43
27
|
}
|
|
44
|
-
//# sourceMappingURL=msaCoordToGenomeCoord.js.map
|
|
@@ -93,15 +93,8 @@ function buildConsensus(alignedSeq1, alignedSeq2) {
|
|
|
93
93
|
for (let i = 0; i < alignedSeq1.length; i++) {
|
|
94
94
|
const a = alignedSeq1[i];
|
|
95
95
|
const b = alignedSeq2[i];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
else if (a.toUpperCase() === b.toUpperCase()) {
|
|
100
|
-
consensus += '|';
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
consensus += ' ';
|
|
104
|
-
}
|
|
96
|
+
const match = a !== '-' && b !== '-' && a.toUpperCase() === b.toUpperCase();
|
|
97
|
+
consensus += match ? '|' : ' ';
|
|
105
98
|
}
|
|
106
99
|
return consensus;
|
|
107
100
|
}
|
|
@@ -143,4 +136,3 @@ export function buildAlignmentMaps(pairwiseAlignment) {
|
|
|
143
136
|
}
|
|
144
137
|
return { seq1ToSeq2, seq2ToSeq1 };
|
|
145
138
|
}
|
|
146
|
-
//# sourceMappingURL=pairwiseAlignment.js.map
|
|
@@ -38,14 +38,8 @@ export interface StructureConnection {
|
|
|
38
38
|
msaRowName: string;
|
|
39
39
|
/** Map from MSA ungapped position to structure sequence position */
|
|
40
40
|
msaToStructure: Record<number, number>;
|
|
41
|
-
/** Map from structure sequence position to MSA ungapped position */
|
|
42
|
-
structureToMsa: Record<number, number>;
|
|
43
41
|
}
|
|
44
42
|
/**
|
|
45
43
|
* Helper to convert gapped MSA column to ungapped position for a specific row
|
|
46
44
|
*/
|
|
47
45
|
export declare function gappedToUngappedPosition(sequence: string, gappedPosition: number): number | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Helper to convert ungapped position to gapped MSA column for a specific row
|
|
50
|
-
*/
|
|
51
|
-
export declare function ungappedToGappedPosition(sequence: string, ungappedPosition: number): number | undefined;
|
|
@@ -27,20 +27,3 @@ export function gappedToUngappedPosition(sequence, gappedPosition) {
|
|
|
27
27
|
}
|
|
28
28
|
return ungapped;
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Helper to convert ungapped position to gapped MSA column for a specific row
|
|
32
|
-
*/
|
|
33
|
-
export function ungappedToGappedPosition(sequence, ungappedPosition) {
|
|
34
|
-
let ungapped = 0;
|
|
35
|
-
for (let i = 0; i < sequence.length; i++) {
|
|
36
|
-
const element = sequence[i];
|
|
37
|
-
if (element !== '-') {
|
|
38
|
-
if (ungapped === ungappedPosition) {
|
|
39
|
-
return i;
|
|
40
|
-
}
|
|
41
|
-
ungapped++;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=structureConnection.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import { gappedToUngappedPosition
|
|
2
|
+
import { gappedToUngappedPosition } from './structureConnection';
|
|
3
3
|
describe('gappedToUngappedPosition', () => {
|
|
4
4
|
test('returns correct ungapped position for non-gap character', () => {
|
|
5
5
|
const seq = 'M-KA-A';
|
|
@@ -51,54 +51,3 @@ describe('gappedToUngappedPosition', () => {
|
|
|
51
51
|
expect(gappedToUngappedPosition(seq, 2)).toBeUndefined();
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
|
-
describe('ungappedToGappedPosition', () => {
|
|
55
|
-
test('returns correct gapped position', () => {
|
|
56
|
-
const seq = 'M-KA-A';
|
|
57
|
-
// 0 12 34 (gapped)
|
|
58
|
-
// 0 1 23 (ungapped)
|
|
59
|
-
expect(ungappedToGappedPosition(seq, 0)).toBe(0); // M
|
|
60
|
-
expect(ungappedToGappedPosition(seq, 1)).toBe(2); // K
|
|
61
|
-
expect(ungappedToGappedPosition(seq, 2)).toBe(3); // A
|
|
62
|
-
expect(ungappedToGappedPosition(seq, 3)).toBe(5); // A
|
|
63
|
-
});
|
|
64
|
-
test('returns undefined for out-of-bounds ungapped position', () => {
|
|
65
|
-
const seq = 'M-KA';
|
|
66
|
-
expect(ungappedToGappedPosition(seq, 4)).toBeUndefined();
|
|
67
|
-
expect(ungappedToGappedPosition(seq, 100)).toBeUndefined();
|
|
68
|
-
});
|
|
69
|
-
test('handles sequence with no gaps', () => {
|
|
70
|
-
const seq = 'MKAA';
|
|
71
|
-
expect(ungappedToGappedPosition(seq, 0)).toBe(0);
|
|
72
|
-
expect(ungappedToGappedPosition(seq, 1)).toBe(1);
|
|
73
|
-
expect(ungappedToGappedPosition(seq, 2)).toBe(2);
|
|
74
|
-
expect(ungappedToGappedPosition(seq, 3)).toBe(3);
|
|
75
|
-
});
|
|
76
|
-
test('handles sequence with leading gaps', () => {
|
|
77
|
-
const seq = '--MKA';
|
|
78
|
-
expect(ungappedToGappedPosition(seq, 0)).toBe(2); // M
|
|
79
|
-
expect(ungappedToGappedPosition(seq, 1)).toBe(3); // K
|
|
80
|
-
expect(ungappedToGappedPosition(seq, 2)).toBe(4); // A
|
|
81
|
-
});
|
|
82
|
-
test('handles empty sequence', () => {
|
|
83
|
-
expect(ungappedToGappedPosition('', 0)).toBeUndefined();
|
|
84
|
-
});
|
|
85
|
-
test('handles all-gap sequence', () => {
|
|
86
|
-
const seq = '---';
|
|
87
|
-
expect(ungappedToGappedPosition(seq, 0)).toBeUndefined();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
describe('gappedToUngappedPosition and ungappedToGappedPosition are inverses', () => {
|
|
91
|
-
test('round-trip conversion works', () => {
|
|
92
|
-
const seq = 'M-KA--YL-S';
|
|
93
|
-
// For each non-gap position, converting to ungapped and back should return original
|
|
94
|
-
for (let i = 0; i < seq.length; i++) {
|
|
95
|
-
if (seq[i] !== '-') {
|
|
96
|
-
const ungapped = gappedToUngappedPosition(seq, i);
|
|
97
|
-
expect(ungapped).toBeDefined();
|
|
98
|
-
const backToGapped = ungappedToGappedPosition(seq, ungapped);
|
|
99
|
-
expect(backToGapped).toBe(i);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
//# sourceMappingURL=structureConnection.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { getSession } from '@jbrowse/core/util';
|
|
2
|
+
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
3
|
+
import { syncGenomeHoverToMsaColumn } from './afterCreateAutoruns';
|
|
4
|
+
// Mock only getSession; keep the rest of the util module real so the
|
|
5
|
+
// afterCreateAutoruns import graph still loads.
|
|
6
|
+
vi.mock('@jbrowse/core/util', async (importOriginal) => ({
|
|
7
|
+
...(await importOriginal()),
|
|
8
|
+
getSession: vi.fn(),
|
|
9
|
+
}));
|
|
10
|
+
const mockGetSession = vi.mocked(getSession);
|
|
11
|
+
const mafRegion = {
|
|
12
|
+
refName: 'chr1',
|
|
13
|
+
start: 1000,
|
|
14
|
+
end: 1010,
|
|
15
|
+
assemblyName: 'hg38',
|
|
16
|
+
};
|
|
17
|
+
// A model wired through the real genomeToMSA path: a connected genome view
|
|
18
|
+
// over a maf region, with seqPosToVisibleCol as identity so the asserted
|
|
19
|
+
// column equals the ungapped offset into the region.
|
|
20
|
+
function makeModel() {
|
|
21
|
+
const calls = [];
|
|
22
|
+
const model = {
|
|
23
|
+
querySeqName: 'hg38.chr1',
|
|
24
|
+
transcriptToMsaMap: undefined,
|
|
25
|
+
mafRegion,
|
|
26
|
+
connectedView: { initialized: true, assemblyNames: ['hg38'] },
|
|
27
|
+
seqPosToVisibleCol: (_name, pos) => pos,
|
|
28
|
+
setMousePos: (col) => {
|
|
29
|
+
calls.push(col);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
return { model, calls };
|
|
33
|
+
}
|
|
34
|
+
function hoverGenome(coord) {
|
|
35
|
+
mockGetSession.mockReturnValue({
|
|
36
|
+
hovered: { hoverFeature: {}, hoverPosition: { coord, refName: 'chr1' } },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function clearGenomeHover() {
|
|
40
|
+
mockGetSession.mockReturnValue({
|
|
41
|
+
hovered: null,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
describe('syncGenomeHoverToMsaColumn (real genomeToMSA mapping)', () => {
|
|
45
|
+
beforeEach(() => {
|
|
46
|
+
vi.clearAllMocks();
|
|
47
|
+
});
|
|
48
|
+
test('genome hover at coord 1005 highlights MSA column 5', () => {
|
|
49
|
+
const { model, calls } = makeModel();
|
|
50
|
+
const run = syncGenomeHoverToMsaColumn(model);
|
|
51
|
+
hoverGenome(1005); // 1005 - mafRegion.start(1000) = ungapped 5
|
|
52
|
+
run();
|
|
53
|
+
expect(calls).toEqual([5]);
|
|
54
|
+
});
|
|
55
|
+
test('moving the genome hover moves the highlighted column', () => {
|
|
56
|
+
const { model, calls } = makeModel();
|
|
57
|
+
const run = syncGenomeHoverToMsaColumn(model);
|
|
58
|
+
hoverGenome(1002);
|
|
59
|
+
run();
|
|
60
|
+
hoverGenome(1007);
|
|
61
|
+
run();
|
|
62
|
+
expect(calls).toEqual([2, 7]);
|
|
63
|
+
});
|
|
64
|
+
test('leaving the genome clears the column it set', () => {
|
|
65
|
+
const { model, calls } = makeModel();
|
|
66
|
+
const run = syncGenomeHoverToMsaColumn(model);
|
|
67
|
+
hoverGenome(1004);
|
|
68
|
+
run();
|
|
69
|
+
clearGenomeHover();
|
|
70
|
+
run();
|
|
71
|
+
expect(calls).toEqual([4, undefined]);
|
|
72
|
+
});
|
|
73
|
+
test('a hover outside the maf region clears a previously-set column once', () => {
|
|
74
|
+
const { model, calls } = makeModel();
|
|
75
|
+
const run = syncGenomeHoverToMsaColumn(model);
|
|
76
|
+
hoverGenome(1004);
|
|
77
|
+
run();
|
|
78
|
+
hoverGenome(5000); // outside [1000,1010) -> genomeToMSA returns undefined
|
|
79
|
+
run();
|
|
80
|
+
run();
|
|
81
|
+
expect(calls).toEqual([4, undefined]);
|
|
82
|
+
});
|
|
83
|
+
test('never touches mouseCol when the genome never provides a column, so a direct MSA hover survives unrelated session hovers', () => {
|
|
84
|
+
const { model, calls } = makeModel();
|
|
85
|
+
const run = syncGenomeHoverToMsaColumn(model);
|
|
86
|
+
clearGenomeHover();
|
|
87
|
+
run();
|
|
88
|
+
hoverGenome(9999); // unrelated/out-of-range hover elsewhere
|
|
89
|
+
run();
|
|
90
|
+
expect(calls).toEqual([]);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function checkHovered(hovered: unknown): hovered is {
|
|
3
|
-
hoverFeature: Feature;
|
|
1
|
+
export declare function hasHoverPosition(hovered: unknown): hovered is {
|
|
4
2
|
hoverPosition: {
|
|
5
3
|
coord: number;
|
|
6
4
|
refName: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function hasHoverPosition(hovered) {
|
|
2
2
|
return (!!hovered &&
|
|
3
3
|
typeof hovered === 'object' &&
|
|
4
|
-
'hoverFeature' in hovered &&
|
|
5
4
|
'hoverPosition' in hovered &&
|
|
6
5
|
!!hovered.hoverPosition);
|
|
7
6
|
}
|
|
@@ -22,4 +21,3 @@ export function getUniprotIdFromAlphaFoldUrl(url) {
|
|
|
22
21
|
const match = /AF-([A-Z0-9]+)-F\d+/.exec(url);
|
|
23
22
|
return match?.[1];
|
|
24
23
|
}
|
|
25
|
-
//# sourceMappingURL=util.js.map
|
package/dist/index.js
CHANGED