jbrowse-plugin-protein3d 0.0.2 → 0.0.4

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.
Files changed (220) hide show
  1. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +3 -9
  2. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +1 -1
  3. package/dist/AddHighlightModel/ProteinToGenomeClickHighlight.js +4 -3
  4. package/dist/AddHighlightModel/ProteinToGenomeClickHighlight.js.map +1 -1
  5. package/dist/AddHighlightModel/ProteinToGenomeHoverHighlight.d.ts +1 -2
  6. package/dist/AddHighlightModel/ProteinToGenomeHoverHighlight.js +4 -3
  7. package/dist/AddHighlightModel/ProteinToGenomeHoverHighlight.js.map +1 -1
  8. package/dist/AddHighlightModel/util.js +1 -1
  9. package/dist/AddHighlightModel/util.js.map +1 -1
  10. package/dist/AlphaFoldConfidenceAdapter/AlphaFoldConfidenceAdapter.d.ts +16 -0
  11. package/dist/AlphaFoldConfidenceAdapter/AlphaFoldConfidenceAdapter.js +43 -0
  12. package/dist/AlphaFoldConfidenceAdapter/AlphaFoldConfidenceAdapter.js.map +1 -0
  13. package/dist/AlphaFoldConfidenceAdapter/configSchema.d.ts +13 -0
  14. package/dist/AlphaFoldConfidenceAdapter/configSchema.js +16 -0
  15. package/dist/AlphaFoldConfidenceAdapter/configSchema.js.map +1 -0
  16. package/dist/AlphaFoldConfidenceAdapter/index.d.ts +2 -0
  17. package/dist/AlphaFoldConfidenceAdapter/index.js +11 -0
  18. package/dist/AlphaFoldConfidenceAdapter/index.js.map +1 -0
  19. package/dist/AlphaMissensePathogenicityAdapter/AlphaMissensePathogenicityAdapter.d.ts +30 -0
  20. package/dist/AlphaMissensePathogenicityAdapter/AlphaMissensePathogenicityAdapter.js +78 -0
  21. package/dist/AlphaMissensePathogenicityAdapter/AlphaMissensePathogenicityAdapter.js.map +1 -0
  22. package/dist/AlphaMissensePathogenicityAdapter/configSchema.d.ts +13 -0
  23. package/dist/AlphaMissensePathogenicityAdapter/configSchema.js +16 -0
  24. package/dist/AlphaMissensePathogenicityAdapter/configSchema.js.map +1 -0
  25. package/dist/AlphaMissensePathogenicityAdapter/index.d.ts +2 -0
  26. package/dist/AlphaMissensePathogenicityAdapter/index.js +11 -0
  27. package/dist/AlphaMissensePathogenicityAdapter/index.js.map +1 -0
  28. package/dist/LaunchProteinView/components/AlphaFoldDBSearch.js +201 -34
  29. package/dist/LaunchProteinView/components/AlphaFoldDBSearch.js.map +1 -1
  30. package/dist/LaunchProteinView/components/AlphaFoldDBSearchStatus.d.ts +7 -4
  31. package/dist/LaunchProteinView/components/AlphaFoldDBSearchStatus.js +35 -14
  32. package/dist/LaunchProteinView/components/AlphaFoldDBSearchStatus.js.map +1 -1
  33. package/dist/LaunchProteinView/components/HelpButton.js +6 -2
  34. package/dist/LaunchProteinView/components/HelpButton.js.map +1 -1
  35. package/dist/LaunchProteinView/components/HelpDialog.js +13 -4
  36. package/dist/LaunchProteinView/components/HelpDialog.js.map +1 -1
  37. package/dist/LaunchProteinView/components/LaunchProteinViewDialog.js +9 -9
  38. package/dist/LaunchProteinView/components/LaunchProteinViewDialog.js.map +1 -1
  39. package/dist/LaunchProteinView/components/MSATable.d.ts +10 -0
  40. package/dist/LaunchProteinView/components/MSATable.js +55 -0
  41. package/dist/LaunchProteinView/components/MSATable.js.map +1 -0
  42. package/dist/LaunchProteinView/components/TranscriptSelector.d.ts +7 -3
  43. package/dist/LaunchProteinView/components/TranscriptSelector.js +25 -8
  44. package/dist/LaunchProteinView/components/TranscriptSelector.js.map +1 -1
  45. package/dist/LaunchProteinView/components/UserProvidedStructure.js +67 -47
  46. package/dist/LaunchProteinView/components/UserProvidedStructure.js.map +1 -1
  47. package/dist/LaunchProteinView/{calculateProteinSequence.js → components/calculateProteinSequence.js} +5 -3
  48. package/dist/LaunchProteinView/components/calculateProteinSequence.js.map +1 -0
  49. package/dist/LaunchProteinView/components/useIsoformProteinSequences.d.ts +14 -0
  50. package/dist/LaunchProteinView/{useProteinSequences.js → components/useIsoformProteinSequences.js} +11 -6
  51. package/dist/LaunchProteinView/components/useIsoformProteinSequences.js.map +1 -0
  52. package/dist/LaunchProteinView/components/useLocalStructureFileSequence.d.ts +7 -0
  53. package/dist/LaunchProteinView/components/useLocalStructureFileSequence.js +64 -0
  54. package/dist/LaunchProteinView/components/useLocalStructureFileSequence.js.map +1 -0
  55. package/dist/LaunchProteinView/{useMyGeneInfo.d.ts → components/useMyGeneInfoUniprotIdLookup.d.ts} +2 -2
  56. package/dist/LaunchProteinView/{useMyGeneInfo.js → components/useMyGeneInfoUniprotIdLookup.js} +15 -10
  57. package/dist/LaunchProteinView/components/useMyGeneInfoUniprotIdLookup.js.map +1 -0
  58. package/dist/LaunchProteinView/components/useRemoteStructureFileSequence.d.ts +7 -0
  59. package/dist/LaunchProteinView/components/useRemoteStructureFileSequence.js +59 -0
  60. package/dist/LaunchProteinView/components/useRemoteStructureFileSequence.js.map +1 -0
  61. package/dist/LaunchProteinView/{util.d.ts → components/util.d.ts} +0 -10
  62. package/dist/LaunchProteinView/{util.js → components/util.js} +4 -25
  63. package/dist/LaunchProteinView/components/util.js.map +1 -0
  64. package/dist/LaunchProteinView/index.js +6 -2
  65. package/dist/LaunchProteinView/index.js.map +1 -1
  66. package/dist/ProteinView/{loadStructureFromData.d.ts → addStructureFromData.d.ts} +2 -2
  67. package/dist/ProteinView/{loadStructureFromData.js → addStructureFromData.js} +3 -8
  68. package/dist/ProteinView/addStructureFromData.js.map +1 -0
  69. package/dist/ProteinView/{loadStructureFromURL.d.ts → addStructureFromURL.d.ts} +2 -2
  70. package/dist/ProteinView/{loadStructureFromURL.js → addStructureFromURL.js} +11 -9
  71. package/dist/ProteinView/addStructureFromURL.js.map +1 -0
  72. package/dist/ProteinView/clearSelection.js +1 -1
  73. package/dist/ProteinView/clearSelection.js.map +1 -1
  74. package/dist/ProteinView/components/ProteinAlignment.d.ts +2 -2
  75. package/dist/ProteinView/components/ProteinAlignment.js +37 -26
  76. package/dist/ProteinView/components/ProteinAlignment.js.map +1 -1
  77. package/dist/ProteinView/components/ProteinAlignmentHelpButton.d.ts +2 -2
  78. package/dist/ProteinView/components/ProteinAlignmentHelpButton.js +6 -4
  79. package/dist/ProteinView/components/ProteinAlignmentHelpButton.js.map +1 -1
  80. package/dist/ProteinView/components/ProteinAlignmentHelpDialog.js +6 -5
  81. package/dist/ProteinView/components/ProteinAlignmentHelpDialog.js.map +1 -1
  82. package/dist/ProteinView/components/ProteinView.js +18 -60
  83. package/dist/ProteinView/components/ProteinView.js.map +1 -1
  84. package/dist/ProteinView/components/{Header.js → ProteinViewHeader.js} +29 -12
  85. package/dist/ProteinView/components/ProteinViewHeader.js.map +1 -0
  86. package/dist/ProteinView/components/SplitString.d.ts +4 -4
  87. package/dist/ProteinView/components/SplitString.js +4 -4
  88. package/dist/ProteinView/components/SplitString.js.map +1 -1
  89. package/dist/ProteinView/genomeToProtein.d.ts +2 -2
  90. package/dist/ProteinView/genomeToProtein.js +4 -5
  91. package/dist/ProteinView/genomeToProtein.js.map +1 -1
  92. package/dist/ProteinView/highlightResidue.js +2 -2
  93. package/dist/ProteinView/highlightResidue.js.map +1 -1
  94. package/dist/ProteinView/launchRemotePairwiseAlignment.d.ts +2 -5
  95. package/dist/ProteinView/launchRemotePairwiseAlignment.js +7 -3
  96. package/dist/ProteinView/launchRemotePairwiseAlignment.js.map +1 -1
  97. package/dist/ProteinView/model.d.ts +496 -156
  98. package/dist/ProteinView/model.js +66 -225
  99. package/dist/ProteinView/model.js.map +1 -1
  100. package/dist/ProteinView/proteinToGenomeMapping.d.ts +6 -6
  101. package/dist/ProteinView/proteinToGenomeMapping.js +29 -28
  102. package/dist/ProteinView/proteinToGenomeMapping.js.map +1 -1
  103. package/dist/ProteinView/selectResidue.js +1 -1
  104. package/dist/ProteinView/selectResidue.js.map +1 -1
  105. package/dist/ProteinView/structureModel.d.ts +183 -0
  106. package/dist/ProteinView/structureModel.js +407 -0
  107. package/dist/ProteinView/structureModel.js.map +1 -0
  108. package/dist/ProteinView/useProteinView.d.ts +1 -4
  109. package/dist/ProteinView/useProteinView.js +3 -15
  110. package/dist/ProteinView/useProteinView.js.map +1 -1
  111. package/dist/ProteinView/util.d.ts +3 -3
  112. package/dist/ProteinView/util.js +8 -6
  113. package/dist/ProteinView/util.js.map +1 -1
  114. package/dist/UniProtVariationAdapter/UniProtVariationAdapter.d.ts +15 -0
  115. package/dist/UniProtVariationAdapter/UniProtVariationAdapter.js +55 -0
  116. package/dist/UniProtVariationAdapter/UniProtVariationAdapter.js.map +1 -0
  117. package/dist/UniProtVariationAdapter/configSchema.d.ts +17 -0
  118. package/dist/UniProtVariationAdapter/configSchema.js +20 -0
  119. package/dist/UniProtVariationAdapter/configSchema.js.map +1 -0
  120. package/dist/UniProtVariationAdapter/index.d.ts +2 -0
  121. package/dist/UniProtVariationAdapter/index.js +11 -0
  122. package/dist/UniProtVariationAdapter/index.js.map +1 -0
  123. package/dist/genomeToTranscriptMapping.d.ts +2 -2
  124. package/dist/genomeToTranscriptMapping.js +3 -3
  125. package/dist/genomeToTranscriptMapping.js.map +1 -1
  126. package/dist/index.js +6 -9
  127. package/dist/index.js.map +1 -1
  128. package/dist/jbrowse-plugin-protein3d.umd.production.min.js +1473 -1489
  129. package/dist/jbrowse-plugin-protein3d.umd.production.min.js.map +4 -4
  130. package/dist/mappings.d.ts +12 -10
  131. package/dist/mappings.js +7 -7
  132. package/dist/mappings.js.map +1 -1
  133. package/dist/mappings.test.js +7 -5
  134. package/dist/mappings.test.js.map +1 -1
  135. package/dist/test_data/gene.d.ts +577 -64
  136. package/dist/test_data/gene.js +1 -1
  137. package/dist/test_data/gene.js.map +1 -1
  138. package/package.json +17 -16
  139. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +4 -17
  140. package/src/AddHighlightModel/ProteinToGenomeClickHighlight.tsx +17 -14
  141. package/src/AddHighlightModel/ProteinToGenomeHoverHighlight.tsx +18 -17
  142. package/src/AddHighlightModel/util.ts +1 -1
  143. package/src/AlphaFoldConfidenceAdapter/AlphaFoldConfidenceAdapter.ts +63 -0
  144. package/src/AlphaFoldConfidenceAdapter/configSchema.ts +21 -0
  145. package/src/AlphaFoldConfidenceAdapter/index.ts +19 -0
  146. package/src/AlphaMissensePathogenicityAdapter/AlphaMissensePathogenicityAdapter.ts +109 -0
  147. package/src/AlphaMissensePathogenicityAdapter/configSchema.ts +21 -0
  148. package/src/AlphaMissensePathogenicityAdapter/index.ts +19 -0
  149. package/src/LaunchProteinView/components/AlphaFoldDBSearch.tsx +266 -53
  150. package/src/LaunchProteinView/components/AlphaFoldDBSearchStatus.tsx +71 -29
  151. package/src/LaunchProteinView/components/HelpButton.tsx +10 -2
  152. package/src/LaunchProteinView/components/HelpDialog.tsx +41 -8
  153. package/src/LaunchProteinView/components/LaunchProteinViewDialog.tsx +10 -12
  154. package/src/LaunchProteinView/components/MSATable.tsx +98 -0
  155. package/src/LaunchProteinView/components/TranscriptSelector.tsx +39 -11
  156. package/src/LaunchProteinView/components/UserProvidedStructure.tsx +119 -68
  157. package/src/LaunchProteinView/{calculateProteinSequence.ts → components/calculateProteinSequence.ts} +6 -4
  158. package/src/LaunchProteinView/{useProteinSequences.ts → components/useIsoformProteinSequences.ts} +12 -7
  159. package/src/LaunchProteinView/components/useLocalStructureFileSequence.ts +72 -0
  160. package/src/LaunchProteinView/{useMyGeneInfo.ts → components/useMyGeneInfoUniprotIdLookup.ts} +16 -11
  161. package/src/LaunchProteinView/components/useRemoteStructureFileSequence.ts +59 -0
  162. package/src/LaunchProteinView/{util.ts → components/util.ts} +4 -36
  163. package/src/LaunchProteinView/index.ts +36 -26
  164. package/src/ProteinView/{loadStructureFromData.ts → addStructureFromData.ts} +2 -8
  165. package/src/ProteinView/{loadStructureFromURL.ts → addStructureFromURL.ts} +11 -11
  166. package/src/ProteinView/clearSelection.ts +1 -1
  167. package/src/ProteinView/components/ProteinAlignment.tsx +51 -35
  168. package/src/ProteinView/components/ProteinAlignmentHelpButton.tsx +4 -4
  169. package/src/ProteinView/components/ProteinAlignmentHelpDialog.tsx +15 -11
  170. package/src/ProteinView/components/ProteinView.tsx +22 -82
  171. package/src/ProteinView/components/{Header.tsx → ProteinViewHeader.tsx} +44 -21
  172. package/src/ProteinView/components/SplitString.tsx +9 -9
  173. package/src/ProteinView/genomeToProtein.ts +5 -9
  174. package/src/ProteinView/highlightResidue.ts +2 -2
  175. package/src/ProteinView/launchRemotePairwiseAlignment.ts +6 -3
  176. package/src/ProteinView/model.ts +80 -265
  177. package/src/ProteinView/proteinToGenomeMapping.ts +40 -38
  178. package/src/ProteinView/selectResidue.ts +1 -1
  179. package/src/ProteinView/structureModel.ts +512 -0
  180. package/src/ProteinView/useProteinView.ts +2 -19
  181. package/src/ProteinView/util.ts +20 -9
  182. package/src/UniProtVariationAdapter/UniProtVariationAdapter.ts +99 -0
  183. package/src/UniProtVariationAdapter/configSchema.ts +25 -0
  184. package/src/UniProtVariationAdapter/index.ts +17 -0
  185. package/src/__snapshots__/mappings.test.ts.snap +224 -224
  186. package/src/genomeToTranscriptMapping.ts +9 -9
  187. package/src/index.ts +7 -12
  188. package/src/mappings.test.ts +7 -5
  189. package/src/mappings.ts +25 -23
  190. package/src/test_data/gene.ts +3 -3
  191. package/dist/LaunchProteinView/calculateProteinSequence.js.map +0 -1
  192. package/dist/LaunchProteinView/components/PreLoadedStructureMapping.d.ts +0 -8
  193. package/dist/LaunchProteinView/components/PreLoadedStructureMapping.js +0 -72
  194. package/dist/LaunchProteinView/components/PreLoadedStructureMapping.js.map +0 -1
  195. package/dist/LaunchProteinView/components/useCheckAlphaFoldDBExistence.d.ts +0 -7
  196. package/dist/LaunchProteinView/components/useCheckAlphaFoldDBExistence.js +0 -26
  197. package/dist/LaunchProteinView/components/useCheckAlphaFoldDBExistence.js.map +0 -1
  198. package/dist/LaunchProteinView/useMyGeneInfo.js.map +0 -1
  199. package/dist/LaunchProteinView/useProteinSequences.d.ts +0 -10
  200. package/dist/LaunchProteinView/useProteinSequences.js.map +0 -1
  201. package/dist/LaunchProteinView/util.js.map +0 -1
  202. package/dist/ProteinModelSessionExtension.d.ts +0 -11
  203. package/dist/ProteinModelSessionExtension.js +0 -53
  204. package/dist/ProteinModelSessionExtension.js.map +0 -1
  205. package/dist/ProteinView/components/Header.js.map +0 -1
  206. package/dist/ProteinView/loadStructureFromData.js.map +0 -1
  207. package/dist/ProteinView/loadStructureFromURL.js.map +0 -1
  208. package/dist/ProteinView/useProteinViewClickBehavior.d.ts +0 -8
  209. package/dist/ProteinView/useProteinViewClickBehavior.js +0 -34
  210. package/dist/ProteinView/useProteinViewClickBehavior.js.map +0 -1
  211. package/dist/ProteinView/useProteinViewHoverBehavior.d.ts +0 -6
  212. package/dist/ProteinView/useProteinViewHoverBehavior.js +0 -31
  213. package/dist/ProteinView/useProteinViewHoverBehavior.js.map +0 -1
  214. package/src/LaunchProteinView/components/PreLoadedStructureMapping.tsx +0 -153
  215. package/src/LaunchProteinView/components/useCheckAlphaFoldDBExistence.ts +0 -31
  216. package/src/ProteinModelSessionExtension.ts +0 -71
  217. package/src/ProteinView/useProteinViewClickBehavior.ts +0 -48
  218. package/src/ProteinView/useProteinViewHoverBehavior.ts +0 -44
  219. /package/dist/LaunchProteinView/{calculateProteinSequence.d.ts → components/calculateProteinSequence.d.ts} +0 -0
  220. /package/dist/ProteinView/components/{Header.d.ts → ProteinViewHeader.d.ts} +0 -0
@@ -1,12 +1,13 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { observer } from 'mobx-react'
3
- import { Button, DialogActions, DialogContent } from '@mui/material'
3
+ import { Button, DialogActions, DialogContent, Typography } from '@mui/material'
4
4
  import { makeStyles } from 'tss-react/mui'
5
5
  import {
6
6
  AbstractTrackModel,
7
7
  Feature,
8
8
  getContainingView,
9
9
  getSession,
10
+ isSessionWithAddTracks,
10
11
  } from '@jbrowse/core/util'
11
12
  import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui'
12
13
  import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
@@ -18,15 +19,17 @@ import {
18
19
  getId,
19
20
  getTranscriptDisplayName,
20
21
  getTranscriptFeatures,
21
- } from '../util'
22
+ } from './util'
23
+
24
+ // components
22
25
  import TranscriptSelector from './TranscriptSelector'
23
26
  import HelpButton from './HelpButton'
27
+ import AlphaFoldDBSearchStatus from './AlphaFoldDBSearchStatus'
24
28
 
25
29
  // hooks
26
- import useMyGeneInfo from '../useMyGeneInfo'
27
- import useAllSequences from '../useProteinSequences'
28
- import { useCheckAlphaFoldDBExistence } from './useCheckAlphaFoldDBExistence'
29
- import AlphaFoldDBSearchStatus from './AlphaFoldDBSearchStatus'
30
+ import useMyGeneInfoUniprotIdLookup from './useMyGeneInfoUniprotIdLookup'
31
+ import useRemoteStructureFileSequence from './useRemoteStructureFileSequence'
32
+ import useIsoformProteinSequences from './useIsoformProteinSequences'
30
33
 
31
34
  const useStyles = makeStyles()(theme => ({
32
35
  dialogContent: {
@@ -35,9 +38,7 @@ const useStyles = makeStyles()(theme => ({
35
38
  },
36
39
  }))
37
40
 
38
- type LGV = LinearGenomeViewModel
39
-
40
- const AlphaFoldDBSearch = observer(function AlphaFoldDBSearch({
41
+ const AlphaFoldDBSearch = observer(function ({
41
42
  feature,
42
43
  model,
43
44
  handleClose,
@@ -53,85 +54,297 @@ const AlphaFoldDBSearch = observer(function AlphaFoldDBSearch({
53
54
  // finding exon/CDS subfeatures. we want to select from transcript names
54
55
  const options = getTranscriptFeatures(feature)
55
56
  const [userSelection, setUserSelection] = useState<string>()
56
- const view = getContainingView(model) as LGV
57
+ const view = getContainingView(model) as LinearGenomeViewModel
57
58
  const selectedTranscript = options.find(val => getId(val) === userSelection)
58
- const { seqs, error: error2 } = useAllSequences({ feature, view })
59
- const protein = seqs?.[userSelection ?? '']
60
- const { result: foundStructureId, error } = useMyGeneInfo({
61
- id: selectedTranscript ? getDisplayName(selectedTranscript) : '',
59
+ const {
60
+ isoformSequences,
61
+ isLoading: isIsoformProteinSequencesLoading,
62
+ error: isoformProteinSequencesError,
63
+ } = useIsoformProteinSequences({
64
+ feature,
65
+ view,
66
+ })
67
+ const userSelectedProteinSequence = isoformSequences?.[userSelection ?? '']
68
+ const {
69
+ uniprotId,
70
+ isLoading: isMyGeneLoading,
71
+ error: myGeneError,
72
+ } = useMyGeneInfoUniprotIdLookup({
73
+ id: selectedTranscript
74
+ ? getDisplayName(selectedTranscript)
75
+ : getDisplayName(feature),
62
76
  })
63
77
 
78
+ const url = uniprotId
79
+ ? `https://alphafold.ebi.ac.uk/files/AF-${uniprotId}-F1-model_v4.cif`
80
+ : undefined
81
+ const {
82
+ sequences: structureSequences,
83
+ isLoading: isRemoteStructureSequenceLoading,
84
+ error: remoteStructureSequenceError,
85
+ } = useRemoteStructureFileSequence({ url })
86
+ const e =
87
+ myGeneError || isoformProteinSequencesError || remoteStructureSequenceError
88
+
89
+ const structureSequence = structureSequences?.[0]
64
90
  useEffect(() => {
65
- if (userSelection === undefined && seqs !== undefined) {
66
- setUserSelection(options.find(f => !!seqs[f.id()])?.id())
91
+ if (isoformSequences !== undefined) {
92
+ const ret =
93
+ options.find(
94
+ f =>
95
+ isoformSequences[f.id()]?.seq.replaceAll('*', '') ==
96
+ structureSequence,
97
+ ) ?? options.find(f => !!isoformSequences[f.id()])
98
+ setUserSelection(ret?.id())
67
99
  }
68
- }, [options, userSelection, seqs])
69
- const {
70
- success,
71
- loading,
72
- error: error3,
73
- } = useCheckAlphaFoldDBExistence({
74
- foundStructureId,
75
- })
100
+ }, [options, structureSequence, isoformSequences])
76
101
 
77
- const e = error || error2 || error3
78
- const url = `https://alphafold.ebi.ac.uk/files/AF-${foundStructureId}-F1-model_v4.cif`
79
102
  return (
80
103
  <>
81
104
  <DialogContent className={classes.dialogContent}>
82
105
  {e ? <ErrorMessage error={e} /> : null}
83
- <div>
84
- Look up AlphaFoldDB structure for given transcript <HelpButton />
85
- </div>
86
- {seqs ? (
106
+ <Typography>
107
+ Automatically find AlphaFoldDB entry for given transcript{' '}
108
+ <HelpButton />
109
+ </Typography>
110
+ {isRemoteStructureSequenceLoading ? (
111
+ <LoadingEllipses
112
+ variant="h6"
113
+ message="Loading sequence from remote structure file"
114
+ />
115
+ ) : null}
116
+ {isMyGeneLoading ? (
117
+ <LoadingEllipses
118
+ variant="h6"
119
+ message="Looking up UniProt ID from mygene.info"
120
+ />
121
+ ) : uniprotId ? null : (
122
+ <div>
123
+ UniProt ID not found. Search sequence on AlphaFoldDB{' '}
124
+ <a
125
+ href={`https://alphafold.ebi.ac.uk/search/sequence/${userSelectedProteinSequence?.seq.replaceAll('*', '')}`}
126
+ target="_blank"
127
+ rel="noreferrer"
128
+ >
129
+ here
130
+ </a>{' '}
131
+ <br />
132
+ After visiting the above link, then paste the structure URL into the
133
+ Manual tab
134
+ </div>
135
+ )}
136
+ {isIsoformProteinSequencesLoading ? (
137
+ <LoadingEllipses
138
+ variant="h6"
139
+ message="Loading protein sequences from transcript isoforms"
140
+ />
141
+ ) : null}
142
+ {isoformSequences && structureSequence && selectedTranscript ? (
87
143
  <>
88
144
  <TranscriptSelector
89
145
  val={userSelection ?? ''}
90
146
  setVal={setUserSelection}
91
- options={options}
147
+ structureSequence={structureSequence}
92
148
  feature={feature}
93
- seqs={seqs}
149
+ isoforms={options}
150
+ isoformSequences={isoformSequences}
151
+ />
152
+ <AlphaFoldDBSearchStatus
153
+ uniprotId={uniprotId}
154
+ selectedTranscript={selectedTranscript}
155
+ structureSequence={structureSequence}
156
+ isoformSequences={isoformSequences}
94
157
  />
95
- {selectedTranscript ? (
96
- <AlphaFoldDBSearchStatus
97
- foundStructureId={foundStructureId}
98
- selectedTranscript={selectedTranscript}
99
- success={success}
100
- loading={loading}
101
- />
102
- ) : null}
103
158
  </>
104
- ) : (
105
- <div style={{ margin: 20 }}>
106
- <LoadingEllipses message="Loading protein sequences" variant="h6" />
107
- </div>
108
- )}
159
+ ) : null}
109
160
  </DialogContent>
110
161
  <DialogActions>
111
162
  <Button
112
163
  variant="contained"
113
164
  color="secondary"
114
- onClick={() => handleClose()}
165
+ onClick={() => {
166
+ handleClose()
167
+ }}
115
168
  >
116
169
  Cancel
117
170
  </Button>
118
171
  <Button
119
172
  variant="contained"
120
173
  color="primary"
121
- disabled={!foundStructureId || !protein || !selectedTranscript}
174
+ disabled={
175
+ !uniprotId || !userSelectedProteinSequence || !selectedTranscript
176
+ }
122
177
  onClick={() => {
123
178
  session.addView('ProteinView', {
124
179
  type: 'ProteinView',
125
- url,
126
- seq2: protein,
127
- feature: selectedTranscript?.toJSON(),
128
- connectedViewId: view.id,
129
- displayName: `Protein view ${getGeneDisplayName(feature)} - ${getTranscriptDisplayName(selectedTranscript)}`,
180
+ isFloating: true,
181
+ structures: [
182
+ {
183
+ url,
184
+ userProvidedTranscriptSequence:
185
+ userSelectedProteinSequence?.seq,
186
+ feature: selectedTranscript?.toJSON(),
187
+ connectedViewId: view.id,
188
+ },
189
+ ],
190
+ displayName: [
191
+ 'Protein view',
192
+ uniprotId,
193
+ getGeneDisplayName(feature),
194
+ getTranscriptDisplayName(selectedTranscript),
195
+ ].join(' - '),
130
196
  })
131
197
  handleClose()
132
198
  }}
133
199
  >
134
- Submit
200
+ Launch 3-D protein structure view
201
+ </Button>
202
+ <Button
203
+ variant="contained"
204
+ disabled={
205
+ !uniprotId || !userSelectedProteinSequence || !selectedTranscript
206
+ }
207
+ onClick={() => {
208
+ if (uniprotId && isSessionWithAddTracks(session)) {
209
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
210
+ ;(async () => {
211
+ try {
212
+ session.addTemporaryAssembly?.({
213
+ name: uniprotId,
214
+ sequence: {
215
+ type: 'ReferenceSequenceTrack',
216
+ trackId: `${uniprotId}-ReferenceSequenceTrack`,
217
+ sequenceType: 'pep',
218
+ adapter: {
219
+ type: 'UnindexedFastaAdapter',
220
+ rewriteRefNames: "jexl:split(refName,'|')[1]",
221
+ fastaLocation: {
222
+ uri: `https://rest.uniprot.org/uniprotkb/${uniprotId}.fasta`,
223
+ },
224
+ },
225
+ },
226
+ })
227
+ const url = `https://rest.uniprot.org/uniprotkb/${uniprotId}.gff`
228
+ const res = await fetch(url)
229
+ if (!res.ok) {
230
+ throw new Error(`HTTP ${res.status} fetching ${url}`)
231
+ }
232
+ const data = await res.text()
233
+
234
+ const types = [
235
+ ...new Set(
236
+ data
237
+ .split('\n')
238
+ .filter(f => !f.startsWith('#'))
239
+ .map(f => f.trim())
240
+ .filter(f => !!f)
241
+ .map(f => f.split('\t')[2]),
242
+ ),
243
+ ]
244
+ types.forEach(type => {
245
+ const s = `${uniprotId}-${type}`
246
+ session.addTrackConf({
247
+ type: 'FeatureTrack',
248
+ trackId: s,
249
+ name: type,
250
+ adapter: {
251
+ type: 'Gff3Adapter',
252
+ gffLocation: {
253
+ uri: `https://rest.uniprot.org/uniprotkb/${uniprotId}.gff`,
254
+ },
255
+ },
256
+ assemblyNames: [uniprotId],
257
+ displays: [
258
+ {
259
+ displayId: `${type}-LinearBasicDisplay`,
260
+ type: 'LinearBasicDisplay',
261
+ jexlFilters: [`get(feature,'type')=='${type}'`],
262
+ },
263
+ ],
264
+ })
265
+ })
266
+ session.addTrackConf({
267
+ type: 'FeatureTrack',
268
+ trackId: 'Antigen',
269
+ name: 'Antigen',
270
+ adapter: {
271
+ type: 'Gff3Adapter',
272
+ gffLocation: {
273
+ uri: `https://www.ebi.ac.uk/proteins/api/antigen/${uniprotId}?format=gff`,
274
+ },
275
+ },
276
+ assemblyNames: [uniprotId],
277
+ })
278
+ session.addTrackConf({
279
+ type: 'FeatureTrack',
280
+ trackId: 'Variation',
281
+ name: 'Variation',
282
+ adapter: {
283
+ type: 'UniProtVariationAdapter',
284
+ location: {
285
+ uri: `https://www.ebi.ac.uk/proteins/api/variation/${uniprotId}.json`,
286
+ },
287
+ },
288
+ assemblyNames: [uniprotId],
289
+ })
290
+ session.addTrackConf({
291
+ type: 'QuantitativeTrack',
292
+ trackId: 'AlphaFold confidence',
293
+ name: 'AlphaFold confidence',
294
+ adapter: {
295
+ type: 'AlphaFoldConfidenceAdapter',
296
+ location: {
297
+ uri: `https://alphafold.ebi.ac.uk/files/AF-${uniprotId}-F1-confidence_v4.json`,
298
+ },
299
+ },
300
+ assemblyNames: [uniprotId],
301
+ })
302
+ session.addTrackConf({
303
+ type: 'MultiQuantitativeTrack',
304
+ trackId: 'AlphaMissense scores',
305
+ name: 'AlphaMissense scores',
306
+ assemblyNames: [uniprotId],
307
+ adapter: {
308
+ type: 'AlphaMissensePathogenicityAdapter',
309
+ location: {
310
+ uri: `https://alphafold.ebi.ac.uk/files/AF-${uniprotId}-F1-aa-substitutions.csv`,
311
+ },
312
+ },
313
+ displays: [
314
+ {
315
+ type: 'MultiLinearWiggleDisplay',
316
+ displayId:
317
+ 'AlphaMissense scores-MultiLinearWiggleDisplay',
318
+ defaultRendering: 'multirowdensity',
319
+ renderers: {
320
+ MultiDensityRenderer: {
321
+ type: 'MultiDensityRenderer',
322
+ bicolorPivotValue: 0.5,
323
+ },
324
+ },
325
+ },
326
+ ],
327
+ })
328
+ const view = session.addView('LinearGenomeView', {
329
+ type: 'LinearGenomeView',
330
+ displayName: [
331
+ 'Protein view',
332
+ uniprotId,
333
+ getGeneDisplayName(feature),
334
+ getTranscriptDisplayName(selectedTranscript),
335
+ ].join(' - '),
336
+ }) as LinearGenomeViewModel
337
+ await view.navToLocString(uniprotId, uniprotId)
338
+ } catch (e) {
339
+ console.error(e)
340
+ session.notifyError(`${e}`, e)
341
+ }
342
+ })()
343
+ }
344
+ handleClose()
345
+ }}
346
+ >
347
+ Launch linear protein annotation view
135
348
  </Button>
136
349
  </DialogActions>
137
350
  </>
@@ -1,44 +1,86 @@
1
- import React from 'react'
2
- import { Link, Typography } from '@mui/material'
1
+ import React, { useState } from 'react'
2
+ import { Button, Link, Typography } from '@mui/material'
3
3
  import { Feature } from '@jbrowse/core/util'
4
- import { LoadingEllipses } from '@jbrowse/core/ui'
5
4
 
6
5
  // locals
7
- import { getDisplayName } from '../util'
6
+ import { getDisplayName } from './util'
7
+ import MSATable from './MSATable'
8
+
9
+ function NotFound({ uniprotId }: { uniprotId: string }) {
10
+ return (
11
+ <Typography>
12
+ No structure found for this UniProtID in AlphaFoldDB{' '}
13
+ <Link
14
+ target="_blank"
15
+ href={`https://alphafold.ebi.ac.uk/search/text/${uniprotId}`}
16
+ >
17
+ (search for results)
18
+ </Link>
19
+ </Typography>
20
+ )
21
+ }
8
22
 
9
23
  export default function AlphaFoldDBSearchStatus({
10
- foundStructureId,
24
+ uniprotId,
11
25
  selectedTranscript,
12
- success,
13
- loading,
26
+ structureSequence,
27
+ isoformSequences,
14
28
  }: {
15
- foundStructureId?: string
29
+ uniprotId?: string
16
30
  selectedTranscript: Feature
17
- success: boolean
18
- loading: boolean
31
+ structureSequence?: string
32
+ isoformSequences: Record<string, { feature: Feature; seq: string }>
19
33
  }) {
20
- return !foundStructureId ? (
21
- <Typography>
22
- Searching {getDisplayName(selectedTranscript)} for UniProt ID
23
- </Typography>
24
- ) : (
34
+ const url = uniprotId
35
+ ? `https://alphafold.ebi.ac.uk/files/AF-${uniprotId}-F1-model_v4.cif`
36
+ : undefined
37
+ const url2 = uniprotId
38
+ ? `https://www.uniprot.org/uniprotkb/${uniprotId}/entry`
39
+ : undefined
40
+ const [showAllProteinSequences, setShowAllProteinSequences] = useState(false)
41
+
42
+ return uniprotId ? (
25
43
  <>
26
- <Typography>Found Uniprot ID: {foundStructureId}</Typography>
27
- {loading ? (
28
- <LoadingEllipses title="Looking up structure in AlphaFoldDB" />
29
- ) : success ? (
30
- <Typography>Found structure in AlphaFoldDB</Typography>
31
- ) : (
32
- <Typography>
33
- No structure found for this UniProtID in AlphaFoldDB{' '}
34
- <Link
35
- target="_blank"
36
- href={`https://alphafold.ebi.ac.uk/search/text/${foundStructureId}`}
44
+ <Typography>
45
+ Found Uniprot ID:{' '}
46
+ <a href={url2} target="_blank" rel="noreferrer">
47
+ {uniprotId}
48
+ </a>
49
+ </Typography>
50
+ <Typography>
51
+ AlphaFoldDB link:{' '}
52
+ <a href={url} target="_blank" rel="noreferrer">
53
+ {url}
54
+ </a>
55
+ </Typography>
56
+ {structureSequence ? (
57
+ <div style={{ margin: 20 }}>
58
+ <Button
59
+ variant="contained"
60
+ color="primary"
61
+ onClick={() => {
62
+ setShowAllProteinSequences(!showAllProteinSequences)
63
+ }}
37
64
  >
38
- (search for results)
39
- </Link>
40
- </Typography>
65
+ {showAllProteinSequences
66
+ ? 'Hide all isoform protein sequences'
67
+ : 'Show all isoform protein sequences'}
68
+ </Button>
69
+ {showAllProteinSequences ? (
70
+ <MSATable
71
+ structureSequence={structureSequence}
72
+ structureName={uniprotId}
73
+ isoformSequences={isoformSequences}
74
+ />
75
+ ) : null}
76
+ </div>
77
+ ) : (
78
+ <NotFound uniprotId={uniprotId} />
41
79
  )}
42
80
  </>
81
+ ) : (
82
+ <Typography>
83
+ Searching {getDisplayName(selectedTranscript)} for UniProt ID
84
+ </Typography>
43
85
  )
44
86
  }
@@ -10,12 +10,20 @@ export default function HelpButton() {
10
10
  const [show, setShow] = useState(false)
11
11
  return (
12
12
  <>
13
- <IconButton onClick={() => setShow(true)}>
13
+ <IconButton
14
+ onClick={() => {
15
+ setShow(true)
16
+ }}
17
+ >
14
18
  <Help />
15
19
  </IconButton>
16
20
  {show ? (
17
21
  <Suspense fallback={null}>
18
- <HelpDialog handleClose={() => setShow(false)} />
22
+ <HelpDialog
23
+ handleClose={() => {
24
+ setShow(false)
25
+ }}
26
+ />
19
27
  </Suspense>
20
28
  ) : null}
21
29
  </>
@@ -18,23 +18,56 @@ export default function HelpDialog({
18
18
  handleClose: () => void
19
19
  }) {
20
20
  return (
21
- <Dialog open maxWidth="lg" onClose={handleClose} title="Protein alignment">
21
+ <Dialog open maxWidth="lg" onClose={handleClose} title="Help">
22
22
  <DialogContent>
23
23
  <Typography2>
24
- This process searches mygene.info for the transcript ID, in order to
25
- retrieve the UniProt ID associated with a given transcript ID. Then,
26
- it uses that UniProt ID to lookup the structure in AlphaFoldDB because
27
- every UniProt ID has been processed by AlphaFold.
24
+ The procedure for the protein lookup is as follows:
25
+ <ul>
26
+ <li>
27
+ (Automatic lookup) Searches mygene.info for the transcript ID, in
28
+ order to retrieve the UniProt ID associated with a given
29
+ transcript ID and then, the UniProt ID is used to lookup the
30
+ structure in AlphaFoldDB
31
+ </li>
32
+ <li>
33
+ (Manual) Allows you to choose your own structure file from your
34
+ local machine (e.g. a PDB file predicted by e.g. ColabFold) or
35
+ supply a specific URL
36
+ </li>
37
+ <li>
38
+ The residues from the structure are downloaded, and then you can
39
+ choose the transcript isoform from the selected gene that best
40
+ represents the structure. Asterisks are displayed if there is an
41
+ exact sequence match
42
+ </li>
43
+ <li>
44
+ The residues from the structure are finally aligned to the to the
45
+ selected transcript&apos;s protein sequence representation, and
46
+ this creates a mapping from the reference genome coordinates to
47
+ positions in the 3-D structure
48
+ </li>
49
+ <li>
50
+ Finally the molstar panel is opened, and this contains many
51
+ specialized features features, plus additional mouseover and
52
+ selection features supplied by the plugin to connect mouse click
53
+ actions and mouse hover with coordinates on the linear genome view
54
+ </li>
55
+ </ul>
28
56
  </Typography2>
29
57
  <Typography2>
30
58
  If you run into challenges with this workflow e.g. your transcripts
31
- are not being found in mygene.info and you are interested in using
32
- this plugin, contact colin.diesh@gmail.com
59
+ are not being found in mygene.info then you can use the Manual import
60
+ form, or contact colin.diesh@gmail.com for troubleshooting
33
61
  </Typography2>
34
62
  </DialogContent>
35
63
  <Divider />
36
64
  <DialogActions>
37
- <Button onClick={() => handleClose()} color="primary">
65
+ <Button
66
+ onClick={() => {
67
+ handleClose()
68
+ }}
69
+ color="primary"
70
+ >
38
71
  Close
39
72
  </Button>
40
73
  </DialogActions>
@@ -4,7 +4,6 @@ import { Tab, Tabs } from '@mui/material'
4
4
  import { AbstractTrackModel, Feature } from '@jbrowse/core/util'
5
5
 
6
6
  // locals
7
- import PreLoadedStructureMapping from './PreLoadedStructureMapping'
8
7
  import AlphaFoldDBSearch from './AlphaFoldDBSearch'
9
8
  import UserProvidedStructure from './UserProvidedStructure'
10
9
  import TabPanel from './TabPanel'
@@ -23,13 +22,19 @@ export default function LaunchProteinViewDialog({
23
22
  <Dialog
24
23
  maxWidth="xl"
25
24
  title="Launch protein view"
26
- onClose={() => handleClose()}
25
+ onClose={() => {
26
+ handleClose()
27
+ }}
27
28
  open
28
29
  >
29
- <Tabs value={choice} onChange={(_, val) => setChoice(val)}>
30
- <Tab value={0} label="AlphaFoldDB search" />
30
+ <Tabs
31
+ value={choice}
32
+ onChange={(_, val) => {
33
+ setChoice(val)
34
+ }}
35
+ >
36
+ <Tab value={0} label="Automatic lookup" />
31
37
  <Tab value={1} label="Manual" />
32
- <Tab value={2} label="Pre-configured" />
33
38
  </Tabs>
34
39
  <TabPanel value={choice} index={0}>
35
40
  <AlphaFoldDBSearch
@@ -45,13 +50,6 @@ export default function LaunchProteinViewDialog({
45
50
  handleClose={handleClose}
46
51
  />
47
52
  </TabPanel>
48
- <TabPanel value={choice} index={2}>
49
- <PreLoadedStructureMapping
50
- feature={feature}
51
- model={model}
52
- handleClose={handleClose}
53
- />
54
- </TabPanel>
55
53
  </Dialog>
56
54
  )
57
55
  }