jbrowse-plugin-protein3d 0.0.3 → 0.0.5
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 +3 -9
- package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +1 -1
- package/dist/AddHighlightModel/HighlightComponents.d.ts +1 -2
- package/dist/AddHighlightModel/HighlightComponents.js.map +1 -1
- package/dist/AddHighlightModel/ProteinToGenomeClickHighlight.js +4 -3
- package/dist/AddHighlightModel/ProteinToGenomeClickHighlight.js.map +1 -1
- package/dist/AddHighlightModel/ProteinToGenomeHoverHighlight.d.ts +1 -2
- package/dist/AddHighlightModel/ProteinToGenomeHoverHighlight.js +4 -3
- package/dist/AddHighlightModel/ProteinToGenomeHoverHighlight.js.map +1 -1
- package/dist/AddHighlightModel/util.js +1 -1
- package/dist/AddHighlightModel/util.js.map +1 -1
- package/dist/AlphaFoldConfidenceAdapter/AlphaFoldConfidenceAdapter.d.ts +16 -0
- package/dist/AlphaFoldConfidenceAdapter/AlphaFoldConfidenceAdapter.js +43 -0
- package/dist/AlphaFoldConfidenceAdapter/AlphaFoldConfidenceAdapter.js.map +1 -0
- package/dist/AlphaFoldConfidenceAdapter/configSchema.d.ts +13 -0
- package/dist/AlphaFoldConfidenceAdapter/configSchema.js +16 -0
- package/dist/AlphaFoldConfidenceAdapter/configSchema.js.map +1 -0
- package/dist/AlphaFoldConfidenceAdapter/index.d.ts +2 -0
- package/dist/AlphaFoldConfidenceAdapter/index.js +11 -0
- package/dist/AlphaFoldConfidenceAdapter/index.js.map +1 -0
- package/dist/AlphaMissensePathogenicityAdapter/AlphaMissensePathogenicityAdapter.d.ts +30 -0
- package/dist/AlphaMissensePathogenicityAdapter/AlphaMissensePathogenicityAdapter.js +78 -0
- package/dist/AlphaMissensePathogenicityAdapter/AlphaMissensePathogenicityAdapter.js.map +1 -0
- package/dist/AlphaMissensePathogenicityAdapter/configSchema.d.ts +13 -0
- package/dist/AlphaMissensePathogenicityAdapter/configSchema.js +16 -0
- package/dist/AlphaMissensePathogenicityAdapter/configSchema.js.map +1 -0
- package/dist/AlphaMissensePathogenicityAdapter/index.d.ts +2 -0
- package/dist/AlphaMissensePathogenicityAdapter/index.js +11 -0
- package/dist/AlphaMissensePathogenicityAdapter/index.js.map +1 -0
- package/dist/LaunchProteinView/components/AlphaFoldDBSearch.js +162 -13
- package/dist/LaunchProteinView/components/AlphaFoldDBSearch.js.map +1 -1
- package/dist/LaunchProteinView/components/AlphaFoldDBSearchStatus.js +8 -6
- package/dist/LaunchProteinView/components/AlphaFoldDBSearchStatus.js.map +1 -1
- package/dist/LaunchProteinView/components/HelpButton.js +6 -2
- package/dist/LaunchProteinView/components/HelpButton.js.map +1 -1
- package/dist/LaunchProteinView/components/HelpDialog.js +3 -1
- package/dist/LaunchProteinView/components/HelpDialog.js.map +1 -1
- package/dist/LaunchProteinView/components/LaunchProteinViewDialog.js +12 -4
- package/dist/LaunchProteinView/components/LaunchProteinViewDialog.js.map +1 -1
- package/dist/LaunchProteinView/components/MSATable.js +3 -1
- package/dist/LaunchProteinView/components/MSATable.js.map +1 -1
- package/dist/LaunchProteinView/components/ManualUniProtIDEntry.d.ts +8 -0
- package/dist/LaunchProteinView/components/ManualUniProtIDEntry.js +225 -0
- package/dist/LaunchProteinView/components/ManualUniProtIDEntry.js.map +1 -0
- package/dist/LaunchProteinView/components/TranscriptSelector.js +3 -1
- package/dist/LaunchProteinView/components/TranscriptSelector.js.map +1 -1
- package/dist/LaunchProteinView/components/UserProvidedStructure.js +19 -12
- package/dist/LaunchProteinView/components/UserProvidedStructure.js.map +1 -1
- package/dist/LaunchProteinView/components/calculateProteinSequence.js +5 -3
- package/dist/LaunchProteinView/components/calculateProteinSequence.js.map +1 -1
- package/dist/LaunchProteinView/components/useLocalStructureFileSequence.d.ts +1 -1
- package/dist/LaunchProteinView/components/useLocalStructureFileSequence.js +29 -9
- package/dist/LaunchProteinView/components/useLocalStructureFileSequence.js.map +1 -1
- package/dist/LaunchProteinView/components/useRemoteStructureFileSequence.d.ts +1 -1
- package/dist/LaunchProteinView/components/useRemoteStructureFileSequence.js +25 -8
- package/dist/LaunchProteinView/components/useRemoteStructureFileSequence.js.map +1 -1
- package/dist/LaunchProteinView/components/util.js +1 -1
- package/dist/LaunchProteinView/index.js +7 -3
- package/dist/LaunchProteinView/index.js.map +1 -1
- package/dist/ProteinView/{loadStructureFromData.d.ts → addStructureFromData.d.ts} +2 -2
- package/dist/ProteinView/{loadStructureFromData.js → addStructureFromData.js} +3 -8
- package/dist/ProteinView/addStructureFromData.js.map +1 -0
- package/dist/ProteinView/{loadStructureFromURL.d.ts → addStructureFromURL.d.ts} +2 -2
- package/dist/ProteinView/{loadStructureFromURL.js → addStructureFromURL.js} +11 -9
- package/dist/ProteinView/addStructureFromURL.js.map +1 -0
- package/dist/ProteinView/clearSelection.js +1 -1
- package/dist/ProteinView/clearSelection.js.map +1 -1
- package/dist/ProteinView/components/ProteinAlignment.d.ts +2 -2
- package/dist/ProteinView/components/ProteinAlignment.js +37 -26
- package/dist/ProteinView/components/ProteinAlignment.js.map +1 -1
- package/dist/ProteinView/components/ProteinAlignmentHelpButton.d.ts +2 -2
- package/dist/ProteinView/components/ProteinAlignmentHelpButton.js +6 -4
- package/dist/ProteinView/components/ProteinAlignmentHelpButton.js.map +1 -1
- package/dist/ProteinView/components/ProteinAlignmentHelpDialog.js +6 -5
- package/dist/ProteinView/components/ProteinAlignmentHelpDialog.js.map +1 -1
- package/dist/ProteinView/components/ProteinView.js +18 -60
- package/dist/ProteinView/components/ProteinView.js.map +1 -1
- package/dist/ProteinView/components/{Header.js → ProteinViewHeader.js} +29 -12
- package/dist/ProteinView/components/ProteinViewHeader.js.map +1 -0
- package/dist/ProteinView/components/SplitString.d.ts +4 -4
- package/dist/ProteinView/components/SplitString.js +3 -3
- package/dist/ProteinView/components/SplitString.js.map +1 -1
- package/dist/ProteinView/genomeToProtein.d.ts +2 -2
- package/dist/ProteinView/genomeToProtein.js +4 -5
- package/dist/ProteinView/genomeToProtein.js.map +1 -1
- package/dist/ProteinView/highlightResidue.js +2 -2
- package/dist/ProteinView/highlightResidue.js.map +1 -1
- package/dist/ProteinView/launchRemotePairwiseAlignment.d.ts +2 -5
- package/dist/ProteinView/launchRemotePairwiseAlignment.js +7 -3
- package/dist/ProteinView/launchRemotePairwiseAlignment.js.map +1 -1
- package/dist/ProteinView/model.d.ts +492 -160
- package/dist/ProteinView/model.js +62 -246
- package/dist/ProteinView/model.js.map +1 -1
- package/dist/ProteinView/proteinToGenomeMapping.d.ts +6 -6
- package/dist/ProteinView/proteinToGenomeMapping.js +29 -28
- package/dist/ProteinView/proteinToGenomeMapping.js.map +1 -1
- package/dist/ProteinView/selectResidue.js +1 -1
- package/dist/ProteinView/selectResidue.js.map +1 -1
- package/dist/ProteinView/structureModel.d.ts +183 -0
- package/dist/ProteinView/structureModel.js +407 -0
- package/dist/ProteinView/structureModel.js.map +1 -0
- package/dist/ProteinView/useProteinView.d.ts +1 -4
- package/dist/ProteinView/useProteinView.js +3 -15
- package/dist/ProteinView/useProteinView.js.map +1 -1
- package/dist/ProteinView/util.d.ts +3 -3
- package/dist/ProteinView/util.js +8 -6
- package/dist/ProteinView/util.js.map +1 -1
- package/dist/UniProtVariationAdapter/UniProtVariationAdapter.d.ts +15 -0
- package/dist/UniProtVariationAdapter/UniProtVariationAdapter.js +55 -0
- package/dist/UniProtVariationAdapter/UniProtVariationAdapter.js.map +1 -0
- package/dist/UniProtVariationAdapter/configSchema.d.ts +17 -0
- package/dist/UniProtVariationAdapter/configSchema.js +20 -0
- package/dist/UniProtVariationAdapter/configSchema.js.map +1 -0
- package/dist/UniProtVariationAdapter/index.d.ts +2 -0
- package/dist/UniProtVariationAdapter/index.js +11 -0
- package/dist/UniProtVariationAdapter/index.js.map +1 -0
- package/dist/genomeToTranscriptMapping.d.ts +2 -2
- package/dist/genomeToTranscriptMapping.js +3 -3
- package/dist/genomeToTranscriptMapping.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/jbrowse-plugin-protein3d.umd.production.min.js +2506 -1658
- package/dist/jbrowse-plugin-protein3d.umd.production.min.js.map +4 -4
- package/dist/mappings.d.ts +12 -10
- package/dist/mappings.js +7 -7
- package/dist/mappings.js.map +1 -1
- package/dist/mappings.test.js +7 -5
- package/dist/mappings.test.js.map +1 -1
- package/dist/test_data/gene.d.ts +577 -64
- package/dist/test_data/gene.js +1 -1
- package/dist/test_data/gene.js.map +1 -1
- package/package.json +20 -19
- package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +4 -17
- package/src/AddHighlightModel/HighlightComponents.tsx +1 -3
- package/src/AddHighlightModel/ProteinToGenomeClickHighlight.tsx +17 -14
- package/src/AddHighlightModel/ProteinToGenomeHoverHighlight.tsx +18 -17
- package/src/AddHighlightModel/util.ts +1 -1
- package/src/AlphaFoldConfidenceAdapter/AlphaFoldConfidenceAdapter.ts +63 -0
- package/src/AlphaFoldConfidenceAdapter/configSchema.ts +21 -0
- package/src/AlphaFoldConfidenceAdapter/index.ts +19 -0
- package/src/AlphaMissensePathogenicityAdapter/AlphaMissensePathogenicityAdapter.ts +109 -0
- package/src/AlphaMissensePathogenicityAdapter/configSchema.ts +21 -0
- package/src/AlphaMissensePathogenicityAdapter/index.ts +19 -0
- package/src/LaunchProteinView/components/AlphaFoldDBSearch.tsx +173 -12
- package/src/LaunchProteinView/components/AlphaFoldDBSearchStatus.tsx +8 -6
- package/src/LaunchProteinView/components/HelpButton.tsx +10 -2
- package/src/LaunchProteinView/components/HelpDialog.tsx +6 -1
- package/src/LaunchProteinView/components/LaunchProteinViewDialog.tsx +20 -4
- package/src/LaunchProteinView/components/MSATable.tsx +3 -1
- package/src/LaunchProteinView/components/ManualUniProtIDEntry.tsx +332 -0
- package/src/LaunchProteinView/components/TranscriptSelector.tsx +9 -7
- package/src/LaunchProteinView/components/UserProvidedStructure.tsx +18 -13
- package/src/LaunchProteinView/components/calculateProteinSequence.ts +6 -4
- package/src/LaunchProteinView/components/useLocalStructureFileSequence.ts +28 -9
- package/src/LaunchProteinView/components/useRemoteStructureFileSequence.ts +23 -8
- package/src/LaunchProteinView/components/util.ts +1 -1
- package/src/LaunchProteinView/index.ts +36 -26
- package/src/ProteinView/{loadStructureFromData.ts → addStructureFromData.ts} +2 -8
- package/src/ProteinView/{loadStructureFromURL.ts → addStructureFromURL.ts} +11 -11
- package/src/ProteinView/clearSelection.ts +1 -1
- package/src/ProteinView/components/ProteinAlignment.tsx +51 -35
- package/src/ProteinView/components/ProteinAlignmentHelpButton.tsx +4 -4
- package/src/ProteinView/components/ProteinAlignmentHelpDialog.tsx +15 -11
- package/src/ProteinView/components/ProteinView.tsx +22 -82
- package/src/ProteinView/components/{Header.tsx → ProteinViewHeader.tsx} +44 -23
- package/src/ProteinView/components/SplitString.tsx +8 -8
- package/src/ProteinView/genomeToProtein.ts +5 -9
- package/src/ProteinView/highlightResidue.ts +2 -2
- package/src/ProteinView/launchRemotePairwiseAlignment.ts +6 -3
- package/src/ProteinView/model.ts +75 -287
- package/src/ProteinView/proteinToGenomeMapping.ts +40 -38
- package/src/ProteinView/selectResidue.ts +1 -1
- package/src/ProteinView/structureModel.ts +512 -0
- package/src/ProteinView/useProteinView.ts +2 -19
- package/src/ProteinView/util.ts +20 -9
- package/src/UniProtVariationAdapter/UniProtVariationAdapter.ts +99 -0
- package/src/UniProtVariationAdapter/configSchema.ts +25 -0
- package/src/UniProtVariationAdapter/index.ts +17 -0
- package/src/__snapshots__/mappings.test.ts.snap +224 -224
- package/src/genomeToTranscriptMapping.ts +9 -9
- package/src/index.ts +6 -0
- package/src/mappings.test.ts +7 -5
- package/src/mappings.ts +25 -23
- package/src/test_data/gene.ts +3 -3
- package/dist/ProteinView/components/Header.js.map +0 -1
- package/dist/ProteinView/loadStructureFromData.js.map +0 -1
- package/dist/ProteinView/loadStructureFromURL.js.map +0 -1
- package/dist/ProteinView/useProteinViewClickBehavior.d.ts +0 -8
- package/dist/ProteinView/useProteinViewClickBehavior.js +0 -34
- package/dist/ProteinView/useProteinViewClickBehavior.js.map +0 -1
- package/dist/ProteinView/useProteinViewHoverBehavior.d.ts +0 -6
- package/dist/ProteinView/useProteinViewHoverBehavior.js +0 -31
- package/dist/ProteinView/useProteinViewHoverBehavior.js.map +0 -1
- package/src/ProteinView/useProteinViewClickBehavior.ts +0 -48
- package/src/ProteinView/useProteinViewHoverBehavior.ts +0 -44
- /package/dist/ProteinView/components/{Header.d.ts → ProteinViewHeader.d.ts} +0 -0
|
@@ -2,18 +2,18 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
export default function SplitString({
|
|
4
4
|
str,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
gapSet,
|
|
6
|
+
hoveredPosition,
|
|
7
|
+
showHighlight,
|
|
7
8
|
onMouseOver,
|
|
8
9
|
onClick,
|
|
9
|
-
showHighlight,
|
|
10
10
|
}: {
|
|
11
11
|
str: string
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
gapSet?: Set<number>
|
|
13
|
+
hoveredPosition?: number
|
|
14
|
+
showHighlight: boolean
|
|
14
15
|
onMouseOver?: (arg: number) => void
|
|
15
16
|
onClick?: (arg: number) => void
|
|
16
|
-
showHighlight: boolean
|
|
17
17
|
}) {
|
|
18
18
|
return str.split('').map((d, i) => (
|
|
19
19
|
<span
|
|
@@ -22,9 +22,9 @@ export default function SplitString({
|
|
|
22
22
|
onClick={() => onClick?.(i)}
|
|
23
23
|
style={{
|
|
24
24
|
background:
|
|
25
|
-
|
|
25
|
+
hoveredPosition !== undefined && i === hoveredPosition
|
|
26
26
|
? '#f698'
|
|
27
|
-
:
|
|
27
|
+
: gapSet?.has(i) && showHighlight
|
|
28
28
|
? '#33ff19'
|
|
29
29
|
: undefined,
|
|
30
30
|
}}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { getSession } from '@jbrowse/core/util'
|
|
2
2
|
import { checkHovered } from './util'
|
|
3
|
-
import {
|
|
3
|
+
import { JBrowsePluginProteinStructureModel } from './model'
|
|
4
4
|
|
|
5
5
|
export function genomeToProtein({
|
|
6
6
|
model,
|
|
7
7
|
}: {
|
|
8
|
-
model:
|
|
8
|
+
model: JBrowsePluginProteinStructureModel
|
|
9
9
|
}): number | undefined {
|
|
10
10
|
const { hovered } = getSession(model)
|
|
11
11
|
const { genomeToTranscriptSeqMapping, connectedView } = model
|
|
12
|
-
|
|
13
|
-
!connectedView?.initialized ||
|
|
12
|
+
return !connectedView?.initialized ||
|
|
14
13
|
!genomeToTranscriptSeqMapping ||
|
|
15
14
|
!checkHovered(hovered)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return genomeToTranscriptSeqMapping.g2p[hovered.hoverPosition.coord]
|
|
15
|
+
? undefined
|
|
16
|
+
: genomeToTranscriptSeqMapping.g2p[hovered.hoverPosition.coord]
|
|
21
17
|
}
|
|
@@ -16,8 +16,8 @@ export default function highlightResidue({
|
|
|
16
16
|
selectedResidue: selectedResidue + 1,
|
|
17
17
|
})
|
|
18
18
|
const loci = StructureSelection.toLociWithSourceUnits(sel)
|
|
19
|
-
plugin
|
|
20
|
-
plugin
|
|
19
|
+
plugin.managers.interactivity.lociHighlights.clearHighlights()
|
|
20
|
+
plugin.managers.interactivity.lociHighlights.highlight({
|
|
21
21
|
loci,
|
|
22
22
|
})
|
|
23
23
|
}
|
|
@@ -27,7 +27,7 @@ async function runEmbossMatcher({
|
|
|
27
27
|
})
|
|
28
28
|
const ret = await textfetch(`${base}/emboss_matcher/result/${jobId}/aln`)
|
|
29
29
|
return {
|
|
30
|
-
|
|
30
|
+
pairwiseAlignment: parsePairwise(
|
|
31
31
|
ret
|
|
32
32
|
.split('\n')
|
|
33
33
|
.filter(line => !line.startsWith('#'))
|
|
@@ -61,7 +61,7 @@ async function runEmbossNeedle({
|
|
|
61
61
|
|
|
62
62
|
const ret = await textfetch(`${base}/emboss_needle/result/${jobId}/aln`)
|
|
63
63
|
return {
|
|
64
|
-
|
|
64
|
+
pairwiseAlignment: parsePairwise(
|
|
65
65
|
ret
|
|
66
66
|
.split('\n')
|
|
67
67
|
.filter(line => !line.startsWith('#'))
|
|
@@ -78,15 +78,18 @@ async function wait({
|
|
|
78
78
|
algorithm: string
|
|
79
79
|
onProgress: (arg: string) => void
|
|
80
80
|
}) {
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
81
82
|
while (true) {
|
|
82
83
|
for (let i = 0; i < 10; i++) {
|
|
83
84
|
await timeout(1000)
|
|
84
|
-
onProgress(`Re-checking
|
|
85
|
+
onProgress(`Re-checking pairwiseAlignment to PDB seq1,seq2 in... ${10 - i}`)
|
|
85
86
|
}
|
|
86
87
|
const result = await textfetch(`${base}/${algorithm}/status/${jobId}`)
|
|
87
88
|
|
|
88
89
|
if (result === 'FINISHED') {
|
|
89
90
|
break
|
|
91
|
+
} else if (result.includes('FAILED')) {
|
|
92
|
+
throw new Error('Remote returned FAILED')
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
95
|
}
|
package/src/ProteinView/model.ts
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import { autorun } from 'mobx'
|
|
2
2
|
import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes'
|
|
3
|
-
import { ElementId
|
|
4
|
-
import {
|
|
5
|
-
import { Instance, addDisposer, cast, types } from 'mobx-state-tree'
|
|
6
|
-
import {
|
|
7
|
-
SimpleFeature,
|
|
8
|
-
SimpleFeatureSerialized,
|
|
9
|
-
getSession,
|
|
10
|
-
} from '@jbrowse/core/util'
|
|
11
|
-
import { parsePairwise } from 'clustal-js'
|
|
12
|
-
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
3
|
+
import { ElementId } from '@jbrowse/core/util/types/mst'
|
|
4
|
+
import { Instance, addDisposer, types } from 'mobx-state-tree'
|
|
13
5
|
|
|
14
6
|
// locals
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
structurePositionToAlignmentMap,
|
|
21
|
-
transcriptPositionToAlignmentMap,
|
|
22
|
-
} from '../mappings'
|
|
23
|
-
|
|
24
|
-
type LGV = LinearGenomeViewModel
|
|
25
|
-
type MaybeLGV = LGV | undefined
|
|
7
|
+
import { PluginContext } from 'molstar/lib/mol-plugin/context'
|
|
8
|
+
import { addStructureFromData } from './addStructureFromData'
|
|
9
|
+
import { addStructureFromURL } from './addStructureFromURL'
|
|
10
|
+
import Structure from './structureModel'
|
|
11
|
+
import highlightResidue from './highlightResidue'
|
|
26
12
|
|
|
27
13
|
/**
|
|
28
14
|
* #stateModel Protein3dViewPlugin
|
|
@@ -45,51 +31,18 @@ function stateModelFactory() {
|
|
|
45
31
|
type: types.literal('ProteinView'),
|
|
46
32
|
/**
|
|
47
33
|
* #property
|
|
48
|
-
* url to structure file
|
|
49
|
-
*/
|
|
50
|
-
url: types.maybe(types.string),
|
|
51
|
-
/**
|
|
52
|
-
* #property
|
|
53
|
-
* full string for structure data
|
|
54
34
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* #property
|
|
58
|
-
*/
|
|
59
|
-
clickGenomeHighlights: types.array(Region),
|
|
60
|
-
/**
|
|
61
|
-
* #property
|
|
62
|
-
*/
|
|
63
|
-
hoverGenomeHighlights: types.array(Region),
|
|
35
|
+
structures: types.array(Structure),
|
|
36
|
+
|
|
64
37
|
/**
|
|
65
38
|
* #property
|
|
66
39
|
*/
|
|
67
|
-
showControls:
|
|
40
|
+
showControls: false,
|
|
68
41
|
/**
|
|
69
42
|
* #property
|
|
70
43
|
*/
|
|
71
44
|
height: types.optional(types.number, 650),
|
|
72
|
-
/**
|
|
73
|
-
* #property
|
|
74
|
-
*/
|
|
75
|
-
feature: types.frozen<SimpleFeatureSerialized>(),
|
|
76
|
-
/**
|
|
77
|
-
* #property
|
|
78
|
-
*/
|
|
79
|
-
seq1: types.maybe(types.string),
|
|
80
|
-
/**
|
|
81
|
-
* #property
|
|
82
|
-
*/
|
|
83
|
-
seq2: types.maybe(types.string),
|
|
84
|
-
/**
|
|
85
|
-
* #property
|
|
86
|
-
*/
|
|
87
|
-
alignment: types.frozen<ReturnType<typeof parsePairwise> | undefined>(),
|
|
88
45
|
|
|
89
|
-
/**
|
|
90
|
-
* #property
|
|
91
|
-
*/
|
|
92
|
-
connectedViewId: types.maybe(types.string),
|
|
93
46
|
/**
|
|
94
47
|
* #property
|
|
95
48
|
*/
|
|
@@ -108,123 +61,46 @@ function stateModelFactory() {
|
|
|
108
61
|
/**
|
|
109
62
|
* #volatile
|
|
110
63
|
*/
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* #volatile
|
|
114
|
-
*/
|
|
115
|
-
clickPosition: undefined as
|
|
116
|
-
| {
|
|
117
|
-
structureSeqPos: number
|
|
118
|
-
code: string
|
|
119
|
-
chain: string
|
|
120
|
-
}
|
|
121
|
-
| undefined,
|
|
64
|
+
progress: '',
|
|
122
65
|
/**
|
|
123
66
|
* #volatile
|
|
124
67
|
*/
|
|
125
|
-
|
|
126
|
-
| {
|
|
127
|
-
structureSeqPos: number
|
|
128
|
-
code?: string
|
|
129
|
-
chain?: string
|
|
130
|
-
}
|
|
131
|
-
| undefined,
|
|
68
|
+
error: undefined as unknown,
|
|
132
69
|
/**
|
|
133
70
|
* #volatile
|
|
134
71
|
*/
|
|
135
|
-
|
|
136
|
-
}))
|
|
137
|
-
.views(self => ({
|
|
138
|
-
/**
|
|
139
|
-
* #getter
|
|
140
|
-
*/
|
|
141
|
-
get connectedView() {
|
|
142
|
-
const { views } = getSession(self)
|
|
143
|
-
return views.find(f => f.id === self.connectedViewId) as MaybeLGV
|
|
144
|
-
},
|
|
72
|
+
molstarPluginContext: undefined as PluginContext | undefined,
|
|
145
73
|
}))
|
|
74
|
+
|
|
146
75
|
.actions(self => ({
|
|
147
76
|
/**
|
|
148
77
|
* #action
|
|
149
78
|
*/
|
|
150
|
-
|
|
151
|
-
self.
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* #action
|
|
155
|
-
*/
|
|
156
|
-
setHoveredPosition(arg?: {
|
|
157
|
-
structureSeqPos: number
|
|
158
|
-
chain?: string
|
|
159
|
-
code?: string
|
|
160
|
-
}) {
|
|
161
|
-
self.hoverPosition = arg
|
|
79
|
+
setHeight(n: number) {
|
|
80
|
+
self.height = n
|
|
81
|
+
return n
|
|
162
82
|
},
|
|
163
83
|
/**
|
|
164
84
|
* #action
|
|
165
85
|
*/
|
|
166
|
-
|
|
167
|
-
self.
|
|
168
|
-
self.seq2 = str2
|
|
86
|
+
setShowAlignment(f: boolean) {
|
|
87
|
+
self.showAlignment = f
|
|
169
88
|
},
|
|
89
|
+
|
|
170
90
|
/**
|
|
171
91
|
* #action
|
|
172
92
|
*/
|
|
173
93
|
setShowControls(arg: boolean) {
|
|
174
94
|
self.showControls = arg
|
|
175
95
|
},
|
|
176
|
-
|
|
177
|
-
* #action
|
|
178
|
-
*/
|
|
179
|
-
setProgress(str: string) {
|
|
180
|
-
self.progress = str
|
|
181
|
-
},
|
|
182
|
-
/**
|
|
183
|
-
* #action
|
|
184
|
-
*/
|
|
185
|
-
setClickedPosition(arg?: {
|
|
186
|
-
structureSeqPos: number
|
|
187
|
-
code: string
|
|
188
|
-
chain: string
|
|
189
|
-
}) {
|
|
190
|
-
self.clickPosition = arg
|
|
191
|
-
},
|
|
192
|
-
/**
|
|
193
|
-
* #action
|
|
194
|
-
*/
|
|
195
|
-
setClickGenomeHighlights(r: IRegion[]) {
|
|
196
|
-
self.clickGenomeHighlights = cast(r)
|
|
197
|
-
},
|
|
198
|
-
/**
|
|
199
|
-
* #action
|
|
200
|
-
*/
|
|
201
|
-
clearClickGenomeHighlights() {
|
|
202
|
-
self.clickGenomeHighlights = cast([])
|
|
203
|
-
},
|
|
204
|
-
/**
|
|
205
|
-
* #action
|
|
206
|
-
*/
|
|
207
|
-
setHoverGenomeHighlights(r: IRegion[]) {
|
|
208
|
-
self.hoverGenomeHighlights = cast(r)
|
|
209
|
-
},
|
|
210
|
-
/**
|
|
211
|
-
* #action
|
|
212
|
-
*/
|
|
213
|
-
clearHoverGenomeHighlights() {
|
|
214
|
-
self.hoverGenomeHighlights = cast([])
|
|
215
|
-
},
|
|
96
|
+
|
|
216
97
|
/**
|
|
217
98
|
* #action
|
|
218
99
|
*/
|
|
219
100
|
setError(e: unknown) {
|
|
220
101
|
self.error = e
|
|
221
102
|
},
|
|
222
|
-
|
|
223
|
-
* #action
|
|
224
|
-
*/
|
|
225
|
-
setAlignment(r?: ReturnType<typeof parsePairwise>) {
|
|
226
|
-
self.alignment = r
|
|
227
|
-
},
|
|
103
|
+
|
|
228
104
|
/**
|
|
229
105
|
* #action
|
|
230
106
|
*/
|
|
@@ -237,166 +113,73 @@ function stateModelFactory() {
|
|
|
237
113
|
setZoomToBaseLevel(arg: boolean) {
|
|
238
114
|
self.zoomToBaseLevel = arg
|
|
239
115
|
},
|
|
240
|
-
}))
|
|
241
|
-
.views(self => ({
|
|
242
|
-
/**
|
|
243
|
-
* #getter
|
|
244
|
-
*/
|
|
245
|
-
get structureSeqToTranscriptSeqPosition() {
|
|
246
|
-
return self.alignment
|
|
247
|
-
? structureSeqVsTranscriptSeqMap(self.alignment)
|
|
248
|
-
.structureSeqToTranscriptSeqPosition
|
|
249
|
-
: undefined
|
|
250
|
-
},
|
|
251
|
-
/**
|
|
252
|
-
* #getter
|
|
253
|
-
*/
|
|
254
|
-
get transcriptSeqToStructureSeqPosition() {
|
|
255
|
-
return self.alignment
|
|
256
|
-
? structureSeqVsTranscriptSeqMap(self.alignment)
|
|
257
|
-
.transcriptSeqToStructureSeqPosition
|
|
258
|
-
: undefined
|
|
259
|
-
},
|
|
260
|
-
/**
|
|
261
|
-
* #getter
|
|
262
|
-
*/
|
|
263
|
-
get structurePositionToAlignmentMap() {
|
|
264
|
-
return self.alignment
|
|
265
|
-
? structurePositionToAlignmentMap(self.alignment)
|
|
266
|
-
: undefined
|
|
267
|
-
},
|
|
268
116
|
/**
|
|
269
|
-
* #
|
|
270
|
-
*/
|
|
271
|
-
get transcriptPositionToAlignmentMap() {
|
|
272
|
-
return self.alignment
|
|
273
|
-
? transcriptPositionToAlignmentMap(self.alignment)
|
|
274
|
-
: undefined
|
|
275
|
-
},
|
|
276
|
-
/**
|
|
277
|
-
* #getter
|
|
278
|
-
*/
|
|
279
|
-
get alignmentToTranscriptPosition() {
|
|
280
|
-
return this.transcriptPositionToAlignmentMap
|
|
281
|
-
? invertMap(this.transcriptPositionToAlignmentMap)
|
|
282
|
-
: undefined
|
|
283
|
-
},
|
|
284
|
-
/**
|
|
285
|
-
* #getter
|
|
286
|
-
*/
|
|
287
|
-
get alignmentToStructurePosition() {
|
|
288
|
-
return this.structurePositionToAlignmentMap
|
|
289
|
-
? invertMap(this.structurePositionToAlignmentMap)
|
|
290
|
-
: undefined
|
|
291
|
-
},
|
|
292
|
-
/**
|
|
293
|
-
* #getter
|
|
294
|
-
*/
|
|
295
|
-
get clickString() {
|
|
296
|
-
const r = self.clickPosition
|
|
297
|
-
return r ? toStr(r) : ''
|
|
298
|
-
},
|
|
299
|
-
/**
|
|
300
|
-
* #getter
|
|
301
|
-
*/
|
|
302
|
-
get hoverString() {
|
|
303
|
-
const r = self.hoverPosition
|
|
304
|
-
return r ? toStr(r) : ''
|
|
305
|
-
},
|
|
306
|
-
/**
|
|
307
|
-
* #getter
|
|
308
|
-
*/
|
|
309
|
-
get genomeToTranscriptSeqMapping() {
|
|
310
|
-
return self.feature
|
|
311
|
-
? genomeToTranscriptSeqMapping(new SimpleFeature(self.feature))
|
|
312
|
-
: undefined
|
|
313
|
-
},
|
|
314
|
-
/**
|
|
315
|
-
* #getter
|
|
117
|
+
* #action
|
|
316
118
|
*/
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
|
|
321
|
-
get exactMatch() {
|
|
322
|
-
const r1 = self.seq1?.replaceAll('*', '')
|
|
323
|
-
const r2 = self.seq2?.replaceAll('*', '')
|
|
324
|
-
return r1 === r2
|
|
119
|
+
setMolstarPluginContext(p?: PluginContext) {
|
|
120
|
+
self.molstarPluginContext = p
|
|
325
121
|
},
|
|
326
122
|
}))
|
|
327
123
|
.actions(self => ({
|
|
328
124
|
afterAttach() {
|
|
329
|
-
// pairwise align transcript sequence to structure residues
|
|
330
125
|
addDisposer(
|
|
331
126
|
self,
|
|
332
127
|
autorun(async () => {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
128
|
+
const { structures, molstarPluginContext } = self
|
|
129
|
+
if (molstarPluginContext) {
|
|
130
|
+
for (const structure of structures) {
|
|
131
|
+
try {
|
|
132
|
+
const { model } = structure.data
|
|
133
|
+
? await addStructureFromData({
|
|
134
|
+
data: structure.data,
|
|
135
|
+
plugin: molstarPluginContext,
|
|
136
|
+
})
|
|
137
|
+
: structure.url
|
|
138
|
+
? await addStructureFromURL({
|
|
139
|
+
url: structure.url,
|
|
140
|
+
plugin: molstarPluginContext,
|
|
141
|
+
})
|
|
142
|
+
: { model: undefined }
|
|
348
143
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
144
|
+
const sequences = model?.obj?.data.sequence.sequences.map(
|
|
145
|
+
s => {
|
|
146
|
+
let seq = ''
|
|
147
|
+
const arr = s.sequence.label.toArray()
|
|
148
|
+
// eslint-disable-next-line unicorn/no-for-loop,@typescript-eslint/prefer-for-of
|
|
149
|
+
for (let i = 0; i < arr.length; i++) {
|
|
150
|
+
seq += arr[i]!
|
|
151
|
+
}
|
|
152
|
+
return seq
|
|
153
|
+
},
|
|
154
|
+
)
|
|
155
|
+
structure.setSequences(sequences)
|
|
156
|
+
} catch (e) {
|
|
157
|
+
self.setError(e)
|
|
158
|
+
console.error(e)
|
|
357
159
|
}
|
|
358
|
-
self.setAlignment({
|
|
359
|
-
consensus,
|
|
360
|
-
alns: [
|
|
361
|
-
{ id: 'seq1', seq: r1 },
|
|
362
|
-
{ id: 'seq2', seq: r2 },
|
|
363
|
-
],
|
|
364
|
-
})
|
|
365
160
|
}
|
|
366
|
-
} catch (e) {
|
|
367
|
-
console.error(e)
|
|
368
|
-
self.setError(e)
|
|
369
161
|
}
|
|
370
162
|
}),
|
|
371
163
|
)
|
|
372
164
|
|
|
373
|
-
// convert hover over the genome to structure position
|
|
374
165
|
addDisposer(
|
|
375
166
|
self,
|
|
376
167
|
autorun(() => {
|
|
377
|
-
const {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
genomeToTranscriptSeqMapping.g2p[hovered.hoverPosition.coord]
|
|
393
|
-
const c0 = pos
|
|
394
|
-
? transcriptSeqToStructureSeqPosition?.[pos]
|
|
395
|
-
: undefined
|
|
396
|
-
if (c0 !== undefined) {
|
|
397
|
-
self.setHoveredPosition({
|
|
398
|
-
structureSeqPos: c0,
|
|
399
|
-
})
|
|
168
|
+
const { structures, molstarPluginContext } = self
|
|
169
|
+
if (molstarPluginContext) {
|
|
170
|
+
for (const [i, s0] of structures.entries()) {
|
|
171
|
+
const structure =
|
|
172
|
+
molstarPluginContext.managers.structure.hierarchy.current
|
|
173
|
+
.structures[i]?.cell.obj?.data
|
|
174
|
+
const pos = s0.structureSeqHoverPos
|
|
175
|
+
if (structure && pos !== undefined) {
|
|
176
|
+
highlightResidue({
|
|
177
|
+
structure,
|
|
178
|
+
plugin: molstarPluginContext,
|
|
179
|
+
selectedResidue: pos,
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
}
|
|
400
183
|
}
|
|
401
184
|
}),
|
|
402
185
|
)
|
|
@@ -405,8 +188,13 @@ function stateModelFactory() {
|
|
|
405
188
|
}
|
|
406
189
|
|
|
407
190
|
export default stateModelFactory
|
|
191
|
+
|
|
408
192
|
export type JBrowsePluginProteinViewStateModel = ReturnType<
|
|
409
193
|
typeof stateModelFactory
|
|
410
194
|
>
|
|
411
195
|
export type JBrowsePluginProteinViewModel =
|
|
412
196
|
Instance<JBrowsePluginProteinViewStateModel>
|
|
197
|
+
|
|
198
|
+
export type JBrowsePluginProteinStructureStateModel = typeof Structure
|
|
199
|
+
export type JBrowsePluginProteinStructureModel =
|
|
200
|
+
Instance<JBrowsePluginProteinStructureStateModel>
|