jbrowse-plugin-protein3d 1.13.0 → 1.14.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.
Files changed (186) hide show
  1. package/dist/LaunchProteinView/components/AlphaFoldDBSearch.js +5 -1
  2. package/dist/LaunchProteinView/components/FoldseekDatabaseSelector.js +1 -1
  3. package/dist/LaunchProteinView/components/FoldseekSearch.js +2 -3
  4. package/dist/LaunchProteinView/components/LaunchProteinViewDialog.js +2 -3
  5. package/dist/LaunchProteinView/components/clinVarTrackSource.js +4 -3
  6. package/dist/LaunchProteinView/components/launchProteinAnnotationView.js +5 -9
  7. package/dist/LaunchProteinView/components/proteinTrackSetup.js +3 -5
  8. package/dist/LaunchProteinView/hooks/useAlphaFoldDBSearch.js +3 -2
  9. package/dist/LaunchProteinView/hooks/useAlphaFoldData.js +10 -5
  10. package/dist/LaunchProteinView/hooks/useFoldseekSearch.js +5 -11
  11. package/dist/LaunchProteinView/index.js +47 -32
  12. package/dist/LaunchProteinView/resolveGeneLaunch.js +15 -12
  13. package/dist/LaunchProteinView/utils/genomeView.js +7 -0
  14. package/dist/LaunchProteinViewExtensionPoint/launchAnnotationView.js +33 -46
  15. package/dist/LaunchProteinViewExtensionPoint/launchProteinView.js +46 -59
  16. package/dist/LaunchProteinViewExtensionPoint/normalizeLaunch.js +54 -9
  17. package/dist/LaunchProteinViewExtensionPoint/transcriptLinkage.js +21 -11
  18. package/dist/ProteinView/alignmentDecision.js +40 -0
  19. package/dist/ProteinView/alignmentDomains.js +15 -12
  20. package/dist/ProteinView/alignmentSites.js +4 -0
  21. package/dist/ProteinView/clinVar.js +1 -21
  22. package/dist/ProteinView/hooks/useUniProtFeatures.js +13 -3
  23. package/dist/ProteinView/hoverReadout.js +44 -0
  24. package/dist/ProteinView/model.js +9 -24
  25. package/dist/ProteinView/proteinColor.js +40 -5
  26. package/dist/ProteinView/proteinToGenomeMapping.js +1 -1
  27. package/dist/ProteinView/reportPluginFailure.js +13 -0
  28. package/dist/ProteinView/structureLoader.js +22 -12
  29. package/dist/ProteinView/structureModel.js +176 -221
  30. package/dist/ProteinView/structurePipeline.js +27 -2
  31. package/dist/ProteinView/structureSuperposer.js +2 -6
  32. package/dist/ProteinView/util.js +0 -4
  33. package/dist/ProteinView/viewInteractions.js +12 -10
  34. package/dist/chunks/{AddStructureDialog-XJLVGA3J.js → AddStructureDialog-C4AV64MD.js} +2 -2
  35. package/dist/chunks/{AlphaMissensePathogenicityAdapter-MEDROHJG.js → AlphaMissensePathogenicityAdapter-IPPLGSAW.js} +2 -2
  36. package/dist/chunks/LaunchProteinViewDialog-A73NNW5K.js +2 -0
  37. package/dist/chunks/LaunchProteinViewDialog-A73NNW5K.js.map +7 -0
  38. package/dist/chunks/{ManualAlignmentDialog-A5WPMFVH.js → ManualAlignmentDialog-A6M3SJGN.js} +2 -2
  39. package/dist/chunks/ProteinView-JRTWVFRV.js +3 -0
  40. package/dist/chunks/{ProteinView-DDO4X5OQ.js.map → ProteinView-JRTWVFRV.js.map} +3 -3
  41. package/dist/chunks/{chunk-CAYS7ALN.js → chunk-2RFFBSIA.js} +2 -2
  42. package/dist/chunks/chunk-2RFFBSIA.js.map +7 -0
  43. package/dist/chunks/chunk-3LIMY6Z5.js +2 -0
  44. package/dist/chunks/chunk-3LIMY6Z5.js.map +7 -0
  45. package/dist/chunks/chunk-5K2DARPA.js +2 -0
  46. package/dist/chunks/chunk-5K2DARPA.js.map +7 -0
  47. package/dist/chunks/chunk-5NBLSM7W.js +2 -0
  48. package/dist/chunks/chunk-5NBLSM7W.js.map +7 -0
  49. package/dist/chunks/chunk-7SEZTF5X.js +2 -0
  50. package/dist/chunks/chunk-7SEZTF5X.js.map +7 -0
  51. package/dist/chunks/chunk-DIM277D5.js +3 -0
  52. package/dist/chunks/chunk-DIM277D5.js.map +7 -0
  53. package/dist/chunks/chunk-KXSOSKHQ.js +2 -0
  54. package/dist/chunks/{chunk-3YUQKRME.js.map → chunk-KXSOSKHQ.js.map} +3 -3
  55. package/dist/chunks/{chunk-MHQZMBO5.js → chunk-LZTO76OW.js} +1 -1
  56. package/dist/chunks/{chunk-MHQZMBO5.js.map → chunk-LZTO76OW.js.map} +1 -1
  57. package/dist/chunks/chunk-NOFPQXHZ.js +2 -0
  58. package/dist/chunks/chunk-NOFPQXHZ.js.map +7 -0
  59. package/dist/chunks/{chunk-OZJGL4WP.js → chunk-OI77P32P.js} +2 -2
  60. package/dist/chunks/chunk-R64WXKZQ.js +2 -0
  61. package/dist/chunks/chunk-R64WXKZQ.js.map +7 -0
  62. package/dist/chunks/chunk-UTDQGJCS.js +2 -0
  63. package/dist/chunks/{chunk-SLV25HTF.js → chunk-Z3277B6H.js} +2 -2
  64. package/dist/chunks/{clinVarSource-NYPYPFNL.js → clinVarSource-YXLGXSMU.js} +2 -2
  65. package/dist/chunks/launchAnnotationView-VEXOWETU.js +2 -0
  66. package/dist/chunks/launchAnnotationView-VEXOWETU.js.map +7 -0
  67. package/dist/chunks/launchProteinView-MCB653LS.js +2 -0
  68. package/dist/chunks/launchProteinView-MCB653LS.js.map +7 -0
  69. package/dist/chunks/launchViewUtils-IQVRMEU6.js +2 -0
  70. package/dist/chunks/model-SLTLE6KF.js +2 -0
  71. package/dist/chunks/model-SLTLE6KF.js.map +7 -0
  72. package/dist/chunks/{molstarExports-4ANVSWG3.js → molstarExports-PDICWFG7.js} +2 -2
  73. package/dist/chunks/resolveGeneLaunch-CWU3P33O.js +2 -0
  74. package/dist/jbrowse-plugin-protein3d.esm.js +1 -1
  75. package/dist/jbrowse-plugin-protein3d.esm.js.map +4 -4
  76. package/dist/test_data/naming.js +4 -0
  77. package/dist/version.js +1 -1
  78. package/package.json +3 -4
  79. package/src/LaunchProteinView/components/AlphaFoldDBSearch.tsx +10 -3
  80. package/src/LaunchProteinView/components/FoldseekActionMenu.tsx +3 -3
  81. package/src/LaunchProteinView/components/FoldseekDatabaseSelector.tsx +2 -4
  82. package/src/LaunchProteinView/components/FoldseekResultsTable.tsx +3 -3
  83. package/src/LaunchProteinView/components/FoldseekSearch.tsx +11 -9
  84. package/src/LaunchProteinView/components/LaunchProteinViewDialog.tsx +4 -3
  85. package/src/LaunchProteinView/components/PdbSearch.tsx +2 -2
  86. package/src/LaunchProteinView/components/ProteinViewActions.tsx +2 -2
  87. package/src/LaunchProteinView/components/UserProvidedStructure.tsx +2 -4
  88. package/src/LaunchProteinView/components/clinVarTrackSource.ts +12 -7
  89. package/src/LaunchProteinView/components/launchProteinAnnotationView.test.ts +1 -20
  90. package/src/LaunchProteinView/components/launchProteinAnnotationView.ts +6 -11
  91. package/src/LaunchProteinView/components/proteinTrackSetup.test.ts +1 -0
  92. package/src/LaunchProteinView/components/proteinTrackSetup.ts +3 -5
  93. package/src/LaunchProteinView/hooks/useAlphaFoldDBSearch.ts +5 -4
  94. package/src/LaunchProteinView/hooks/useAlphaFoldData.test.ts +38 -7
  95. package/src/LaunchProteinView/hooks/useAlphaFoldData.ts +14 -5
  96. package/src/LaunchProteinView/hooks/useFoldseekSearch.ts +9 -15
  97. package/src/LaunchProteinView/index.ts +59 -39
  98. package/src/LaunchProteinView/openAlphaFoldStructure.test.ts +94 -0
  99. package/src/LaunchProteinView/resolveGeneLaunch.ts +26 -15
  100. package/src/LaunchProteinView/utils/genomeView.ts +17 -0
  101. package/src/LaunchProteinView/utils/launchViewUtils.ts +2 -2
  102. package/src/LaunchProteinViewExtensionPoint/findGeneByName.ts +1 -1
  103. package/src/LaunchProteinViewExtensionPoint/launchAnnotationView.ts +45 -52
  104. package/src/LaunchProteinViewExtensionPoint/launchProteinView.ts +65 -116
  105. package/src/LaunchProteinViewExtensionPoint/launchViewSnapshot.test.ts +24 -29
  106. package/src/LaunchProteinViewExtensionPoint/normalizeLaunch.test.ts +55 -0
  107. package/src/LaunchProteinViewExtensionPoint/normalizeLaunch.ts +87 -11
  108. package/src/LaunchProteinViewExtensionPoint/transcriptLinkage.test.ts +71 -0
  109. package/src/LaunchProteinViewExtensionPoint/transcriptLinkage.ts +35 -15
  110. package/src/ProteinView/alignmentDecision.test.ts +162 -0
  111. package/src/ProteinView/alignmentDecision.ts +88 -0
  112. package/src/ProteinView/alignmentDomains.test.ts +29 -1
  113. package/src/ProteinView/alignmentDomains.ts +15 -12
  114. package/src/ProteinView/alignmentSites.test.ts +4 -1
  115. package/src/ProteinView/alignmentSites.ts +5 -0
  116. package/src/ProteinView/applyLociInteractivity.ts +1 -1
  117. package/src/ProteinView/clinVar.test.ts +13 -36
  118. package/src/ProteinView/clinVar.ts +1 -30
  119. package/src/ProteinView/connectedHover.test.ts +1 -1
  120. package/src/ProteinView/geneExplorerLinkage.test.ts +40 -1
  121. package/src/ProteinView/hooks/useUniProtFeatures.test.ts +21 -0
  122. package/src/ProteinView/hooks/useUniProtFeatures.ts +13 -3
  123. package/src/ProteinView/hoverReadout.test.ts +103 -0
  124. package/src/ProteinView/hoverReadout.ts +65 -0
  125. package/src/ProteinView/model.test.ts +27 -0
  126. package/src/ProteinView/model.ts +11 -24
  127. package/src/ProteinView/proteinColor.test.ts +49 -0
  128. package/src/ProteinView/proteinColor.ts +42 -9
  129. package/src/ProteinView/proteinToGenomeMapping.ts +7 -2
  130. package/src/ProteinView/reportPluginFailure.test.ts +62 -0
  131. package/src/ProteinView/reportPluginFailure.ts +21 -0
  132. package/src/ProteinView/residueColors.ts +0 -2
  133. package/src/ProteinView/structureLoader.test.ts +49 -0
  134. package/src/ProteinView/structureLoader.ts +24 -12
  135. package/src/ProteinView/structureModel.test.ts +62 -1
  136. package/src/ProteinView/structureModel.ts +191 -258
  137. package/src/ProteinView/structurePipeline.test.ts +36 -1
  138. package/src/ProteinView/structurePipeline.ts +37 -1
  139. package/src/ProteinView/structureSuperposer.ts +2 -6
  140. package/src/ProteinView/util.test.ts +2 -5
  141. package/src/ProteinView/util.ts +0 -5
  142. package/src/ProteinView/viewInteractions.test.ts +18 -1
  143. package/src/ProteinView/viewInteractions.ts +17 -11
  144. package/src/test_data/naming.ts +6 -0
  145. package/src/version.ts +1 -1
  146. package/dist/LaunchProteinView/services/foldseekApi.js +0 -14
  147. package/dist/chunks/LaunchProteinViewDialog-BE6VHJBW.js +0 -2
  148. package/dist/chunks/LaunchProteinViewDialog-BE6VHJBW.js.map +0 -7
  149. package/dist/chunks/ProteinView-DDO4X5OQ.js +0 -3
  150. package/dist/chunks/chunk-3YUQKRME.js +0 -2
  151. package/dist/chunks/chunk-4VILXRKO.js +0 -2
  152. package/dist/chunks/chunk-4VILXRKO.js.map +0 -7
  153. package/dist/chunks/chunk-6I2O347B.js +0 -2
  154. package/dist/chunks/chunk-6I2O347B.js.map +0 -7
  155. package/dist/chunks/chunk-AU3D6JKD.js +0 -3
  156. package/dist/chunks/chunk-AU3D6JKD.js.map +0 -7
  157. package/dist/chunks/chunk-BOWUUDK4.js +0 -2
  158. package/dist/chunks/chunk-CAYS7ALN.js.map +0 -7
  159. package/dist/chunks/chunk-CMEPVW4G.js +0 -2
  160. package/dist/chunks/chunk-CMEPVW4G.js.map +0 -7
  161. package/dist/chunks/chunk-DQ2NR7LG.js +0 -2
  162. package/dist/chunks/chunk-DQ2NR7LG.js.map +0 -7
  163. package/dist/chunks/chunk-N5N56QXJ.js +0 -2
  164. package/dist/chunks/chunk-N5N56QXJ.js.map +0 -7
  165. package/dist/chunks/chunk-NQUYSAIA.js +0 -2
  166. package/dist/chunks/chunk-NQUYSAIA.js.map +0 -7
  167. package/dist/chunks/launchAnnotationView-Z4AGLG5B.js +0 -2
  168. package/dist/chunks/launchAnnotationView-Z4AGLG5B.js.map +0 -7
  169. package/dist/chunks/launchProteinView-PCSCWBK6.js +0 -2
  170. package/dist/chunks/launchProteinView-PCSCWBK6.js.map +0 -7
  171. package/dist/chunks/launchViewUtils-JYSDBWXI.js +0 -2
  172. package/dist/chunks/model-KRPJ5RD7.js +0 -2
  173. package/dist/chunks/model-KRPJ5RD7.js.map +0 -7
  174. package/dist/chunks/resolveGeneLaunch-3TT7UL33.js +0 -2
  175. package/src/LaunchProteinView/services/foldseekApi.test.ts +0 -121
  176. package/src/LaunchProteinView/services/foldseekApi.ts +0 -66
  177. /package/dist/chunks/{AddStructureDialog-XJLVGA3J.js.map → AddStructureDialog-C4AV64MD.js.map} +0 -0
  178. /package/dist/chunks/{AlphaMissensePathogenicityAdapter-MEDROHJG.js.map → AlphaMissensePathogenicityAdapter-IPPLGSAW.js.map} +0 -0
  179. /package/dist/chunks/{ManualAlignmentDialog-A5WPMFVH.js.map → ManualAlignmentDialog-A6M3SJGN.js.map} +0 -0
  180. /package/dist/chunks/{chunk-OZJGL4WP.js.map → chunk-OI77P32P.js.map} +0 -0
  181. /package/dist/chunks/{chunk-BOWUUDK4.js.map → chunk-UTDQGJCS.js.map} +0 -0
  182. /package/dist/chunks/{chunk-SLV25HTF.js.map → chunk-Z3277B6H.js.map} +0 -0
  183. /package/dist/chunks/{clinVarSource-NYPYPFNL.js.map → clinVarSource-YXLGXSMU.js.map} +0 -0
  184. /package/dist/chunks/{launchViewUtils-JYSDBWXI.js.map → launchViewUtils-IQVRMEU6.js.map} +0 -0
  185. /package/dist/chunks/{molstarExports-4ANVSWG3.js.map → molstarExports-PDICWFG7.js.map} +0 -0
  186. /package/dist/chunks/{resolveGeneLaunch-3TT7UL33.js.map → resolveGeneLaunch-CWU3P33O.js.map} +0 -0
@@ -42,13 +42,17 @@ const AlphaFoldDBSearch = observer(function AlphaFoldDBSearch({ feature, preferr
42
42
  "AlphaFold DB has no model for ",
43
43
  state.uniprotId,
44
44
  ". The PDB and Foldseek tabs may have a structure.")) : null,
45
+ state.modelsUnreachable ? (React.createElement(Typography, null,
46
+ "AlphaFold DB's model list did not answer, so Launch opens the canonical model file for ",
47
+ state.uniprotId,
48
+ ", without comparing its sequence to the isoforms.")) : null,
45
49
  React.createElement(UniProtLookupControls, { lookup: lookup }),
46
50
  state.loadingStatuses.map(status => (React.createElement(LoadingEllipses, { key: status, variant: "subtitle2", message: status }))),
47
51
  React.createElement(PartialFailureNotice, { message: state.isoformPartialFailure }),
48
52
  React.createElement(UniProtLookupResults, { lookup: lookup }),
49
53
  state.ranking &&
50
54
  state.selectedTranscript &&
51
- state.structureSequence &&
55
+ (state.structureSequence || state.modelsUnreachable) &&
52
56
  state.uniprotId ? (React.createElement(React.Fragment, null,
53
57
  React.createElement("div", { className: classes.selectorsRow },
54
58
  React.createElement(TranscriptSelector, { val: state.userSelection, setVal: state.setUserSelection, structureSequence: state.structureSequence, feature: feature, isoforms: state.transcriptOptions, ranking: state.ranking })),
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Button, Checkbox, FormControlLabel, FormGroup, Typography, } from '@mui/material';
3
+ import { FOLDSEEK_DATABASES } from 'p2s_mapper';
3
4
  import { makeStyles } from 'tss-react/mui';
4
- import { FOLDSEEK_DATABASES, } from '../services/foldseekApi';
5
5
  const useStyles = makeStyles()({
6
6
  root: {
7
7
  display: 'flex',
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
  import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
3
3
  import { Button, DialogActions, DialogContent, Link, TextField, Typography, } from '@mui/material';
4
4
  import { observer } from 'mobx-react';
5
- import { stripAllStopCodons } from 'p2s_mapper';
5
+ import { DEFAULT_FOLDSEEK_DATABASES, cleanFoldseekSequence, foldseekLengthProblem, stripAllStopCodons, } from 'p2s_mapper';
6
6
  import { makeStyles } from 'tss-react/mui';
7
7
  import FoldseekDatabaseSelector from './FoldseekDatabaseSelector';
8
8
  import FoldseekResultsTable from './FoldseekResultsTable';
@@ -10,7 +10,6 @@ import PartialFailureNotice from './PartialFailureNotice';
10
10
  import TranscriptSelector from './TranscriptSelector';
11
11
  import useFoldseekSearch from '../hooks/useFoldseekSearch';
12
12
  import useTranscriptIsoformSelection from '../hooks/useTranscriptIsoformSelection';
13
- import { DEFAULT_DATABASES, cleanFoldseekSequence, foldseekLengthProblem, } from '../services/foldseekApi';
14
13
  const useStyles = makeStyles()({
15
14
  dialogContent: {
16
15
  width: '80em',
@@ -31,7 +30,7 @@ const useStyles = makeStyles()({
31
30
  const FoldseekSearch = observer(function FoldseekSearch({ feature, preferredTranscriptId, session, view, handleClose, }) {
32
31
  const { classes } = useStyles();
33
32
  const [userEditedSequence, setUserEditedSequence] = useState();
34
- const [selectedDatabases, setSelectedDatabases] = useState(DEFAULT_DATABASES);
33
+ const [selectedDatabases, setSelectedDatabases] = useState(DEFAULT_FOLDSEEK_DATABASES);
35
34
  const [show3Di, setShow3Di] = useState(false);
36
35
  const { results, cleanedAaSequence, di3Sequence, isLoading, isPredicting, error, statusMessage, predictStructure, search, cancel, reset, } = useFoldseekSearch();
37
36
  const { transcripts, isoformSequences, ranking, isLoading: isLoadingIsoforms, error: isoformError, partialFailure: isoformPartialFailure, selectedTranscriptId: effectiveSelectedTranscriptId, setSelectedTranscriptId: setUserSelection, selectedTranscript, selectedIsoform: selectedIsoformData, } = useTranscriptIsoformSelection({
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Dialog } from '@jbrowse/core/ui';
3
- import { getContainingView, getSession } from '@jbrowse/core/util';
3
+ import { getSession } from '@jbrowse/core/util';
4
4
  import { Tab, Tabs } from '@mui/material';
5
5
  import AlphaFoldDBSearch from './AlphaFoldDBSearch';
6
6
  import FoldseekSearch from './FoldseekSearch';
@@ -10,10 +10,9 @@ import TabPanel from './TabPanel';
10
10
  import UserProvidedStructure from './UserProvidedStructure';
11
11
  import useUniProtIdLookup from '../hooks/useUniProtIdLookup';
12
12
  import { getLaunchSideBySide, setLaunchSideBySide } from '../utils/sideBySide';
13
- export default function LaunchProteinViewDialog({ handleClose, feature, preferredTranscriptId, model, }) {
13
+ export default function LaunchProteinViewDialog({ handleClose, feature, preferredTranscriptId, model, view, }) {
14
14
  const [choice, setChoice] = useState(0);
15
15
  const session = getSession(model);
16
- const view = getContainingView(model);
17
16
  // One lookup for the whole dialog: the tabs stay mounted once visited, so a
18
17
  // lookup per tab meant the same UniProt search ran twice and a row picked on
19
18
  // one tab left the other pointing at a different gene.
@@ -5,6 +5,7 @@ import { linkedGenomeAssemblyName, resolveLinkageAlignment, } from '../../Protei
5
5
  import { sessionLinkageHost } from '../../Protein1DLinkage/sessionLinkageHost';
6
6
  import { clinVarBuild, isUnnumberedMitochondrion, } from '../../ProteinView/clinVar';
7
7
  import { placeClinVarOnTranscript } from '../../ProteinView/clinVarSource';
8
+ import { withTimeout } from '../../ProteinView/variantEffectSource';
8
9
  // TP53's slice is under 1 MB; a stalled host should not hold the view open
9
10
  // forever on one track
10
11
  const CLINVAR_TIMEOUT_MS = 60_000;
@@ -35,13 +36,13 @@ export async function clinVarTrackConfFor({ session, linkage, idPrefix, }) {
35
36
  if (!('alignment' in linked)) {
36
37
  return undefined;
37
38
  }
38
- const { placed } = await placeClinVarOnTranscript({
39
+ const { placed } = await withTimeout(signal => placeClinVarOnTranscript({
39
40
  build,
40
41
  feature: new SimpleFeature(feature),
41
42
  assemblyName,
42
43
  session,
43
- signal: AbortSignal.timeout(CLINVAR_TIMEOUT_MS),
44
- });
44
+ signal,
45
+ }), CLINVAR_TIMEOUT_MS);
45
46
  const mapper = makeCoordinateMapper(linked.alignment);
46
47
  return clinVarTrackConf({
47
48
  uniprotId,
@@ -18,15 +18,11 @@ export async function launchProteinAnnotationView(args) {
18
18
  /** The view, once the entry's feature types are in hand. */
19
19
  export async function openProteinAnnotationView({ session, feature, selectedTranscript, uniprotId, confidenceUrl, connectedViewId, connectedAssemblyName, featureTypes, clinVar, }) {
20
20
  // A second view of an entry, another isoform's say, shares the first's
21
- // assembly; adding it again makes the host warn. `has`, where the host has
22
- // it, because `get` reports an unknown name to every plugin that resolves
23
- // assemblies, and on a jbrowse.org/ucsc config the Hubs plugin then probes
24
- // jbrowse.org/ucsc/P04637/ and logs two 404s.
25
- const { assemblyManager } = session;
26
- const known = assemblyManager.has
27
- ? assemblyManager.has(uniprotId)
28
- : !!assemblyManager.get(uniprotId);
29
- if (!known) {
21
+ // assembly; adding it again makes the host warn. `has`, because `get` reports
22
+ // an unknown name to every plugin that resolves assemblies, and on a
23
+ // jbrowse.org/ucsc config the Hubs plugin then probes jbrowse.org/ucsc/P04637/
24
+ // and logs two 404s.
25
+ if (!session.assemblyManager.has(uniprotId)) {
30
26
  setupProteinAssembly(session, uniprotId);
31
27
  }
32
28
  // The linkage drives the 1D<->genome hover highlight. It is a property of
@@ -2,15 +2,13 @@ import { myfetch, uniprotGffUrl } from 'p2s_mapper';
2
2
  import { RESIDUE_COLORS } from '../../ProteinView/residueColors';
3
3
  import { UNIPROT_FEATURE_COLOR } from '../../ProteinView/uniprotFeatureTypes';
4
4
  // A quantitative display's color reads only `score`, and a linear one ramps
5
- // across the plot's y domain, so it takes the ramp's stops and middle alone.
6
- // Hosts before 2026-09-26 refuse a wiggle color's `title` and `labels`; the
7
- // threshold needs its labels, and the ramp leaves both off to load there too.
5
+ // across the plot's y domain, so it takes the ramp's stops, middle and title
8
6
  function wiggleColor(color) {
9
7
  if (color.scale === 'threshold') {
10
8
  return { ...color, field: 'score' };
11
9
  }
12
- const { scale, range, domainMid } = color;
13
- return { field: 'score', scale, range, domainMid };
10
+ const { scale, range, domainMid, title } = color;
11
+ return { field: 'score', scale, range, domainMid, title };
14
12
  }
15
13
  export async function fetchUniProtFeatureTypes(uniprotId) {
16
14
  const data = await (await myfetch(uniprotGffUrl(uniprotId))).text();
@@ -4,7 +4,7 @@ import useAlphaFoldData from './useAlphaFoldData';
4
4
  import useTranscriptIsoformSelection from './useTranscriptIsoformSelection';
5
5
  export default function useAlphaFoldDBSearch({ feature, view, lookup, preferredTranscriptId, }) {
6
6
  const { uniprotId, isLookupLoading } = lookup;
7
- const { isLoading: isAlphaFoldLoading, isValidating: isAlphaFoldValidating, error: alphaFoldError, model, noModel, } = useAlphaFoldData({ uniprotId, feature, view });
7
+ const { isLoading: isAlphaFoldLoading, isValidating: isAlphaFoldValidating, modelsUnreachable, model, noModel, } = useAlphaFoldData({ uniprotId, feature, view });
8
8
  // a stable array, or the isoform picker realigns on every render
9
9
  const modelSequence = model?.sequence;
10
10
  const structureSequences = useMemo(() => (modelSequence ? [modelSequence] : undefined), [modelSequence]);
@@ -23,7 +23,7 @@ export default function useAlphaFoldDBSearch({ feature, view, lookup, preferredT
23
23
  ].filter(s => typeof s === 'string');
24
24
  const isLoading = loadingStatuses.length > 0;
25
25
  // errors wait for loading to finish, so a lookup in flight doesn't flash one
26
- const rawError = isoformError ?? lookup.lookupError ?? alphaFoldError;
26
+ const rawError = isoformError ?? lookup.lookupError;
27
27
  const error = isLoading ? undefined : rawError;
28
28
  return {
29
29
  ...lookup,
@@ -40,6 +40,7 @@ export default function useAlphaFoldDBSearch({ feature, view, lookup, preferredT
40
40
  modelAccession: model?.accession,
41
41
  structureSequence,
42
42
  noModel,
43
+ modelsUnreachable: isLoading ? undefined : modelsUnreachable,
43
44
  error,
44
45
  loadingStatuses,
45
46
  // While the structure is refetched, structureSequence is still the previous
@@ -1,21 +1,26 @@
1
1
  import { useMemo } from 'react';
2
- import { fetchAlphaFoldModels, pickAlphaFoldModel } from 'p2s_mapper';
2
+ import { fetchAlphaFoldModels } from 'p2s_mapper';
3
3
  import useSWR from 'swr';
4
4
  import { STATIC_SWR_OPTIONS } from './swrOptions';
5
5
  import useIsoformProteinSequences from './useIsoformProteinSequences';
6
- /** The AlphaFold DB model a launch opens for this gene's accession. */
6
+ import { launchAlphaFoldModel } from '../resolveGeneLaunch';
7
+ /**
8
+ * The AlphaFold DB model a launch opens for this gene's accession, the
9
+ * canonical file when the API does not answer.
10
+ */
7
11
  export default function useAlphaFoldData({ uniprotId, feature, view, }) {
8
12
  const { data, isLoading, isValidating, error } = useSWR(uniprotId ? ['alphafold-models', uniprotId] : null, ([, id]) => fetchAlphaFoldModels(id), { ...STATIC_SWR_OPTIONS, keepPreviousData: true });
9
13
  const { isoformSequences } = useIsoformProteinSequences({ feature, view });
10
14
  // keepPreviousData hands back the last accession's models after an error
11
15
  // and after the accession is cleared, when the key is null
12
- const model = useMemo(() => uniprotId && data && !error
13
- ? pickAlphaFoldModel(data, isoformSequences)
16
+ const model = useMemo(() => uniprotId && (data || error)
17
+ ? launchAlphaFoldModel(uniprotId, error ? undefined : data, isoformSequences)
14
18
  : undefined, [uniprotId, data, error, isoformSequences]);
19
+ const modelsUnreachable = uniprotId ? error : undefined;
15
20
  return {
16
21
  isLoading,
17
22
  isValidating,
18
- error,
23
+ modelsUnreachable,
19
24
  model,
20
25
  noModel: !!uniprotId && !isLoading && !error && data?.length === 0,
21
26
  };
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
- import { predict3Di, submitFoldseekSearch, waitForFoldseekResults, } from '../services/foldseekApi';
2
+ import { predict3Di, submitFoldseekSearch, waitForFoldseekResults, } from 'p2s_mapper';
3
3
  export default function useFoldseekSearch() {
4
4
  const [results, setResults] = useState();
5
5
  const [predictData, setPredictData] = useState();
@@ -28,7 +28,7 @@ export default function useFoldseekSearch() {
28
28
  setError(undefined);
29
29
  setStatusMessage('Predicting 3Di structure...');
30
30
  try {
31
- const result = await predict3Di({ aaSequence, signal });
31
+ const result = await predict3Di(aaSequence, { signal });
32
32
  setPredictData(result);
33
33
  return result;
34
34
  }
@@ -52,15 +52,9 @@ export default function useFoldseekSearch() {
52
52
  setError(undefined);
53
53
  setStatusMessage('Submitting search...');
54
54
  try {
55
- const ticket = await submitFoldseekSearch({
56
- aaSequence: aaSeq,
57
- di3Sequence: di3Seq,
58
- databases,
59
- signal,
60
- });
61
- const result = await waitForFoldseekResults({
62
- ticketId: ticket.id,
63
- onStatusChange: setStatusMessage,
55
+ const ticket = await submitFoldseekSearch({ aaSequence: aaSeq, di3Sequence: di3Seq, databases }, { signal });
56
+ const result = await waitForFoldseekResults(ticket.id, {
57
+ onStatus: setStatusMessage,
64
58
  signal,
65
59
  });
66
60
  setResults(result);
@@ -2,6 +2,7 @@ import { lazy } from 'react';
2
2
  import { getContainingTrack, getContainingView, getSession, isGeneLikeType, } from '@jbrowse/core/util';
3
3
  import AddIcon from '@mui/icons-material/Add';
4
4
  import { isCodingFeature } from './codingFeature';
5
+ import { isLaunchingGenomeView } from './utils/genomeView';
5
6
  import { getGeneDisplayName } from './utils/util';
6
7
  // the menu items register at boot; what they open loads on the first click
7
8
  const LaunchProteinViewDialog = lazy(() => import('./components/LaunchProteinViewDialog'));
@@ -49,11 +50,17 @@ function withCodingFeature(self, target, then) {
49
50
  });
50
51
  }
51
52
  function openDialog(self, target, feature) {
52
- const track = getContainingTrack(self);
53
- getSession(self).queueDialog(handleClose => [
53
+ const session = getSession(self);
54
+ const view = getContainingView(self);
55
+ if (!isLaunchingGenomeView(view)) {
56
+ session.notify(`A protein view launches from a genome view, not a ${view.type}`, 'warning');
57
+ return;
58
+ }
59
+ session.queueDialog(handleClose => [
54
60
  LaunchProteinViewDialog,
55
61
  {
56
- model: track,
62
+ model: getContainingTrack(self),
63
+ view,
57
64
  handleClose,
58
65
  feature,
59
66
  preferredTranscriptId: target.preferredTranscriptId,
@@ -65,49 +72,57 @@ function launchProteinView(self, target) {
65
72
  openDialog(self, target, feature);
66
73
  });
67
74
  }
68
- function firstAssemblyName(view) {
69
- const names = 'assemblyNames' in view ? view.assemblyNames : undefined;
70
- const first = Array.isArray(names) ? names[0] : undefined;
71
- return typeof first === 'string' ? first : undefined;
72
- }
75
+ const lookingUp = new Set();
73
76
  // The dialog's defaults without the dialog. Where they name no single
74
77
  // structure, a gene two UniProt entries answer to or one AlphaFold has not
75
78
  // folded, the dialog opens for the choice only a person can make.
76
79
  function openAlphaFoldStructure(self, target) {
77
80
  const session = getSession(self);
78
81
  const view = getContainingView(self);
79
- const assemblyName = firstAssemblyName(view);
80
82
  withCodingFeature(self, target, async (feature) => {
81
83
  const name = getGeneDisplayName(feature);
82
- if (!assemblyName) {
84
+ const genomeView = isLaunchingGenomeView(view) ? view : undefined;
85
+ const assemblyName = genomeView?.assemblyNames[0];
86
+ if (!genomeView || !assemblyName) {
83
87
  openDialog(self, target, feature);
84
88
  return;
85
89
  }
86
- session.notify(`Looking up the AlphaFold structure of ${name}`, 'info');
87
- const [{ describeMissingStructure, resolveGeneLaunch, sessionGeneLaunchHost }, { launch3DProteinView },] = await Promise.all([
88
- import('./resolveGeneLaunch'),
89
- import('./utils/launchViewUtils'),
90
- ]);
91
- const launch = await resolveGeneLaunch({
92
- host: sessionGeneLaunchHost(session, assemblyName),
93
- feature,
94
- preferredTranscriptId: target.preferredTranscriptId,
95
- });
96
- const { transcript, userProvidedTranscriptSequence, uniprotId, url } = launch;
97
- if (url) {
98
- await launch3DProteinView({
99
- session,
100
- view,
90
+ const key = `${genomeView.id}:${feature.id()}:${target.preferredTranscriptId}`;
91
+ if (lookingUp.has(key)) {
92
+ session.notify(`Still looking up the AlphaFold structure of ${name}`, 'info');
93
+ return;
94
+ }
95
+ lookingUp.add(key);
96
+ try {
97
+ session.notify(`Looking up the AlphaFold structure of ${name}`, 'info');
98
+ const [{ describeMissingStructure, resolveGeneLaunch, sessionGeneLaunchHost }, { launch3DProteinView },] = await Promise.all([
99
+ import('./resolveGeneLaunch'),
100
+ import('./utils/launchViewUtils'),
101
+ ]);
102
+ const launch = await resolveGeneLaunch({
103
+ host: sessionGeneLaunchHost(session, assemblyName),
101
104
  feature,
102
- selectedTranscript: transcript,
103
- uniprotId,
104
- url,
105
- userProvidedTranscriptSequence,
105
+ preferredTranscriptId: target.preferredTranscriptId,
106
106
  });
107
+ const { transcript, userProvidedTranscriptSequence, uniprotId, url } = launch;
108
+ if (url) {
109
+ await launch3DProteinView({
110
+ session,
111
+ view: genomeView,
112
+ feature,
113
+ selectedTranscript: transcript,
114
+ uniprotId,
115
+ url,
116
+ userProvidedTranscriptSequence,
117
+ });
118
+ }
119
+ else {
120
+ session.notify(describeMissingStructure(name, launch), launch.lookupError === undefined ? 'info' : 'warning');
121
+ openDialog(self, target, feature);
122
+ }
107
123
  }
108
- else {
109
- session.notify(describeMissingStructure(name, launch), launch.lookupError === undefined ? 'info' : 'warning');
110
- openDialog(self, target, feature);
124
+ finally {
125
+ lookingUp.delete(key);
111
126
  }
112
127
  });
113
128
  }
@@ -5,6 +5,17 @@ import { rankIsoforms, rankedTranscriptId, } from '../AlignTranscriptRpc/isoform
5
5
  import { fetchTranscriptProteinSeqs } from './utils/translateTranscripts';
6
6
  import { extractFeatureIdentifiers, extractTaxonId } from './utils/util';
7
7
  import { alignOffThread } from '../ProteinView/alignOffThread';
8
+ /**
9
+ * The AlphaFold file a launch opens, `models` undefined when the API did not
10
+ * answer. That says nothing about the accession, so the spelled canonical
11
+ * filename is worth a try; an API answering with no models has said there is
12
+ * nothing to open. The structure loader draws the same line.
13
+ */
14
+ export function launchAlphaFoldModel(uniprotId, models, isoformSequences) {
15
+ return models
16
+ ? pickAlphaFoldModel(models, isoformSequences)
17
+ : { accession: uniprotId, url: getAlphaFoldStructureUrl(uniprotId) };
18
+ }
8
19
  /** Why a resolved gene has no structure to open. */
9
20
  export function describeMissingStructure(geneName, { uniprotId, lookupError }) {
10
21
  return uniprotId
@@ -101,19 +112,11 @@ export async function resolveGeneLaunch({ host, feature, preferredTranscriptId,
101
112
  id: t.transcript.id(),
102
113
  seq: t.seq,
103
114
  }));
104
- // An unreachable API says nothing about the accession, so the spelled
105
- // canonical filename is worth a try; an API answering with no models has
106
- // said there is nothing to open. The structure loader draws the same line.
107
- const models = uniprotId
108
- ? await host.fetchAlphaFoldModels(uniprotId).catch(() => undefined)
109
- : [];
110
- const model = models
111
- ? pickAlphaFoldModel(models, Object.fromEntries(isoforms.map(i => [i.id, { seq: i.seq ?? '' }])))
115
+ const model = uniprotId
116
+ ? launchAlphaFoldModel(uniprotId, await host.fetchAlphaFoldModels(uniprotId).catch(() => undefined), Object.fromEntries(isoforms.map(i => [i.id, { seq: i.seq ?? '' }])))
112
117
  : undefined;
113
- const url = uniprotId && models === undefined
114
- ? getAlphaFoldStructureUrl(uniprotId)
115
- : model?.url;
116
- const structureSequences = model ? [model.sequence] : [];
118
+ const url = model?.url;
119
+ const structureSequences = model?.sequence ? [model.sequence] : [];
117
120
  const preferred = translated.find(t => t.transcript.id() === preferredTranscriptId);
118
121
  const ranking = preferred
119
122
  ? undefined
@@ -0,0 +1,7 @@
1
+ export function isLaunchingGenomeView(view) {
2
+ return ('id' in view &&
3
+ typeof view.id === 'string' &&
4
+ 'assemblyNames' in view &&
5
+ Array.isArray(view.assemblyNames) &&
6
+ view.assemblyNames.every(name => typeof name === 'string'));
7
+ }
@@ -1,7 +1,7 @@
1
1
  import { SimpleFeature } from '@jbrowse/core/util';
2
2
  import { fetchAlphaFoldModels } from 'p2s_mapper';
3
3
  import { normalizeAnnotationLaunch } from './normalizeAnnotationLaunch';
4
- import { connectGenomeView, resolveTranscriptLinkage, } from './transcriptLinkage';
4
+ import { resolveTranscriptLinkage, withConnectedGenomeView, } from './transcriptLinkage';
5
5
  import { clinVarTrackConfFor } from '../LaunchProteinView/components/clinVarTrackSource';
6
6
  import { openProteinAnnotationView } from '../LaunchProteinView/components/launchProteinAnnotationView';
7
7
  import { canAddTemporaryAssembly } from '../LaunchProteinView/components/proteinAssemblySetup';
@@ -20,63 +20,50 @@ async function entryConfidenceUrl(uniprotId) {
20
20
  return undefined;
21
21
  }
22
22
  }
23
+ /** Fails by throwing, as `launchProteinView` does and for the same reason. */
23
24
  export async function launchAnnotationView(args) {
24
25
  const { session, ...given } = args;
25
- const fail = (e) => {
26
- console.error(e);
27
- session.notify(`Could not launch protein annotation view: ${e}`, 'error');
28
- return args;
29
- };
30
26
  const normalized = normalizeAnnotationLaunch(given);
31
27
  for (const warning of normalized.warnings) {
32
28
  console.warn(warning);
33
29
  session.notify(`Protein annotation view launch: ${warning}`, 'warning');
34
30
  }
35
31
  if ('error' in normalized) {
36
- return fail(normalized.error);
32
+ throw new Error(normalized.error);
37
33
  }
38
34
  if (!canAddTemporaryAssembly(session)) {
39
- return fail('this session cannot add the temporary assembly the view opens on');
35
+ throw new Error('this session cannot add the temporary assembly the view opens on');
40
36
  }
41
37
  const { launch } = normalized;
42
- try {
43
- const { named, resolved, connectedView } = await resolveTranscriptLinkage(session, launch, {
44
- findStructure: !launch.uniprotId,
45
- });
46
- const accession = launch.uniprotId ?? named?.uniprotId;
47
- if (!accession) {
48
- throw new Error(launch.gene && named
49
- ? `${describeMissingStructure(launch.gene, named)}; name a uniprotId`
50
- : 'no UniProt entry to open');
51
- }
52
- const uniprotId = uniProtEntry(accession);
53
- // fetched before anything is added, so a failure leaves no view
54
- const [featureTypes, confidenceUrl] = await Promise.all([
55
- fetchUniProtFeatureTypes(uniprotId),
56
- entryConfidenceUrl(uniprotId),
57
- ]);
58
- const transcript = resolved
59
- ? new SimpleFeature(resolved.feature)
60
- : undefined;
61
- const connectedViewId = transcript
62
- ? connectGenomeView(session, launch.connectedViewId, connectedView)
63
- : undefined;
64
- await openProteinAnnotationView({
65
- session,
66
- feature: transcript,
67
- selectedTranscript: transcript,
68
- uniprotId,
69
- confidenceUrl,
70
- connectedViewId,
71
- connectedAssemblyName: (launch.connectedViewId
72
- ? viewAssemblyName(session, launch.connectedViewId)
73
- : undefined) ?? connectedView?.assembly,
74
- featureTypes,
75
- clinVar: (linkage, idPrefix) => clinVarTrackConfFor({ session, linkage, idPrefix }),
76
- });
77
- }
78
- catch (e) {
79
- return fail(e);
38
+ const { named, resolved, connectedView } = await resolveTranscriptLinkage(session, launch, {
39
+ findStructure: !launch.uniprotId,
40
+ });
41
+ const accession = launch.uniprotId ?? named?.uniprotId;
42
+ if (!accession) {
43
+ throw new Error(launch.gene && named
44
+ ? `${describeMissingStructure(launch.gene, named)}; name a uniprotId`
45
+ : 'no UniProt entry to open');
80
46
  }
47
+ const uniprotId = uniProtEntry(accession);
48
+ const [featureTypes, confidenceUrl] = await Promise.all([
49
+ fetchUniProtFeatureTypes(uniprotId),
50
+ entryConfidenceUrl(uniprotId),
51
+ ]);
52
+ const transcript = resolved ? new SimpleFeature(resolved.feature) : undefined;
53
+ await withConnectedGenomeView(session, transcript
54
+ ? { connectedViewId: launch.connectedViewId, connectedView }
55
+ : {}, connectedViewId => openProteinAnnotationView({
56
+ session,
57
+ feature: transcript,
58
+ selectedTranscript: transcript,
59
+ uniprotId,
60
+ confidenceUrl,
61
+ connectedViewId,
62
+ connectedAssemblyName: (launch.connectedViewId
63
+ ? viewAssemblyName(session, launch.connectedViewId)
64
+ : undefined) ?? connectedView?.assembly,
65
+ featureTypes,
66
+ clinVar: (linkage, idPrefix) => clinVarTrackConfFor({ session, linkage, idPrefix }),
67
+ }));
81
68
  return args;
82
69
  }