jbrowse-plugin-msaview 2.6.7 → 2.7.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/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +0 -3
- package/dist/LaunchMsaView/components/ManualMSALoader/launchView.d.ts +2 -3
- package/dist/LaunchMsaView/components/ManualMSALoader/launchView.js +3 -2
- package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +10 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.d.ts +2 -1
- package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js +2 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +0 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.d.ts +2 -3
- package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.js +3 -2
- package/dist/LaunchMsaView/components/useTranscriptSelection.js +14 -11
- package/dist/LaunchMsaView/index.js +19 -11
- package/dist/MsaViewPanel/model.d.ts +464 -135
- package/dist/MsaViewPanel/model.js +6 -3
- package/dist/jbrowse-plugin-msaview.umd.production.min.js +28 -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 +20 -22
- package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +0 -3
- package/src/LaunchMsaView/components/ManualMSALoader/launchView.ts +4 -8
- package/src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx +17 -1
- package/src/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.ts +3 -0
- package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +0 -1
- package/src/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.ts +4 -4
- package/src/LaunchMsaView/components/useTranscriptSelection.ts +16 -16
- package/src/LaunchMsaView/index.ts +62 -37
- package/src/MsaViewPanel/model.ts +6 -6
- 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.7.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.7.0';
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.7.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "jbrowse-plugin-msaview",
|
|
5
5
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@gmod/bgzf-filehandle": "^6.2.0",
|
|
21
21
|
"g2p_mapper": "^2.1.5",
|
|
22
22
|
"idb": "^8.0.3",
|
|
23
|
-
"react-msaview": "^5.
|
|
23
|
+
"react-msaview": "^5.6.1",
|
|
24
24
|
"swr": "^2.4.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
@@ -28,39 +28,37 @@
|
|
|
28
28
|
"@eslint/js": "^10.0.1",
|
|
29
29
|
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
|
30
30
|
"@jbrowse/core": "^4.3.0",
|
|
31
|
-
"@jbrowse/mobx-state-tree": "^5.
|
|
31
|
+
"@jbrowse/mobx-state-tree": "^5.13.0",
|
|
32
32
|
"@jbrowse/plugin-linear-genome-view": "^4.3.0",
|
|
33
|
-
"@mui/icons-material": "^
|
|
34
|
-
"@mui/material": "^
|
|
35
|
-
"@mui/system": "^
|
|
36
|
-
"@mui/x-data-grid": "^
|
|
37
|
-
"@types/node": "^
|
|
33
|
+
"@mui/icons-material": "^9.2.0",
|
|
34
|
+
"@mui/material": "^9.2.0",
|
|
35
|
+
"@mui/system": "^9.2.0",
|
|
36
|
+
"@mui/x-data-grid": "^9.10.0",
|
|
37
|
+
"@types/node": "^26.1.1",
|
|
38
38
|
"@types/react": "^19.2.17",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^8.62.0",
|
|
40
|
-
"@typescript-eslint/parser": "^8.62.0",
|
|
41
39
|
"esbuild": "^0.28.1",
|
|
42
|
-
"eslint": "^10.
|
|
43
|
-
"eslint-plugin-import-x": "^4.17.
|
|
40
|
+
"eslint": "^10.7.0",
|
|
41
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
44
42
|
"eslint-plugin-react": "^7.37.5",
|
|
45
43
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
46
|
-
"eslint-plugin-unicorn": "^
|
|
44
|
+
"eslint-plugin-unicorn": "^72.0.0",
|
|
47
45
|
"mobx": "^6.16.1",
|
|
48
46
|
"mobx-react": "^9.2.2",
|
|
49
|
-
"msa-parsers": "^5.
|
|
47
|
+
"msa-parsers": "^5.6.1",
|
|
50
48
|
"pixelmatch": "^7.2.0",
|
|
51
49
|
"pngjs": "^7.0.0",
|
|
52
|
-
"prettier": "^3.
|
|
53
|
-
"pretty-bytes": "^7.1.
|
|
54
|
-
"puppeteer": "^25.
|
|
55
|
-
"react": "^19.2.
|
|
56
|
-
"react-dom": "^19.2.
|
|
50
|
+
"prettier": "^3.9.6",
|
|
51
|
+
"pretty-bytes": "^7.1.1",
|
|
52
|
+
"puppeteer": "^25.3.0",
|
|
53
|
+
"react": "^19.2.8",
|
|
54
|
+
"react-dom": "^19.2.8",
|
|
57
55
|
"rimraf": "^6.1.3",
|
|
58
56
|
"rxjs": "^7.8.2",
|
|
59
57
|
"serve": "^14.2.6",
|
|
60
58
|
"tss-react": "^4.9.21",
|
|
61
|
-
"typescript": "^6.0.
|
|
62
|
-
"typescript-eslint": "^8.
|
|
63
|
-
"vitest": "^4.1.
|
|
59
|
+
"typescript": "^6.0.2",
|
|
60
|
+
"typescript-eslint": "^8.65.0",
|
|
61
|
+
"vitest": "^4.1.10"
|
|
64
62
|
},
|
|
65
63
|
"scripts": {
|
|
66
64
|
"clean": "rimraf dist",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
|
|
3
3
|
import { FileSelector } from '@jbrowse/core/ui'
|
|
4
|
-
import { getSession } from '@jbrowse/core/util'
|
|
5
4
|
import {
|
|
6
5
|
Alert,
|
|
7
6
|
FormControl,
|
|
@@ -56,7 +55,6 @@ const ManualMSALoader = observer(function PreLoadedMSA2({
|
|
|
56
55
|
feature: Feature
|
|
57
56
|
handleClose: () => void
|
|
58
57
|
}) {
|
|
59
|
-
const session = getSession(model)
|
|
60
58
|
const view = getLinearGenomeView(model)
|
|
61
59
|
const { classes } = useStyles()
|
|
62
60
|
const [launchViewError, setLaunchViewError] = useState<unknown>()
|
|
@@ -179,7 +177,6 @@ const ManualMSALoader = observer(function PreLoadedMSA2({
|
|
|
179
177
|
if (selectedTranscript) {
|
|
180
178
|
setLaunchViewError(undefined)
|
|
181
179
|
launchView({
|
|
182
|
-
session,
|
|
183
180
|
newViewTitle: getGeneDisplayName(selectedTranscript),
|
|
184
181
|
view,
|
|
185
182
|
feature: selectedTranscript,
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
FileLocation,
|
|
5
|
-
} from '@jbrowse/core/util'
|
|
1
|
+
import { getSession } from '@jbrowse/core/util'
|
|
2
|
+
|
|
3
|
+
import type { Feature, FileLocation } from '@jbrowse/core/util'
|
|
6
4
|
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
7
5
|
|
|
8
6
|
export function launchView({
|
|
9
|
-
session,
|
|
10
7
|
newViewTitle,
|
|
11
8
|
view,
|
|
12
9
|
feature,
|
|
@@ -15,7 +12,6 @@ export function launchView({
|
|
|
15
12
|
querySeqName,
|
|
16
13
|
data,
|
|
17
14
|
}: {
|
|
18
|
-
session: AbstractSessionModel
|
|
19
15
|
newViewTitle: string
|
|
20
16
|
view: LinearGenomeViewModel
|
|
21
17
|
feature: Feature
|
|
@@ -27,7 +23,7 @@ export function launchView({
|
|
|
27
23
|
tree?: string
|
|
28
24
|
}
|
|
29
25
|
}) {
|
|
30
|
-
|
|
26
|
+
getSession(view).addView('MsaView', {
|
|
31
27
|
type: 'MsaView',
|
|
32
28
|
displayName: newViewTitle,
|
|
33
29
|
connectedViewId: view.id,
|
|
@@ -16,7 +16,12 @@ import { makeStyles } from 'tss-react/mui'
|
|
|
16
16
|
|
|
17
17
|
import { blastLaunchViewFromCache } from './blastLaunchView'
|
|
18
18
|
import { useCachedBlastResults } from './useCachedBlastResults'
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
featureMatchesId,
|
|
21
|
+
getGeneIdentifiers,
|
|
22
|
+
getLinearGenomeView,
|
|
23
|
+
getSortedTranscriptFeatures,
|
|
24
|
+
} from '../../util'
|
|
20
25
|
|
|
21
26
|
import type { CachedBlastResult } from '../../../utils/blastCache'
|
|
22
27
|
import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
|
|
@@ -65,10 +70,21 @@ const CachedBlastResults = observer(function ({
|
|
|
65
70
|
useCachedBlastResults(geneIds)
|
|
66
71
|
|
|
67
72
|
const handleUseCached = (cached: CachedBlastResult) => {
|
|
73
|
+
// reconnect the cached MSA to the genome: the cached query row is named
|
|
74
|
+
// 'QUERY' (react-msaview's default querySeqName) and corresponds to the
|
|
75
|
+
// transcript stored as transcriptId. Resolving it here restores the
|
|
76
|
+
// MSA<->genome navigation and hover-sync a fresh BLAST gets.
|
|
77
|
+
const { transcriptId } = cached
|
|
78
|
+
const transcript = transcriptId
|
|
79
|
+
? getSortedTranscriptFeatures(feature).find(t =>
|
|
80
|
+
featureMatchesId(t, transcriptId),
|
|
81
|
+
)
|
|
82
|
+
: undefined
|
|
68
83
|
blastLaunchViewFromCache({
|
|
69
84
|
view,
|
|
70
85
|
cached,
|
|
71
86
|
newViewTitle: `BLAST - ${getResultDisplayName(cached)}`,
|
|
87
|
+
connectedFeature: transcript?.toJSON(),
|
|
72
88
|
})
|
|
73
89
|
handleClose()
|
|
74
90
|
}
|
|
@@ -32,15 +32,18 @@ export function blastLaunchViewFromCache({
|
|
|
32
32
|
newViewTitle,
|
|
33
33
|
view,
|
|
34
34
|
cached,
|
|
35
|
+
connectedFeature,
|
|
35
36
|
}: {
|
|
36
37
|
newViewTitle: string
|
|
37
38
|
view: LinearGenomeViewModel
|
|
38
39
|
cached: CachedBlastResult
|
|
40
|
+
connectedFeature?: ReturnType<Feature['toJSON']>
|
|
39
41
|
}) {
|
|
40
42
|
getSession(view).addView('MsaView', {
|
|
41
43
|
type: 'MsaView',
|
|
42
44
|
displayName: newViewTitle,
|
|
43
45
|
connectedViewId: view.id,
|
|
46
|
+
connectedFeature,
|
|
44
47
|
drawNodeBubbles: true,
|
|
45
48
|
colWidth: 10,
|
|
46
49
|
rowHeight: 12,
|
|
@@ -139,7 +139,6 @@ const PreLoadedMSA = observer(function ({
|
|
|
139
139
|
if (selectedTranscript && msaData) {
|
|
140
140
|
const querySeqName = `${selectedId}_${assemblyNames[0]}`
|
|
141
141
|
preCalculatedLaunchView({
|
|
142
|
-
session,
|
|
143
142
|
newViewTitle: getGeneDisplayName(selectedTranscript),
|
|
144
143
|
view,
|
|
145
144
|
querySeqName,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { getSession } from '@jbrowse/core/util'
|
|
2
|
+
|
|
3
|
+
import type { Feature } from '@jbrowse/core/util'
|
|
2
4
|
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
3
5
|
|
|
4
6
|
export function preCalculatedLaunchView({
|
|
5
|
-
session,
|
|
6
7
|
newViewTitle,
|
|
7
8
|
view,
|
|
8
9
|
feature,
|
|
@@ -10,13 +11,12 @@ export function preCalculatedLaunchView({
|
|
|
10
11
|
querySeqName,
|
|
11
12
|
}: {
|
|
12
13
|
data: { msa: string }
|
|
13
|
-
session: AbstractSessionModel
|
|
14
14
|
newViewTitle: string
|
|
15
15
|
view: LinearGenomeViewModel
|
|
16
16
|
feature: Feature
|
|
17
17
|
querySeqName: string
|
|
18
18
|
}) {
|
|
19
|
-
|
|
19
|
+
getSession(view).addView('MsaView', {
|
|
20
20
|
type: 'MsaView',
|
|
21
21
|
displayName: newViewTitle,
|
|
22
22
|
treeAreaWidth: 200,
|
|
@@ -5,24 +5,25 @@ import { useFeatureSequence } from './useFeatureSequence'
|
|
|
5
5
|
|
|
6
6
|
import type { Feature } from '@jbrowse/core/util'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// Keep the current selection if it's valid for the given validIds, otherwise
|
|
9
|
+
// fall back to the first valid option (or the current id if none qualify). With
|
|
10
|
+
// no validIds constraint the current selection always stands.
|
|
11
|
+
function pickSelectedId(
|
|
9
12
|
currentId: string,
|
|
10
13
|
options: Feature[],
|
|
11
14
|
validIds: string[] | undefined,
|
|
12
|
-
): string
|
|
13
|
-
if (validIds
|
|
14
|
-
|
|
15
|
-
const currentIsValid =
|
|
16
|
-
currentFeature &&
|
|
17
|
-
validIds.some(id => featureMatchesId(currentFeature, id))
|
|
18
|
-
if (currentFeature && !currentIsValid) {
|
|
19
|
-
const validOption = options.find(opt =>
|
|
20
|
-
validIds.some(id => featureMatchesId(opt, id)),
|
|
21
|
-
)
|
|
22
|
-
return validOption ? getId(validOption) : undefined
|
|
23
|
-
}
|
|
15
|
+
): string {
|
|
16
|
+
if (!validIds?.length) {
|
|
17
|
+
return currentId
|
|
24
18
|
}
|
|
25
|
-
|
|
19
|
+
const isValid = (opt: Feature) =>
|
|
20
|
+
validIds.some(id => featureMatchesId(opt, id))
|
|
21
|
+
const current = options.find(opt => getId(opt) === currentId)
|
|
22
|
+
if (current && isValid(current)) {
|
|
23
|
+
return currentId
|
|
24
|
+
}
|
|
25
|
+
const firstValid = options.find(isValid)
|
|
26
|
+
return firstValid ? getId(firstValid) : currentId
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export function useTranscriptSelection({
|
|
@@ -36,8 +37,7 @@ export function useTranscriptSelection({
|
|
|
36
37
|
}) {
|
|
37
38
|
const options = useMemo(() => getSortedTranscriptFeatures(feature), [feature])
|
|
38
39
|
const [selectedId, setSelectedId] = useState(() => getId(options[0]))
|
|
39
|
-
const validatedSelectedId =
|
|
40
|
-
findValidSelection(selectedId, options, validIds) ?? selectedId
|
|
40
|
+
const validatedSelectedId = pickSelectedId(selectedId, options, validIds)
|
|
41
41
|
const selectedTranscript = options.find(
|
|
42
42
|
val => getId(val) === validatedSelectedId,
|
|
43
43
|
)
|
|
@@ -14,45 +14,70 @@ function isDisplay(elt: { name: string }): elt is DisplayType {
|
|
|
14
14
|
return elt.name === 'LinearBasicDisplay'
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// The canvas LinearBasicDisplay (JBrowse >=4.3) exposes the right-clicked
|
|
18
|
+
// feature via contextMenuInfo + async fetchFullFeature rather than a synchronous
|
|
19
|
+
// feature object.
|
|
20
|
+
interface ContextMenuInfo {
|
|
21
|
+
item: { featureId: string; type?: string }
|
|
22
|
+
displayedRegionIndex: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface DisplayModel {
|
|
26
|
+
contextMenuItems: () => MenuItem[]
|
|
27
|
+
contextMenuInfo?: ContextMenuInfo
|
|
28
|
+
isGeneLike: boolean
|
|
29
|
+
fetchFullFeature: (
|
|
30
|
+
featureId: string,
|
|
31
|
+
displayedRegionIndex: number,
|
|
32
|
+
) => Promise<Feature | undefined>
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
function extendStateModel(stateModel: IAnyModelType) {
|
|
18
|
-
return stateModel.views(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
return stateModel.views((self: DisplayModel) => {
|
|
37
|
+
const superContextMenuItems = self.contextMenuItems
|
|
38
|
+
return {
|
|
39
|
+
contextMenuItems() {
|
|
40
|
+
const track = getContainingTrack(self)
|
|
41
|
+
const session = getSession(track)
|
|
42
|
+
const info = self.contextMenuInfo
|
|
43
|
+
const showMsaMenuItem = info && self.isGeneLike
|
|
44
|
+
return [
|
|
45
|
+
...superContextMenuItems(),
|
|
46
|
+
...(showMsaMenuItem
|
|
47
|
+
? [
|
|
48
|
+
{
|
|
49
|
+
label: 'Launch MSA view',
|
|
50
|
+
icon: AddIcon,
|
|
51
|
+
onClick: () => {
|
|
52
|
+
self
|
|
53
|
+
.fetchFullFeature(
|
|
54
|
+
info.item.featureId,
|
|
55
|
+
info.displayedRegionIndex,
|
|
56
|
+
)
|
|
57
|
+
.then(feature => {
|
|
58
|
+
if (feature) {
|
|
59
|
+
session.queueDialog(handleClose => [
|
|
60
|
+
LaunchMsaViewDialog,
|
|
61
|
+
{ model: track, handleClose, feature },
|
|
62
|
+
])
|
|
63
|
+
} else {
|
|
64
|
+
session.notify(
|
|
65
|
+
'Could not load feature for MSA view',
|
|
66
|
+
'warning',
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
.catch((e: unknown) => {
|
|
71
|
+
session.notifyError(`${e}`, e)
|
|
72
|
+
})
|
|
48
73
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
)
|
|
74
|
+
},
|
|
75
|
+
]
|
|
76
|
+
: []),
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
})
|
|
56
81
|
}
|
|
57
82
|
|
|
58
83
|
export default function LaunchMsaViewF(pluginManager: PluginManager) {
|
|
@@ -77,7 +77,7 @@ export default function stateModelFactory() {
|
|
|
77
77
|
/**
|
|
78
78
|
* #property
|
|
79
79
|
*/
|
|
80
|
-
querySeqName: 'QUERY',
|
|
80
|
+
querySeqName: types.stripDefault(types.string, 'QUERY'),
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* #property
|
|
@@ -87,7 +87,7 @@ export default function stateModelFactory() {
|
|
|
87
87
|
/**
|
|
88
88
|
* #property
|
|
89
89
|
*/
|
|
90
|
-
zoomToBaseLevel: false,
|
|
90
|
+
zoomToBaseLevel: types.stripDefault(types.boolean, false),
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* #property
|
|
@@ -207,9 +207,10 @@ export default function stateModelFactory() {
|
|
|
207
207
|
* #getter
|
|
208
208
|
*/
|
|
209
209
|
get connectedHighlights(): IRegion[] {
|
|
210
|
-
return [
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
return [
|
|
211
|
+
this.connectedHoverHighlight,
|
|
212
|
+
this.connectedClickHighlight,
|
|
213
|
+
].filter((r): r is IRegion => r !== undefined)
|
|
213
214
|
},
|
|
214
215
|
}))
|
|
215
216
|
|
|
@@ -312,7 +313,6 @@ export default function stateModelFactory() {
|
|
|
312
313
|
connectedView.centerAt(r2.start, r2.refName)
|
|
313
314
|
}
|
|
314
315
|
},
|
|
315
|
-
|
|
316
316
|
}))
|
|
317
317
|
.actions(self => {
|
|
318
318
|
const superSetMouseClickPos = self.setMouseClickPos.bind(self)
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.7.0'
|