jbrowse-plugin-msaview 2.2.8 → 2.3.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/AddHighlightModel/index.d.ts +1 -1
- package/dist/AddHighlightModel/index.js.map +1 -1
- package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.d.ts +2 -1
- package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.js +1 -1
- package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.js.map +1 -1
- package/dist/BgzipFastaMsaAdapter/configSchema.d.ts +3 -3
- package/dist/BgzipFastaMsaAdapter/configSchema.js.map +1 -1
- package/dist/BgzipFastaMsaAdapter/index.d.ts +1 -1
- package/dist/BgzipFastaMsaAdapter/index.js.map +1 -1
- package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.d.ts +1 -1
- package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js +1 -1
- package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js.map +1 -1
- package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js.map +1 -1
- package/dist/LaunchMsaView/components/LaunchMsaViewDialog.d.ts +1 -1
- package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +1 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.d.ts +1 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +1 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +1 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/launchView.d.ts +1 -1
- package/dist/LaunchMsaView/components/ManualMSALoader/launchView.js.map +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.d.ts +1 -2
- package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +21 -14
- package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js.map +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.d.ts +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +32 -35
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.d.ts +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js +2 -2
- package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js.map +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.d.ts +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js.map +1 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.d.ts +2 -0
- package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js +1 -0
- package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js.map +1 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.d.ts +1 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +6 -8
- package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.d.ts +2 -2
- package/dist/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.js.map +1 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.d.ts +1 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.js.map +1 -1
- package/dist/LaunchMsaView/components/TranscriptSelector.d.ts +3 -3
- package/dist/LaunchMsaView/components/TranscriptSelector.js +4 -4
- package/dist/LaunchMsaView/components/TranscriptSelector.js.map +1 -1
- package/dist/LaunchMsaView/components/useTranscriptSelection.d.ts +1 -1
- package/dist/LaunchMsaView/components/useTranscriptSelection.js +1 -2
- package/dist/LaunchMsaView/components/useTranscriptSelection.js.map +1 -1
- package/dist/LaunchMsaView/components/util.js +1 -1
- package/dist/LaunchMsaView/components/util.js.map +1 -1
- package/dist/LaunchMsaView/index.d.ts +1 -1
- package/dist/LaunchMsaView/index.js.map +1 -1
- package/dist/LaunchMsaView/util.d.ts +1 -0
- package/dist/LaunchMsaView/util.js +10 -0
- package/dist/LaunchMsaView/util.js.map +1 -1
- package/dist/MsaViewPanel/afterCreateAutoruns.d.ts +10 -0
- package/dist/MsaViewPanel/afterCreateAutoruns.js +258 -0
- package/dist/MsaViewPanel/afterCreateAutoruns.js.map +1 -0
- package/dist/MsaViewPanel/blosum62.d.ts +2 -0
- package/dist/MsaViewPanel/blosum62.js +628 -0
- package/dist/MsaViewPanel/blosum62.js.map +1 -0
- package/dist/MsaViewPanel/components/LoadingBLAST.d.ts +1 -1
- package/dist/MsaViewPanel/components/LoadingBLAST.js.map +1 -1
- package/dist/MsaViewPanel/components/MsaViewPanel.d.ts +1 -1
- package/dist/MsaViewPanel/components/MsaViewPanel.js.map +1 -1
- package/dist/MsaViewPanel/doLaunchBlast.d.ts +1 -1
- package/dist/MsaViewPanel/doLaunchBlast.js.map +1 -1
- package/dist/MsaViewPanel/genomeToMSA.d.ts +1 -1
- package/dist/MsaViewPanel/genomeToMSA.js.map +1 -1
- package/dist/MsaViewPanel/index.d.ts +1 -1
- package/dist/MsaViewPanel/index.js.map +1 -1
- package/dist/MsaViewPanel/model.d.ts +31 -39
- package/dist/MsaViewPanel/model.js +17 -309
- package/dist/MsaViewPanel/model.js.map +1 -1
- package/dist/MsaViewPanel/msaDataStore.d.ts +3 -4
- package/dist/MsaViewPanel/msaDataStore.js +59 -173
- package/dist/MsaViewPanel/msaDataStore.js.map +1 -1
- package/dist/MsaViewPanel/pairwiseAlignment.d.ts +0 -7
- package/dist/MsaViewPanel/pairwiseAlignment.js +1 -636
- package/dist/MsaViewPanel/pairwiseAlignment.js.map +1 -1
- package/dist/MsaViewPanel/structureConnection.js +1 -5
- package/dist/MsaViewPanel/structureConnection.js.map +1 -1
- package/dist/MsaViewPanel/util.d.ts +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +21 -22
- package/dist/index.js.map +1 -1
- package/dist/jbrowse-plugin-msaview.umd.production.min.js +29 -29
- package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
- package/dist/utils/msa.js +35 -77
- package/dist/utils/msa.js.map +1 -1
- package/dist/utils/ncbiBlast.js +1 -10
- package/dist/utils/ncbiBlast.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +33 -30
- package/src/AddHighlightModel/index.tsx +1 -1
- package/src/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.ts +3 -4
- package/src/BgzipFastaMsaAdapter/configSchema.ts +2 -1
- package/src/BgzipFastaMsaAdapter/index.ts +2 -1
- package/src/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.tsx +2 -6
- package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.ts +2 -1
- package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +2 -1
- package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +6 -7
- package/src/LaunchMsaView/components/ManualMSALoader/launchView.ts +5 -2
- package/src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx +22 -17
- package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx +40 -52
- package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.tsx +6 -13
- package/src/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.ts +2 -1
- package/src/LaunchMsaView/components/NCBIBlastQuery/consts.ts +2 -0
- package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +7 -19
- package/src/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.ts +2 -2
- package/src/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.ts +1 -2
- package/src/LaunchMsaView/components/TranscriptSelector.tsx +7 -6
- package/src/LaunchMsaView/components/useTranscriptSelection.ts +1 -6
- package/src/LaunchMsaView/components/util.ts +1 -1
- package/src/LaunchMsaView/index.ts +6 -5
- package/src/LaunchMsaView/util.ts +11 -0
- package/src/MsaViewPanel/afterCreateAutoruns.ts +299 -0
- package/src/MsaViewPanel/blosum62.ts +628 -0
- package/src/MsaViewPanel/components/LoadingBLAST.tsx +2 -1
- package/src/MsaViewPanel/components/MsaViewPanel.tsx +2 -1
- package/src/MsaViewPanel/doLaunchBlast.ts +1 -1
- package/src/MsaViewPanel/genomeToMSA.ts +2 -1
- package/src/MsaViewPanel/index.ts +2 -1
- package/src/MsaViewPanel/model.ts +30 -392
- package/src/MsaViewPanel/msaDataStore.ts +56 -196
- package/src/MsaViewPanel/pairwiseAlignment.ts +1 -637
- package/src/MsaViewPanel/structureConnection.ts +1 -5
- package/src/MsaViewPanel/util.ts +1 -1
- package/src/index.ts +5 -4
- package/src/utils/msa.ts +45 -100
- package/src/utils/ncbiBlast.ts +3 -13
- package/src/version.ts +1 -1
- package/CHANGELOG.md +0 -101
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { openDB } from 'idb'
|
|
2
|
+
|
|
1
3
|
const DB_NAME = 'jbrowse-msaview-data'
|
|
2
4
|
const DB_VERSION = 1
|
|
3
5
|
const STORE_NAME = 'msa-data'
|
|
@@ -10,72 +12,15 @@ interface StoredMsaData {
|
|
|
10
12
|
timestamp: number
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
// Check if indexedDB exists and is accessible
|
|
23
|
-
if (typeof indexedDB === 'undefined') {
|
|
24
|
-
indexedDBAvailable = false
|
|
25
|
-
return false
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Try to open a test database to verify IndexedDB is working
|
|
29
|
-
// This can fail in private browsing mode in some browsers
|
|
30
|
-
indexedDBAvailable = true
|
|
31
|
-
return true
|
|
32
|
-
} catch {
|
|
33
|
-
indexedDBAvailable = false
|
|
34
|
-
return false
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function openDB(): Promise<IDBDatabase | undefined> {
|
|
39
|
-
if (!checkIndexedDBAvailable()) {
|
|
40
|
-
return undefined
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (dbPromise) {
|
|
44
|
-
return dbPromise
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
dbPromise = new Promise(resolve => {
|
|
48
|
-
try {
|
|
49
|
-
const request = indexedDB.open(DB_NAME, DB_VERSION)
|
|
50
|
-
|
|
51
|
-
request.addEventListener('error', () => {
|
|
52
|
-
// IndexedDB may be blocked in private browsing mode
|
|
53
|
-
console.warn(
|
|
54
|
-
'IndexedDB unavailable - MSA data will not persist across page refreshes',
|
|
55
|
-
)
|
|
56
|
-
indexedDBAvailable = false
|
|
57
|
-
resolve(undefined)
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
request.onsuccess = () => {
|
|
61
|
-
resolve(request.result)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
request.onupgradeneeded = event => {
|
|
65
|
-
const db = (event.target as IDBOpenDBRequest).result
|
|
66
|
-
if (!db.objectStoreNames.contains(STORE_NAME)) {
|
|
67
|
-
const store = db.createObjectStore(STORE_NAME, { keyPath: 'id' })
|
|
68
|
-
store.createIndex('timestamp', 'timestamp', { unique: false })
|
|
69
|
-
}
|
|
15
|
+
async function getDB() {
|
|
16
|
+
return openDB(DB_NAME, DB_VERSION, {
|
|
17
|
+
upgrade(db) {
|
|
18
|
+
if (!db.objectStoreNames.contains(STORE_NAME)) {
|
|
19
|
+
const store = db.createObjectStore(STORE_NAME, { keyPath: 'id' })
|
|
20
|
+
store.createIndex('timestamp', 'timestamp', { unique: false })
|
|
70
21
|
}
|
|
71
|
-
}
|
|
72
|
-
console.warn('Failed to open IndexedDB:', e)
|
|
73
|
-
indexedDBAvailable = false
|
|
74
|
-
resolve(undefined)
|
|
75
|
-
}
|
|
22
|
+
},
|
|
76
23
|
})
|
|
77
|
-
|
|
78
|
-
return dbPromise
|
|
79
24
|
}
|
|
80
25
|
|
|
81
26
|
export function generateDataStoreId() {
|
|
@@ -85,152 +30,67 @@ export function generateDataStoreId() {
|
|
|
85
30
|
export async function storeMsaData(
|
|
86
31
|
id: string,
|
|
87
32
|
data: { msa?: string; tree?: string; treeMetadata?: string },
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
33
|
+
) {
|
|
34
|
+
try {
|
|
35
|
+
const db = await getDB()
|
|
36
|
+
const storedData: StoredMsaData = {
|
|
37
|
+
id,
|
|
38
|
+
msa: data.msa,
|
|
39
|
+
tree: data.tree,
|
|
40
|
+
treeMetadata: data.treeMetadata,
|
|
41
|
+
timestamp: Date.now(),
|
|
42
|
+
}
|
|
43
|
+
await db.put(STORE_NAME, storedData)
|
|
44
|
+
return true
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.warn('Failed to store MSA data:', e)
|
|
92
47
|
return false
|
|
93
48
|
}
|
|
49
|
+
}
|
|
94
50
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
treeMetadata: data.treeMetadata,
|
|
105
|
-
timestamp: Date.now(),
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const request = store.put(storedData)
|
|
109
|
-
|
|
110
|
-
request.addEventListener('error', () => {
|
|
111
|
-
// Log but don't fail - storage is best-effort
|
|
112
|
-
console.warn('Failed to store MSA data:', request.error)
|
|
113
|
-
resolve(false)
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
request.onsuccess = () => {
|
|
117
|
-
resolve(true)
|
|
51
|
+
export async function retrieveMsaData(id: string) {
|
|
52
|
+
try {
|
|
53
|
+
const db = await getDB()
|
|
54
|
+
const result = (await db.get(STORE_NAME, id)) as StoredMsaData | undefined
|
|
55
|
+
if (result) {
|
|
56
|
+
return {
|
|
57
|
+
msa: result.msa,
|
|
58
|
+
tree: result.tree,
|
|
59
|
+
treeMetadata: result.treeMetadata,
|
|
118
60
|
}
|
|
119
|
-
} catch (e) {
|
|
120
|
-
console.warn('Failed to store MSA data:', e)
|
|
121
|
-
resolve(false)
|
|
122
61
|
}
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export async function retrieveMsaData(
|
|
127
|
-
id: string,
|
|
128
|
-
): Promise<{ msa?: string; tree?: string; treeMetadata?: string } | undefined> {
|
|
129
|
-
const db = await openDB()
|
|
130
|
-
if (!db) {
|
|
62
|
+
return undefined
|
|
63
|
+
} catch (e) {
|
|
64
|
+
console.warn('Failed to retrieve MSA data:', e)
|
|
131
65
|
return undefined
|
|
132
66
|
}
|
|
133
|
-
|
|
134
|
-
return new Promise(resolve => {
|
|
135
|
-
try {
|
|
136
|
-
const transaction = db.transaction(STORE_NAME, 'readonly')
|
|
137
|
-
const store = transaction.objectStore(STORE_NAME)
|
|
138
|
-
const request = store.get(id)
|
|
139
|
-
|
|
140
|
-
request.addEventListener('error', () => {
|
|
141
|
-
console.warn('Failed to retrieve MSA data:', request.error)
|
|
142
|
-
resolve(undefined)
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
request.onsuccess = () => {
|
|
146
|
-
const result = request.result as StoredMsaData | undefined
|
|
147
|
-
if (result) {
|
|
148
|
-
resolve({
|
|
149
|
-
msa: result.msa,
|
|
150
|
-
tree: result.tree,
|
|
151
|
-
treeMetadata: result.treeMetadata,
|
|
152
|
-
})
|
|
153
|
-
} else {
|
|
154
|
-
resolve(undefined)
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
} catch (e) {
|
|
158
|
-
console.warn('Failed to retrieve MSA data:', e)
|
|
159
|
-
resolve(undefined)
|
|
160
|
-
}
|
|
161
|
-
})
|
|
162
67
|
}
|
|
163
68
|
|
|
164
69
|
export async function deleteMsaData(id: string) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
70
|
+
try {
|
|
71
|
+
const db = await getDB()
|
|
72
|
+
await db.delete(STORE_NAME, id)
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.warn('Failed to delete MSA data:', e)
|
|
168
75
|
}
|
|
169
|
-
|
|
170
|
-
return new Promise<void>(resolve => {
|
|
171
|
-
try {
|
|
172
|
-
const transaction = db.transaction(STORE_NAME, 'readwrite')
|
|
173
|
-
const store = transaction.objectStore(STORE_NAME)
|
|
174
|
-
const request = store.delete(id)
|
|
175
|
-
|
|
176
|
-
request.addEventListener('error', () => {
|
|
177
|
-
console.warn('Failed to delete MSA data:', request.error)
|
|
178
|
-
resolve()
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
request.onsuccess = () => {
|
|
182
|
-
resolve()
|
|
183
|
-
}
|
|
184
|
-
} catch (e) {
|
|
185
|
-
console.warn('Failed to delete MSA data:', e)
|
|
186
|
-
resolve()
|
|
187
|
-
}
|
|
188
|
-
})
|
|
189
76
|
}
|
|
190
77
|
|
|
191
|
-
// Clean up entries older than the specified age (default 7 days)
|
|
192
78
|
export async function cleanupOldData(maxAgeMs = 7 * 24 * 60 * 60 * 1000) {
|
|
193
|
-
|
|
194
|
-
|
|
79
|
+
try {
|
|
80
|
+
const db = await getDB()
|
|
81
|
+
const cutoffTime = Date.now() - maxAgeMs
|
|
82
|
+
const tx = db.transaction(STORE_NAME, 'readwrite')
|
|
83
|
+
const index = tx.store.index('timestamp')
|
|
84
|
+
let cursor = await index.openCursor(IDBKeyRange.upperBound(cutoffTime))
|
|
85
|
+
let deletedCount = 0
|
|
86
|
+
while (cursor) {
|
|
87
|
+
await cursor.delete()
|
|
88
|
+
deletedCount++
|
|
89
|
+
cursor = await cursor.continue()
|
|
90
|
+
}
|
|
91
|
+
return deletedCount
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.warn('Failed to cleanup old MSA data:', e)
|
|
195
94
|
return 0
|
|
196
95
|
}
|
|
197
|
-
|
|
198
|
-
const cutoffTime = Date.now() - maxAgeMs
|
|
199
|
-
|
|
200
|
-
return new Promise<number>(resolve => {
|
|
201
|
-
try {
|
|
202
|
-
const transaction = db.transaction(STORE_NAME, 'readwrite')
|
|
203
|
-
const store = transaction.objectStore(STORE_NAME)
|
|
204
|
-
const index = store.index('timestamp')
|
|
205
|
-
const range = IDBKeyRange.upperBound(cutoffTime)
|
|
206
|
-
const request = index.openCursor(range)
|
|
207
|
-
|
|
208
|
-
let deletedCount = 0
|
|
209
|
-
|
|
210
|
-
request.addEventListener('error', () => {
|
|
211
|
-
console.warn('Failed to cleanup old MSA data:', request.error)
|
|
212
|
-
resolve(deletedCount)
|
|
213
|
-
})
|
|
214
|
-
|
|
215
|
-
request.onsuccess = event => {
|
|
216
|
-
const cursor = (event.target as IDBRequest<IDBCursorWithValue | null>)
|
|
217
|
-
.result
|
|
218
|
-
if (cursor) {
|
|
219
|
-
cursor.delete()
|
|
220
|
-
deletedCount++
|
|
221
|
-
cursor.continue()
|
|
222
|
-
} else {
|
|
223
|
-
resolve(deletedCount)
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
} catch (e) {
|
|
227
|
-
console.warn('Failed to cleanup old MSA data:', e)
|
|
228
|
-
resolve(0)
|
|
229
|
-
}
|
|
230
|
-
})
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Check if IndexedDB storage is available
|
|
234
|
-
export function isIndexedDBAvailable() {
|
|
235
|
-
return checkIndexedDBAvailable()
|
|
236
96
|
}
|