jbrowse-plugin-msaview 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddHighlightModel/MsaToGenomeHighlight.js +6 -5
- package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.d.ts +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js +5 -2
- package/dist/LaunchMsaView/components/calculateProteinSequence.d.ts +3 -2
- package/dist/LaunchMsaView/components/calculateProteinSequence.js +31 -15
- package/dist/LaunchMsaView/components/geneticCodes.d.ts +15 -0
- package/dist/LaunchMsaView/components/geneticCodes.js +227 -0
- package/dist/LaunchMsaView/components/types.d.ts +1 -0
- package/dist/LaunchMsaView/index.js +32 -26
- package/dist/MsaViewPanel/doLaunchBlast.js +10 -22
- package/dist/MsaViewPanel/genomeToMSA.js +13 -6
- package/dist/MsaViewPanel/genomeToMSA.test.js +35 -6
- package/dist/MsaViewPanel/model.d.ts +68 -66
- package/dist/MsaViewPanel/model.js +14 -12
- package/dist/MsaViewPanel/msaCoordToGenomeCoord.d.ts +32 -13
- package/dist/MsaViewPanel/msaCoordToGenomeCoord.js +43 -14
- package/dist/MsaViewPanel/msaCoordToGenomeCoord.test.js +108 -18
- package/dist/MsaViewPanel/msaDataStore.js +8 -17
- package/dist/MsaViewPanel/syncGenomeHoverToMsaColumn.test.js +8 -6
- package/dist/jbrowse-plugin-msaview.umd.production.min.js +31 -31
- package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
- package/dist/utils/blastCache.d.ts +1 -2
- package/dist/utils/blastCache.js +9 -22
- package/dist/utils/domainCache.js +6 -15
- package/dist/utils/idb.d.ts +12 -0
- package/dist/utils/idb.js +21 -0
- package/dist/utils/taxonomyNames.js +13 -18
- package/dist/utils/useLocalStorage.d.ts +1 -0
- package/dist/utils/useLocalStorage.js +29 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -3
- package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +6 -8
- package/src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx +1 -1
- package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.tsx +1 -1
- package/src/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.ts +4 -2
- package/src/LaunchMsaView/components/calculateProteinSequence.ts +35 -20
- package/src/LaunchMsaView/components/geneticCodes.ts +298 -0
- package/src/LaunchMsaView/components/types.ts +3 -0
- package/src/LaunchMsaView/index.ts +44 -35
- package/src/MsaViewPanel/doLaunchBlast.ts +20 -29
- package/src/MsaViewPanel/genomeToMSA.test.ts +38 -6
- package/src/MsaViewPanel/genomeToMSA.ts +14 -6
- package/src/MsaViewPanel/model.ts +17 -12
- package/src/MsaViewPanel/msaCoordToGenomeCoord.test.ts +117 -18
- package/src/MsaViewPanel/msaCoordToGenomeCoord.ts +70 -26
- package/src/MsaViewPanel/msaDataStore.ts +17 -17
- package/src/MsaViewPanel/syncGenomeHoverToMsaColumn.test.ts +8 -6
- package/src/utils/blastCache.ts +20 -23
- package/src/utils/domainCache.ts +14 -18
- package/src/utils/idb.ts +28 -0
- package/src/utils/taxonomyNames.ts +22 -24
- package/src/utils/useLocalStorage.ts +31 -0
- package/src/version.ts +1 -1
- package/dist/MsaViewPanel/blosum62.d.ts +0 -2
- package/dist/MsaViewPanel/blosum62.js +0 -627
- package/src/MsaViewPanel/blosum62.ts +0 -628
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createDbOpener } from '../utils/idb';
|
|
2
2
|
const DB_NAME = 'jbrowse-msaview-data';
|
|
3
3
|
const DB_VERSION = 1;
|
|
4
4
|
const STORE_NAME = 'msa-data';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
store.createIndex('timestamp', 'timestamp', { unique: false });
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
}).catch((e) => {
|
|
15
|
-
dbPromise = undefined;
|
|
16
|
-
throw e;
|
|
17
|
-
});
|
|
18
|
-
return dbPromise;
|
|
19
|
-
}
|
|
5
|
+
const getDB = createDbOpener(DB_NAME, DB_VERSION, db => {
|
|
6
|
+
if (!db.objectStoreNames.contains(STORE_NAME)) {
|
|
7
|
+
const store = db.createObjectStore(STORE_NAME, { keyPath: 'id' });
|
|
8
|
+
store.createIndex('timestamp', 'timestamp', { unique: false });
|
|
9
|
+
}
|
|
10
|
+
});
|
|
20
11
|
export function generateDataStoreId() {
|
|
21
12
|
return `msa-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
22
13
|
}
|
|
@@ -41,7 +32,7 @@ export async function storeMsaData(id, data) {
|
|
|
41
32
|
export async function retrieveMsaData(id) {
|
|
42
33
|
try {
|
|
43
34
|
const db = await getDB();
|
|
44
|
-
const result =
|
|
35
|
+
const result = await db.get(STORE_NAME, id);
|
|
45
36
|
if (result) {
|
|
46
37
|
return {
|
|
47
38
|
msa: result.msa,
|
|
@@ -45,12 +45,14 @@ describe('syncGenomeHoverToMsaColumn (real genomeToMSA mapping)', () => {
|
|
|
45
45
|
beforeEach(() => {
|
|
46
46
|
vi.clearAllMocks();
|
|
47
47
|
});
|
|
48
|
-
test('genome hover at coord 1005 highlights MSA column
|
|
48
|
+
test('genome hover at coord 1005 highlights MSA column 4', () => {
|
|
49
49
|
const { model, calls } = makeModel();
|
|
50
50
|
const run = syncGenomeHoverToMsaColumn(model);
|
|
51
|
-
|
|
51
|
+
// the hover coord is 1-based, so 1005 is the 0-based base 1004, i.e.
|
|
52
|
+
// ungapped offset 4 into a region starting at 1000
|
|
53
|
+
hoverGenome(1005);
|
|
52
54
|
run();
|
|
53
|
-
expect(calls).toEqual([
|
|
55
|
+
expect(calls).toEqual([4]);
|
|
54
56
|
});
|
|
55
57
|
test('moving the genome hover moves the highlighted column', () => {
|
|
56
58
|
const { model, calls } = makeModel();
|
|
@@ -59,7 +61,7 @@ describe('syncGenomeHoverToMsaColumn (real genomeToMSA mapping)', () => {
|
|
|
59
61
|
run();
|
|
60
62
|
hoverGenome(1007);
|
|
61
63
|
run();
|
|
62
|
-
expect(calls).toEqual([
|
|
64
|
+
expect(calls).toEqual([1, 6]);
|
|
63
65
|
});
|
|
64
66
|
test('leaving the genome clears the column it set', () => {
|
|
65
67
|
const { model, calls } = makeModel();
|
|
@@ -68,7 +70,7 @@ describe('syncGenomeHoverToMsaColumn (real genomeToMSA mapping)', () => {
|
|
|
68
70
|
run();
|
|
69
71
|
clearGenomeHover();
|
|
70
72
|
run();
|
|
71
|
-
expect(calls).toEqual([
|
|
73
|
+
expect(calls).toEqual([3, undefined]);
|
|
72
74
|
});
|
|
73
75
|
test('a hover outside the maf region clears a previously-set column once', () => {
|
|
74
76
|
const { model, calls } = makeModel();
|
|
@@ -78,7 +80,7 @@ describe('syncGenomeHoverToMsaColumn (real genomeToMSA mapping)', () => {
|
|
|
78
80
|
hoverGenome(5000); // outside [1000,1010) -> genomeToMSA returns undefined
|
|
79
81
|
run();
|
|
80
82
|
run();
|
|
81
|
-
expect(calls).toEqual([
|
|
83
|
+
expect(calls).toEqual([3, undefined]);
|
|
82
84
|
});
|
|
83
85
|
test('never touches mouseCol when the genome never provides a column, so a direct MSA hover survives unrelated session hovers', () => {
|
|
84
86
|
const { model, calls } = makeModel();
|