jbrowse-plugin-msaview 2.5.2 → 2.6.1
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/LaunchMsaViewExtensionPoint/index.js +4 -2
- package/dist/MsaViewPanel/afterCreateAutoruns.js +14 -1
- package/dist/MsaViewPanel/fetchIndexedMsa.d.ts +6 -0
- package/dist/MsaViewPanel/fetchIndexedMsa.js +36 -0
- package/dist/MsaViewPanel/types.d.ts +4 -0
- package/dist/jbrowse-plugin-msaview.umd.production.min.js +29 -28
- package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
- package/src/LaunchMsaViewExtensionPoint/index.ts +7 -1
- package/src/MsaViewPanel/afterCreateAutoruns.ts +22 -1
- package/src/MsaViewPanel/fetchIndexedMsa.ts +47 -0
- package/src/MsaViewPanel/types.ts +7 -0
- package/src/version.ts +1 -1
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.6.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.6.1';
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.6.1",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "jbrowse-plugin-msaview",
|
|
5
5
|
"repository": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@emotion/styled": "^11.14.1",
|
|
20
|
+
"@gmod/bgzf-filehandle": "^6.2.0",
|
|
20
21
|
"g2p_mapper": "^2.1.5",
|
|
21
22
|
"idb": "^8.0.3",
|
|
22
23
|
"pako-esm2": "^2.0.2",
|
|
@@ -11,6 +11,8 @@ export default function LaunchMsaViewExtensionPointF(
|
|
|
11
11
|
session,
|
|
12
12
|
data,
|
|
13
13
|
msaFileLocation,
|
|
14
|
+
msaIndexedLocation,
|
|
15
|
+
msaName,
|
|
14
16
|
treeFileLocation,
|
|
15
17
|
connectedViewId,
|
|
16
18
|
connectedFeature,
|
|
@@ -29,6 +31,8 @@ export default function LaunchMsaViewExtensionPointF(
|
|
|
29
31
|
session: AbstractSessionModel
|
|
30
32
|
data?: { msa: string; tree?: string }
|
|
31
33
|
msaFileLocation?: { uri: string }
|
|
34
|
+
msaIndexedLocation?: { uri: string }
|
|
35
|
+
msaName?: string
|
|
32
36
|
treeFileLocation?: { uri: string }
|
|
33
37
|
connectedViewId?: string
|
|
34
38
|
connectedFeature?: Record<string, unknown>
|
|
@@ -44,7 +48,7 @@ export default function LaunchMsaViewExtensionPointF(
|
|
|
44
48
|
querySeqName?: string
|
|
45
49
|
highlightColumns?: number[]
|
|
46
50
|
}) => {
|
|
47
|
-
if (!data && !msaFileLocation) {
|
|
51
|
+
if (!data && !msaFileLocation && !msaIndexedLocation) {
|
|
48
52
|
throw new Error(
|
|
49
53
|
'No MSA data or file location provided when launching MSA view',
|
|
50
54
|
)
|
|
@@ -68,6 +72,8 @@ export default function LaunchMsaViewExtensionPointF(
|
|
|
68
72
|
msaData: data?.msa,
|
|
69
73
|
treeData: data?.tree,
|
|
70
74
|
msaUrl: msaFileLocation?.uri,
|
|
75
|
+
msaIndexedLocation,
|
|
76
|
+
msaName,
|
|
71
77
|
treeUrl: treeFileLocation?.uri,
|
|
72
78
|
querySeqName,
|
|
73
79
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getSession } from '@jbrowse/core/util'
|
|
2
2
|
|
|
3
3
|
import { doLaunchBlast } from './doLaunchBlast'
|
|
4
|
+
import { fetchIndexedMsa } from './fetchIndexedMsa'
|
|
4
5
|
import { genomeToMSA } from './genomeToMSA'
|
|
5
6
|
import { loadProteinDomains } from './loadProteinDomains'
|
|
6
7
|
import {
|
|
@@ -133,7 +134,15 @@ export function processInit(self: JBrowsePluginMsaViewModel) {
|
|
|
133
134
|
void (async () => {
|
|
134
135
|
try {
|
|
135
136
|
self.setError(undefined)
|
|
136
|
-
const {
|
|
137
|
+
const {
|
|
138
|
+
msaData,
|
|
139
|
+
msaUrl,
|
|
140
|
+
msaIndexedLocation,
|
|
141
|
+
msaName,
|
|
142
|
+
treeData,
|
|
143
|
+
treeUrl,
|
|
144
|
+
querySeqName,
|
|
145
|
+
} = init
|
|
137
146
|
|
|
138
147
|
if (msaUrl) {
|
|
139
148
|
const id = getUniprotIdFromAlphaFoldUrl(msaUrl)
|
|
@@ -156,6 +165,18 @@ export function processInit(self: JBrowsePluginMsaViewModel) {
|
|
|
156
165
|
}
|
|
157
166
|
const data = await response.text()
|
|
158
167
|
self.setMSA(data)
|
|
168
|
+
} else if (msaIndexedLocation && msaName) {
|
|
169
|
+
const fasta = await fetchIndexedMsa({
|
|
170
|
+
location: msaIndexedLocation,
|
|
171
|
+
name: msaName,
|
|
172
|
+
})
|
|
173
|
+
if (fasta) {
|
|
174
|
+
self.setMSA(fasta)
|
|
175
|
+
} else {
|
|
176
|
+
throw new Error(
|
|
177
|
+
`No alignment named ${msaName} in ${msaIndexedLocation.uri}`,
|
|
178
|
+
)
|
|
179
|
+
}
|
|
159
180
|
}
|
|
160
181
|
|
|
161
182
|
if (treeData) {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { BgzfFilehandle } from '@gmod/bgzf-filehandle'
|
|
2
|
+
import { openLocation } from '@jbrowse/core/util/io'
|
|
3
|
+
|
|
4
|
+
// Pull one transcript's whole multiple-alignment out of a single bgzip file
|
|
5
|
+
// keyed by NAME. Given the `.fa.gz` uri, the bgzip index (`.gzi`) and name index
|
|
6
|
+
// (`.idx`, a TSV `name<TAB>offset<TAB>length` of each block's uncompressed byte
|
|
7
|
+
// offset + length) are found by suffix. We fetch the small `.idx` once, look up
|
|
8
|
+
// the name, and random-read just that block — already valid FASTA
|
|
9
|
+
// (`>hg38\nSEQ\n>panTro4\nSEQ\n...`). One genome-scale alignment serves any gene
|
|
10
|
+
// with no per-gene files or coordinates. See react-msaview's gene-explorer.
|
|
11
|
+
export async function fetchIndexedMsa({
|
|
12
|
+
location,
|
|
13
|
+
name,
|
|
14
|
+
}: {
|
|
15
|
+
location: { uri: string }
|
|
16
|
+
name: string
|
|
17
|
+
}) {
|
|
18
|
+
const open = (uri: string) =>
|
|
19
|
+
openLocation({ uri, locationType: 'UriLocation' as const })
|
|
20
|
+
|
|
21
|
+
const idxText = await open(`${location.uri}.idx`).readFile('utf8')
|
|
22
|
+
const entry = lookup(idxText, name)
|
|
23
|
+
if (entry) {
|
|
24
|
+
const fh = new BgzfFilehandle({
|
|
25
|
+
filehandle: open(location.uri),
|
|
26
|
+
gziFilehandle: open(`${location.uri}.gzi`),
|
|
27
|
+
})
|
|
28
|
+
const bytes = await fh.read(entry.length, entry.offset)
|
|
29
|
+
return new TextDecoder().decode(bytes).trim()
|
|
30
|
+
}
|
|
31
|
+
return undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ids are matched versionless, so version drift between the alignment build and
|
|
35
|
+
// the live annotation never breaks the lookup
|
|
36
|
+
const versionless = (s: string) => s.replace(/\.\d+$/, '')
|
|
37
|
+
|
|
38
|
+
function lookup(idxText: string, name: string) {
|
|
39
|
+
const want = versionless(name)
|
|
40
|
+
for (const line of idxText.split('\n')) {
|
|
41
|
+
const [id, offset, length] = line.split('\t')
|
|
42
|
+
if (id && versionless(id) === want) {
|
|
43
|
+
return { offset: Number(offset), length: Number(length) }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return undefined
|
|
47
|
+
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export interface MsaViewInitState {
|
|
2
2
|
msaData?: string
|
|
3
3
|
msaUrl?: string
|
|
4
|
+
// a single bgzip `.fa.gz` of per-transcript FASTA blocks; its `.gzi` and name
|
|
5
|
+
// index `.idx` (name<TAB>offset<TAB>length) are found by suffix. `msaName`
|
|
6
|
+
// selects one transcript's block by name (a random read), so one genome-scale
|
|
7
|
+
// alignment serves any gene without per-gene files or coordinates. See
|
|
8
|
+
// react-msaview's gene-explorer.
|
|
9
|
+
msaIndexedLocation?: { uri: string }
|
|
10
|
+
msaName?: string
|
|
4
11
|
treeData?: string
|
|
5
12
|
treeUrl?: string
|
|
6
13
|
querySeqName?: string
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.6.1'
|