jbrowse-plugin-protein3d 1.30.0 → 1.32.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 (184) hide show
  1. package/README.md +6 -3
  2. package/dist/LaunchProteinView/components/FoldseekActionMenu.js +1 -2
  3. package/dist/LaunchProteinView/components/GeneStructures.js +209 -0
  4. package/dist/LaunchProteinView/components/HelpDialog.js +9 -8
  5. package/dist/LaunchProteinView/components/LaunchOptionsMenu.js +4 -11
  6. package/dist/LaunchProteinView/components/LaunchProteinViewDialog.js +8 -27
  7. package/dist/LaunchProteinView/components/ProteinViewActions.js +7 -24
  8. package/dist/LaunchProteinView/components/StructureList.js +103 -0
  9. package/dist/LaunchProteinView/components/StructureListRow.js +192 -0
  10. package/dist/LaunchProteinView/components/TranscriptSelector.js +2 -2
  11. package/dist/LaunchProteinView/components/UniProtResultsTable.js +1 -1
  12. package/dist/LaunchProteinView/components/UniProtSummaryBar.js +110 -0
  13. package/dist/LaunchProteinView/components/UserProvidedStructure.js +3 -2
  14. package/dist/LaunchProteinView/hooks/useAlphaFoldComplexes.js +31 -0
  15. package/dist/LaunchProteinView/hooks/useAlphaFoldData.js +5 -0
  16. package/dist/LaunchProteinView/hooks/useGeneStructures.js +119 -0
  17. package/dist/LaunchProteinView/hooks/usePdbEntrySummaries.js +10 -0
  18. package/dist/LaunchProteinView/hooks/useStructureLaunch.js +79 -0
  19. package/dist/LaunchProteinView/hooks/useTranscriptIsoformSelection.js +1 -1
  20. package/dist/LaunchProteinView/hooks/useUniProtIdLookup.js +2 -2
  21. package/dist/LaunchProteinView/index.js +1 -1
  22. package/dist/LaunchProteinView/utils/launchHelpers.js +4 -11
  23. package/dist/LaunchProteinView/utils/launchViewUtils.js +7 -10
  24. package/dist/LaunchProteinView/utils/structureList.js +232 -0
  25. package/dist/LaunchProteinViewExtensionPoint/normalizeLaunch.js +8 -4
  26. package/dist/LaunchProteinViewExtensionPoint/resolveShortLaunch.js +1 -1
  27. package/dist/ProteinView/components/HeaderStructureRow.js +5 -1
  28. package/dist/ProteinView/crystallizationAdditives.js +6 -1
  29. package/dist/ProteinView/fileUniProt.js +25 -0
  30. package/dist/ProteinView/molstarExports.js +1 -0
  31. package/dist/ProteinView/proteinViewSpec.js +1 -0
  32. package/dist/ProteinView/structureLoader.js +28 -9
  33. package/dist/ProteinView/structureModel.js +52 -10
  34. package/dist/ProteinView/structureReport.js +9 -2
  35. package/dist/ProteinView/structureSuperposer.js +67 -19
  36. package/dist/ProteinView/superposeStructures.js +233 -53
  37. package/dist/ProteinView/superpositionOutcome.js +74 -0
  38. package/dist/chunks/{AddStructureDialog-VO35RYOW.js → AddStructureDialog-RO4QWRSL.js} +2 -2
  39. package/dist/chunks/HelpDialog-IKLXHB3B.js +2 -0
  40. package/dist/chunks/HelpDialog-IKLXHB3B.js.map +7 -0
  41. package/dist/chunks/LaunchProteinViewDialog-I2DFRUSD.js +3 -0
  42. package/dist/chunks/LaunchProteinViewDialog-I2DFRUSD.js.map +7 -0
  43. package/dist/chunks/{ManualAlignmentDialog-VGHPVBF5.js → ManualAlignmentDialog-IWVSCVAI.js} +2 -2
  44. package/dist/chunks/ProteinView-QUCIMT3H.js +3 -0
  45. package/dist/chunks/ProteinView-QUCIMT3H.js.map +7 -0
  46. package/dist/chunks/{chunk-KIR7LMDB.js → chunk-34K4PBXC.js} +2 -2
  47. package/dist/chunks/{chunk-OT7KMAGM.js → chunk-4YOPOPED.js} +3 -3
  48. package/dist/chunks/{chunk-OT7KMAGM.js.map → chunk-4YOPOPED.js.map} +3 -3
  49. package/dist/chunks/{chunk-IL53MSBO.js → chunk-53Z5PTMG.js} +2 -2
  50. package/dist/chunks/{chunk-AFVOEGWH.js → chunk-A4XT2SQ7.js} +2 -2
  51. package/dist/chunks/chunk-ENPYAI4H.js +2 -0
  52. package/dist/chunks/chunk-ENPYAI4H.js.map +7 -0
  53. package/dist/chunks/{chunk-22HNUQZG.js → chunk-ENW425OE.js} +2 -2
  54. package/dist/chunks/{chunk-MHLZDRGW.js → chunk-FDHODUXS.js} +2 -2
  55. package/dist/chunks/chunk-FDHODUXS.js.map +7 -0
  56. package/dist/chunks/{chunk-RQCZWHQQ.js → chunk-G67ZYVWG.js} +2 -2
  57. package/dist/chunks/chunk-JKKI7LFR.js +39 -0
  58. package/dist/chunks/chunk-JKKI7LFR.js.map +7 -0
  59. package/dist/chunks/chunk-KAP5JKRU.js +2 -0
  60. package/dist/chunks/chunk-KAP5JKRU.js.map +7 -0
  61. package/dist/chunks/{chunk-BIJXO4M2.js → chunk-KL7O7H46.js} +2 -2
  62. package/dist/chunks/{chunk-MRFSMEU2.js → chunk-Q5QGMPYL.js} +2 -2
  63. package/dist/chunks/chunk-UWFZCUMZ.js +2 -0
  64. package/dist/chunks/{chunk-5KWZTAUL.js.map → chunk-UWFZCUMZ.js.map} +4 -4
  65. package/dist/chunks/chunk-VQRND5DF.js +2 -0
  66. package/dist/chunks/chunk-VQRND5DF.js.map +7 -0
  67. package/dist/chunks/{chunk-WGXE3R2M.js → chunk-XQ5PSSWY.js} +2 -2
  68. package/dist/chunks/clinVarSource-36GTMEOG.js +2 -0
  69. package/dist/chunks/esm-SMVEMW7D.js +2 -0
  70. package/dist/chunks/isoformRanking-UO3MADA5.js +2 -0
  71. package/dist/chunks/{launchAnnotationView-NENNHQJN.js → launchAnnotationView-5RYUC7P4.js} +2 -2
  72. package/dist/chunks/{launchProteinView-HJOBR66M.js → launchProteinView-FD36C2FW.js} +2 -2
  73. package/dist/chunks/launchViewUtils-FTOMSLZU.js +2 -0
  74. package/dist/chunks/model-I3FOCWUA.js +2 -0
  75. package/dist/chunks/model-I3FOCWUA.js.map +7 -0
  76. package/dist/chunks/{molstarExports-VWIGD7KO.js → molstarExports-5EF5VYZ6.js} +20 -20
  77. package/dist/chunks/resolveGeneLaunch-Q3SSFZGF.js +2 -0
  78. package/dist/jbrowse-plugin-protein3d.esm.js +1 -1
  79. package/dist/jbrowse-plugin-protein3d.esm.js.map +2 -2
  80. package/dist/test_data/molstarStructure.js +6 -4
  81. package/dist/version.js +1 -1
  82. package/package.json +2 -2
  83. package/src/LaunchProteinView/components/FoldseekActionMenu.tsx +1 -2
  84. package/src/LaunchProteinView/components/GeneStructures.tsx +358 -0
  85. package/src/LaunchProteinView/components/HelpDialog.tsx +19 -18
  86. package/src/LaunchProteinView/components/LaunchOptionsMenu.tsx +1 -20
  87. package/src/LaunchProteinView/components/LaunchProteinViewDialog.tsx +9 -40
  88. package/src/LaunchProteinView/components/ProteinViewActions.tsx +29 -76
  89. package/src/LaunchProteinView/components/StructureList.tsx +202 -0
  90. package/src/LaunchProteinView/components/StructureListRow.tsx +296 -0
  91. package/src/LaunchProteinView/components/TranscriptSelector.tsx +3 -0
  92. package/src/LaunchProteinView/components/UniProtResultsTable.tsx +1 -1
  93. package/src/LaunchProteinView/components/UniProtSummaryBar.tsx +170 -0
  94. package/src/LaunchProteinView/components/UserProvidedStructure.tsx +3 -2
  95. package/src/LaunchProteinView/hooks/useAlphaFoldComplexes.test.ts +72 -0
  96. package/src/LaunchProteinView/hooks/useAlphaFoldComplexes.ts +52 -0
  97. package/src/LaunchProteinView/hooks/useAlphaFoldData.ts +6 -0
  98. package/src/LaunchProteinView/hooks/useGeneStructures.test.ts +141 -0
  99. package/src/LaunchProteinView/hooks/useGeneStructures.ts +172 -0
  100. package/src/LaunchProteinView/hooks/usePdbEntrySummaries.ts +20 -0
  101. package/src/LaunchProteinView/hooks/useStructureLaunch.ts +118 -0
  102. package/src/LaunchProteinView/hooks/useTranscriptIsoformSelection.ts +1 -1
  103. package/src/LaunchProteinView/hooks/useUniProtIdLookup.ts +2 -2
  104. package/src/LaunchProteinView/index.ts +1 -1
  105. package/src/LaunchProteinView/resolveGeneLaunch.ts +1 -1
  106. package/src/LaunchProteinView/utils/launchHelpers.test.ts +8 -28
  107. package/src/LaunchProteinView/utils/launchHelpers.ts +5 -16
  108. package/src/LaunchProteinView/utils/launchViewUtils.ts +16 -13
  109. package/src/LaunchProteinView/utils/structureList.test.ts +339 -0
  110. package/src/LaunchProteinView/utils/structureList.ts +350 -0
  111. package/src/LaunchProteinViewExtensionPoint/normalizeLaunch.test.ts +17 -2
  112. package/src/LaunchProteinViewExtensionPoint/normalizeLaunch.ts +8 -4
  113. package/src/LaunchProteinViewExtensionPoint/resolveShortLaunch.ts +1 -1
  114. package/src/ProteinView/components/HeaderStructureRow.tsx +23 -1
  115. package/src/ProteinView/crystallizationAdditives.ts +6 -1
  116. package/src/ProteinView/fileUniProt.test.ts +77 -0
  117. package/src/ProteinView/fileUniProt.ts +32 -0
  118. package/src/ProteinView/measurements.test.ts +4 -1
  119. package/src/ProteinView/molstarExports.ts +1 -0
  120. package/src/ProteinView/proteinViewSpec.ts +4 -1
  121. package/src/ProteinView/structureLoader.test.ts +43 -0
  122. package/src/ProteinView/structureLoader.ts +38 -8
  123. package/src/ProteinView/structureModel.test.ts +67 -0
  124. package/src/ProteinView/structureModel.ts +55 -9
  125. package/src/ProteinView/structureReport.ts +11 -1
  126. package/src/ProteinView/structureSuperposer.test.ts +90 -4
  127. package/src/ProteinView/structureSuperposer.ts +106 -23
  128. package/src/ProteinView/superposeStructures.test.ts +209 -3
  129. package/src/ProteinView/superposeStructures.ts +357 -76
  130. package/src/ProteinView/superpositionOutcome.test.ts +73 -0
  131. package/src/ProteinView/superpositionOutcome.ts +135 -0
  132. package/src/test_data/molstarStructure.ts +9 -4
  133. package/src/version.ts +1 -1
  134. package/dist/LaunchProteinView/components/AlphaFoldDBSearch.js +0 -63
  135. package/dist/LaunchProteinView/components/AlphaFoldDBSearchStatus.js +0 -16
  136. package/dist/LaunchProteinView/components/PdbResultsTable.js +0 -74
  137. package/dist/LaunchProteinView/components/PdbSearch.js +0 -138
  138. package/dist/LaunchProteinView/hooks/useAlphaFoldDBSearch.js +0 -55
  139. package/dist/chunks/HelpDialog-BSSZENSL.js +0 -2
  140. package/dist/chunks/HelpDialog-BSSZENSL.js.map +0 -7
  141. package/dist/chunks/LaunchProteinViewDialog-B4U5V2WV.js +0 -2
  142. package/dist/chunks/LaunchProteinViewDialog-B4U5V2WV.js.map +0 -7
  143. package/dist/chunks/ProteinView-AEOQCJ35.js +0 -3
  144. package/dist/chunks/ProteinView-AEOQCJ35.js.map +0 -7
  145. package/dist/chunks/chunk-5KWZTAUL.js +0 -2
  146. package/dist/chunks/chunk-B23VVDVS.js +0 -2
  147. package/dist/chunks/chunk-B23VVDVS.js.map +0 -7
  148. package/dist/chunks/chunk-CQBWGFIR.js +0 -2
  149. package/dist/chunks/chunk-CQBWGFIR.js.map +0 -7
  150. package/dist/chunks/chunk-DDPGOM6D.js +0 -29
  151. package/dist/chunks/chunk-DDPGOM6D.js.map +0 -7
  152. package/dist/chunks/chunk-ESCHW2TR.js +0 -2
  153. package/dist/chunks/chunk-ESCHW2TR.js.map +0 -7
  154. package/dist/chunks/chunk-MHLZDRGW.js.map +0 -7
  155. package/dist/chunks/clinVarSource-4M3NMFEI.js +0 -2
  156. package/dist/chunks/esm-VXBU2PVU.js +0 -2
  157. package/dist/chunks/isoformRanking-UGZ5OBYY.js +0 -2
  158. package/dist/chunks/launchViewUtils-NAACT5YD.js +0 -2
  159. package/dist/chunks/model-IWX5PO7C.js +0 -2
  160. package/dist/chunks/model-IWX5PO7C.js.map +0 -7
  161. package/dist/chunks/resolveGeneLaunch-NVKHBKVI.js +0 -2
  162. package/src/LaunchProteinView/components/AlphaFoldDBSearch.tsx +0 -138
  163. package/src/LaunchProteinView/components/AlphaFoldDBSearchStatus.tsx +0 -31
  164. package/src/LaunchProteinView/components/PdbResultsTable.tsx +0 -123
  165. package/src/LaunchProteinView/components/PdbSearch.tsx +0 -264
  166. package/src/LaunchProteinView/hooks/useAlphaFoldDBSearch.ts +0 -104
  167. /package/dist/chunks/{AddStructureDialog-VO35RYOW.js.map → AddStructureDialog-RO4QWRSL.js.map} +0 -0
  168. /package/dist/chunks/{ManualAlignmentDialog-VGHPVBF5.js.map → ManualAlignmentDialog-IWVSCVAI.js.map} +0 -0
  169. /package/dist/chunks/{chunk-KIR7LMDB.js.map → chunk-34K4PBXC.js.map} +0 -0
  170. /package/dist/chunks/{chunk-IL53MSBO.js.map → chunk-53Z5PTMG.js.map} +0 -0
  171. /package/dist/chunks/{chunk-AFVOEGWH.js.map → chunk-A4XT2SQ7.js.map} +0 -0
  172. /package/dist/chunks/{chunk-22HNUQZG.js.map → chunk-ENW425OE.js.map} +0 -0
  173. /package/dist/chunks/{chunk-RQCZWHQQ.js.map → chunk-G67ZYVWG.js.map} +0 -0
  174. /package/dist/chunks/{chunk-BIJXO4M2.js.map → chunk-KL7O7H46.js.map} +0 -0
  175. /package/dist/chunks/{chunk-MRFSMEU2.js.map → chunk-Q5QGMPYL.js.map} +0 -0
  176. /package/dist/chunks/{chunk-WGXE3R2M.js.map → chunk-XQ5PSSWY.js.map} +0 -0
  177. /package/dist/chunks/{clinVarSource-4M3NMFEI.js.map → clinVarSource-36GTMEOG.js.map} +0 -0
  178. /package/dist/chunks/{esm-VXBU2PVU.js.map → esm-SMVEMW7D.js.map} +0 -0
  179. /package/dist/chunks/{isoformRanking-UGZ5OBYY.js.map → isoformRanking-UO3MADA5.js.map} +0 -0
  180. /package/dist/chunks/{launchAnnotationView-NENNHQJN.js.map → launchAnnotationView-5RYUC7P4.js.map} +0 -0
  181. /package/dist/chunks/{launchProteinView-HJOBR66M.js.map → launchProteinView-FD36C2FW.js.map} +0 -0
  182. /package/dist/chunks/{launchViewUtils-NAACT5YD.js.map → launchViewUtils-FTOMSLZU.js.map} +0 -0
  183. /package/dist/chunks/{molstarExports-VWIGD7KO.js.map → molstarExports-5EF5VYZ6.js.map} +0 -0
  184. /package/dist/chunks/{resolveGeneLaunch-NVKHBKVI.js.map → resolveGeneLaunch-Q3SSFZGF.js.map} +0 -0
package/README.md CHANGED
@@ -13,9 +13,12 @@ CI re-renders the figure from `main` every hour
13
13
 
14
14
  Right-click a gene and choose **Open AlphaFold structure** for its predicted
15
15
  model in one click, or **Launch protein view** for the dialog that offers every
16
- choice. The plugin looks up the AlphaFold model through UniProt, lists the
17
- experimental PDB entries SIFTS maps to that UniProt entry, and can search
18
- Foldseek for related structures. It aligns each structure to the transcript's
16
+ choice. The dialog looks the gene up in UniProt and lists every structure found
17
+ for it in one list: the AlphaFold model, the experimental PDB entries RCSB maps
18
+ to that UniProt entry with their partner proteins and ligands, and the complexes
19
+ AlphaFold DB predicted, grouped by what each shows. Check several to open them
20
+ superposed in one view. It can also search Foldseek for related structures, or
21
+ open your own file. The plugin aligns each structure to the transcript's
19
22
  translation, so hovering a residue highlights its codon and hovering a codon
20
23
  highlights its residue.
21
24
 
@@ -24,8 +24,7 @@ const FoldseekActionMenu = observer(function FoldseekActionMenu({ hit, session,
24
24
  : undefined;
25
25
  return launch3DProteinView({
26
26
  ...baseParams,
27
- url: hit.structureUrl,
28
- data: pdbData,
27
+ sources: [{ url: hit.structureUrl, data: pdbData }],
29
28
  userProvidedTranscriptSequence,
30
29
  });
31
30
  });
@@ -0,0 +1,209 @@
1
+ import React, { useState } from 'react';
2
+ import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
3
+ import { Checkbox, Chip, DialogActions, FormControlLabel, TextField, Typography, } from '@mui/material';
4
+ import { observer } from 'mobx-react';
5
+ import { isPdbId, stripStopCodon } from 'p2s_mapper';
6
+ import { makeStyles } from 'tss-react/mui';
7
+ import PartialFailureNotice from './PartialFailureNotice';
8
+ import ProteinViewActions from './ProteinViewActions';
9
+ import SequenceMismatchNotice from './SequenceMismatchNotice';
10
+ import StructureList from './StructureList';
11
+ import TranscriptSelector from './TranscriptSelector';
12
+ import UniProtSummaryBar from './UniProtSummaryBar';
13
+ import useDebouncedValue from '../hooks/useDebouncedValue';
14
+ import useGeneStructures from '../hooks/useGeneStructures';
15
+ import useStructureLaunch, { structureSource, } from '../hooks/useStructureLaunch';
16
+ import useUniProtIdLookup from '../hooks/useUniProtIdLookup';
17
+ import { getLaunchMissingReasons } from '../utils/launchHelpers';
18
+ import { getLaunchSideBySide, setLaunchSideBySide } from '../utils/sideBySide';
19
+ import { defaultChecked, matchesFilter, toggleStructure, } from '../utils/structureList';
20
+ import { getTranscriptDisplayName } from '../utils/util';
21
+ const useStyles = makeStyles()(theme => ({
22
+ // Bounded by the window less the dialog's title, tabs and margins, so the
23
+ // list and the UniProt chooser shrink to fit and Launch never scrolls away
24
+ root: {
25
+ width: '80em',
26
+ maxWidth: '100%',
27
+ maxHeight: 'calc(100vh - 180px)',
28
+ display: 'flex',
29
+ flexDirection: 'column',
30
+ },
31
+ toolbar: {
32
+ flex: 'none',
33
+ display: 'flex',
34
+ flexWrap: 'wrap',
35
+ justifyContent: 'space-between',
36
+ alignItems: 'center',
37
+ gap: 10,
38
+ padding: '8px 24px',
39
+ },
40
+ chips: {
41
+ display: 'flex',
42
+ gap: 6,
43
+ },
44
+ footer: {
45
+ flex: 'none',
46
+ display: 'flex',
47
+ flexWrap: 'wrap',
48
+ justifyContent: 'space-between',
49
+ alignItems: 'center',
50
+ gap: 12,
51
+ padding: '8px 24px',
52
+ borderTop: `1px solid ${theme.palette.divider}`,
53
+ },
54
+ summary: {
55
+ display: 'flex',
56
+ flexDirection: 'column',
57
+ gap: 6,
58
+ minWidth: 0,
59
+ flex: '1 1 400px',
60
+ },
61
+ actions: {
62
+ padding: 0,
63
+ flexWrap: 'wrap',
64
+ },
65
+ }));
66
+ const FILTERS = [
67
+ { filter: 'all', label: 'All' },
68
+ { filter: 'experimental', label: 'Experimental' },
69
+ { filter: 'predicted', label: 'Predicted' },
70
+ ];
71
+ function launchStructure(row) {
72
+ return row.kind === 'alphafold'
73
+ ? { key: row.key, kind: 'alphafold', model: row.model }
74
+ : row.kind === 'pdb'
75
+ ? { key: row.key, kind: 'pdb', pdbId: row.entry.pdbId }
76
+ : { key: row.key, kind: 'complex', entity: row.complex.entity };
77
+ }
78
+ function describeLaunch(rows, typedPdbId, finding) {
79
+ const [first, ...rest] = rows;
80
+ return typedPdbId
81
+ ? `PDB ${typedPdbId.toUpperCase()}, typed above, in place of the checked rows`
82
+ : !first
83
+ ? finding
84
+ ? 'Finding structures…'
85
+ : 'Check a structure to open it'
86
+ : rest.length > 0
87
+ ? `${rows.map(r => r.label).join(' + ')}, superposed onto ${first.label}`
88
+ : first.section === 'fragment'
89
+ ? `${first.label}, a short fragment, on its own`
90
+ : `${first.label}: ${first.title}`;
91
+ }
92
+ /**
93
+ * The default tab: every structure found for the gene in one list, checked
94
+ * rows opening together in one view, superposed onto the first.
95
+ */
96
+ const GeneStructures = observer(function GeneStructures({ feature, geneName, preferredTranscriptId, session, view, handleClose, }) {
97
+ const { classes } = useStyles();
98
+ const lookup = useUniProtIdLookup({ feature, view, preferredTranscriptId });
99
+ const { uniprotId } = lookup;
100
+ const structures = useGeneStructures({
101
+ uniprotId,
102
+ geneName,
103
+ feature,
104
+ view,
105
+ preferredTranscriptId,
106
+ });
107
+ const { rows } = structures;
108
+ const [filter, setFilter] = useState('all');
109
+ // a pick belongs to the accession it was made from
110
+ const [picked, setPicked] = useState();
111
+ const userPick = picked && picked.uniprotId === uniprotId ? picked.keys : undefined;
112
+ // nothing is checked until the default is known, or the first structure to
113
+ // arrive would be ranked against and fetched for nothing
114
+ const defaultPending = lookup.isLookupLoading || !structures.defaultSettled;
115
+ const checked = userPick ?? (defaultPending ? [] : defaultChecked(rows));
116
+ const checkedRows = rows.filter(r => checked.includes(r.key));
117
+ const [sideBySide, setSideBySide] = useState(() => getLaunchSideBySide());
118
+ // A typed id reaches entries the accession's listing never offers: a
119
+ // structure of a complex filed under a partner, anything a paper names.
120
+ // Debounced, so the three characters on the way to four are not three
121
+ // fetches.
122
+ const [typedPdbId, setTypedPdbId] = useState('');
123
+ const trimmedTypedPdbId = typedPdbId.trim();
124
+ const debouncedTypedPdbId = useDebouncedValue(trimmedTypedPdbId, 400);
125
+ const typedPdbIdInvalid = trimmedTypedPdbId !== '' && !isPdbId(trimmedTypedPdbId);
126
+ const typedId = isPdbId(debouncedTypedPdbId)
127
+ ? debouncedTypedPdbId.toLowerCase()
128
+ : undefined;
129
+ const launchStructures = typedId
130
+ ? [{ key: `typed:${typedId}`, kind: 'pdb', pdbId: typedId }]
131
+ : checkedRows.map(launchStructure);
132
+ const launch = useStructureLaunch({
133
+ structures: launchStructures,
134
+ uniprotId,
135
+ feature,
136
+ view,
137
+ preferredTranscriptId,
138
+ });
139
+ // RCSB answering that it has no such entry, as opposed to failing to
140
+ // answer, means the launch would open a view on a 404
141
+ const typedIdUnknown = !!typedId &&
142
+ launch.pdbEntryError instanceof Error &&
143
+ 'status' in launch.pdbEntryError &&
144
+ launch.pdbEntryError.status === 404;
145
+ const typedPending = trimmedTypedPdbId !== debouncedTypedPdbId;
146
+ const isLoading = launch.isLoading ||
147
+ typedPending ||
148
+ (!typedId && !userPick && defaultPending);
149
+ const error = launch.error ?? (typedIdUnknown ? launch.pdbEntryError : undefined);
150
+ const missingReasons = getLaunchMissingReasons({
151
+ structureCount: launchStructures.length,
152
+ userSelectedProteinSequence: launch.selectedIsoform,
153
+ selectedTranscript: launch.selectedTranscript,
154
+ });
155
+ const ready = !isLoading && !error && !typedPdbIdInvalid && missingReasons.length === 0;
156
+ const alphaFoldChecked = launchStructures.find(s => s.kind === 'alphafold');
157
+ // Loading or failed, the lookup can still hold the previous query's
158
+ // accession, which would name the view and its 1D entry
159
+ const launchUniprotId = typedId && (lookup.isLookupLoading || lookup.lookupError)
160
+ ? undefined
161
+ : launchStructures[0]?.kind === 'alphafold'
162
+ ? launchStructures[0].model.accession
163
+ : uniprotId;
164
+ const toggle = (row) => {
165
+ setPicked({ uniprotId, keys: toggleStructure(checked, row, rows) });
166
+ };
167
+ return (React.createElement("div", { className: classes.root },
168
+ React.createElement(UniProtSummaryBar, { lookup: lookup }),
169
+ React.createElement("div", { className: classes.toolbar },
170
+ React.createElement("div", { className: classes.chips, role: "group", "aria-label": "Source" }, FILTERS.map(f => (React.createElement(Chip, { key: f.filter, "data-testid": `structure-filter-${f.filter}`, label: `${f.label} ${rows.filter(r => matchesFilter(r, f.filter)).length}`, color: filter === f.filter ? 'primary' : 'default', variant: filter === f.filter ? 'filled' : 'outlined', "aria-pressed": filter === f.filter, onClick: () => {
171
+ setFilter(f.filter);
172
+ } })))),
173
+ React.createElement(TextField, { size: "small", label: "Open by PDB ID", placeholder: "e.g. 1TUP", "data-testid": "pdb-id-input", error: typedPdbIdInvalid || typedIdUnknown, helperText: typedPdbIdInvalid
174
+ ? 'Four characters beginning with a digit'
175
+ : typedIdUnknown
176
+ ? `RCSB has no entry ${debouncedTypedPdbId.toUpperCase()}`
177
+ : undefined, value: typedPdbId, onChange: event => {
178
+ setTypedPdbId(event.target.value);
179
+ }, slotProps: { inputLabel: { shrink: true } }, sx: { width: 200 } })),
180
+ React.createElement(StructureList, { rows: rows.filter(r => matchesFilter(r, filter)), sections: structures.sections, geneName: geneName, checked: typedId ? [] : checked, uniprotLength: structures.uniprotLength, onToggle: row => {
181
+ setTypedPdbId('');
182
+ toggle(row);
183
+ } }),
184
+ React.createElement("div", { className: classes.footer },
185
+ React.createElement("div", { className: classes.summary },
186
+ React.createElement(Typography, { variant: "body2", "data-testid": "launch-summary" },
187
+ React.createElement("strong", null, describeLaunch(checkedRows, typedId, !userPick && defaultPending))),
188
+ error ? React.createElement(ErrorMessage, { error: error }) : null,
189
+ launch.loadingStatuses.map(status => (React.createElement(LoadingEllipses, { key: status, variant: "caption", message: status }))),
190
+ React.createElement(PartialFailureNotice, { message: launch.partialFailure }),
191
+ launch.ranking && launch.selectedTranscript ? (React.createElement(TranscriptSelector, { val: launch.selectedTranscriptId, setVal: launch.setSelectedTranscriptId, structureSequence: launch.structureSequence, feature: feature, isoforms: launch.transcripts, ranking: launch.ranking, size: "small" })) : launch.selectedTranscript && launch.selectedIsoform ? (React.createElement(Typography, { variant: "caption", color: "textSecondary" },
192
+ "Mapped through transcript",
193
+ ' ',
194
+ getTranscriptDisplayName(launch.selectedTranscript),
195
+ " (",
196
+ stripStopCodon(launch.selectedIsoform.seq).length,
197
+ " aa)")) : null,
198
+ launch.sequencesMatch === false ? React.createElement(SequenceMismatchNotice, null) : null,
199
+ !isLoading && !error && missingReasons.length > 0 ? (React.createElement(Typography, { variant: "body2", color: "error" }, missingReasons.join('; '))) : null),
200
+ React.createElement(DialogActions, { className: classes.actions },
201
+ React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { size: "small", checked: sideBySide, "data-testid": "protein-launch-side-by-side", onChange: (_, value) => {
202
+ setSideBySide(value);
203
+ setLaunchSideBySide(value);
204
+ } }), label: React.createElement(Typography, { variant: "body2" }, "Open beside the genome view") }),
205
+ React.createElement(ProteinViewActions, { handleClose: handleClose, ready: ready, uniprotId: launchUniprotId, userSelectedProteinSequence: launch.selectedIsoform, selectedTranscript: launch.selectedTranscript, sources: launchStructures.map(structureSource), confidenceUrl: alphaFoldChecked?.kind === 'alphafold'
206
+ ? alphaFoldChecked.model.confidenceUrl
207
+ : undefined, feature: feature, view: view, session: session, sideBySide: sideBySide })))));
208
+ });
209
+ export default GeneStructures;
@@ -11,18 +11,19 @@ const HelpDialog = observer(function HelpDialog({ handleClose, }) {
11
11
  React.createElement(Typography, { component: "div" },
12
12
  React.createElement("ul", null,
13
13
  React.createElement("li", null,
14
- React.createElement("b", null, "AlphaFoldDB search"),
15
- " resolves the feature to a UniProt accession \u2014 from its own identifiers, or one you type \u2014 and opens AlphaFold's predicted model for it."),
14
+ React.createElement("b", null, "Structures for the gene"),
15
+ " resolves the feature to a UniProt entry, shown in the bar at the top (",
16
+ React.createElement("i", null, "Change"),
17
+ " picks another), and lists every structure found for it: AlphaFold's model, the experimental PDB entries RCSB aligns to the entry, and the complexes AlphaFold DB predicted with other proteins. The list is grouped by what each structure shows: the protein on its own, the protein with another protein, and short fragments. Check several rows to open them in one view, superposed onto the first; a short fragment opens on its own. ",
18
+ React.createElement("i", null, "Open by PDB ID"),
19
+ " opens any entry instead."),
16
20
  React.createElement("li", null,
17
- React.createElement("b", null, "PDB search"),
18
- " lists the experimental structures RCSB aligns to that accession, ranked on coverage and resolution. A crystal is usually one domain, often with binding partners, so the view picks the chain the transcript belongs to once the structure loads."),
19
- React.createElement("li", null,
20
- React.createElement("b", null, "Foldseek search"),
21
+ React.createElement("b", null, "Similar structures (Foldseek)"),
21
22
  " sends the protein sequence to the foldseek.com servers and lists structures similar in shape, including ones with little sequence similarity."),
22
23
  React.createElement("li", null,
23
- React.createElement("b", null, "File or URL"),
24
+ React.createElement("b", null, "Your file or URL"),
24
25
  " opens a structure you already have \u2014 the output of ColabFold or another modelling tool, or any PDB/mmCIF file reachable by URL."))),
25
- React.createElement(Typography, { sx: { mb: 2 } }, "The isoform list marks which transcripts match the structure's residues exactly, and counts identical residues for the rest. You do not need an exact match; the alignment absorbs the differences between the two representations."),
26
+ React.createElement(Typography, { sx: { mb: 2 } }, "The transcript list ranks the isoforms against the first checked structure, marking which match its residues exactly and counting identical residues for the rest. You do not need an exact match; the alignment absorbs the differences between the two representations."),
26
27
  React.createElement(Typography, null,
27
28
  "If a gene will not resolve, or something looks wrong, please open an issue at",
28
29
  ' ',
@@ -1,15 +1,8 @@
1
1
  import React from 'react';
2
- import { Checkbox, Divider, ListItemText, Menu, MenuItem } from '@mui/material';
2
+ import { ListItemText, Menu, MenuItem } from '@mui/material';
3
3
  import { observer } from 'mobx-react';
4
- const LaunchOptionsMenu = observer(function LaunchOptionsMenu({ anchorEl, onClose, options, sideBySide, onSideBySideChange, }) {
5
- return (React.createElement(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: onClose, "data-testid": "protein-launch-options-menu" },
6
- options.map(opt => (React.createElement(MenuItem, { key: opt.key, "data-testid": `protein-launch-option-${opt.key}`, onClick: opt.onClick },
7
- React.createElement(ListItemText, { primary: opt.title, secondary: opt.description })))),
8
- React.createElement(Divider, null),
9
- React.createElement(MenuItem, { "data-testid": "protein-launch-side-by-side", onClick: () => {
10
- onSideBySideChange(!sideBySide);
11
- } },
12
- React.createElement(Checkbox, { checked: sideBySide, size: "small" }),
13
- React.createElement(ListItemText, { primary: "Open side by side", secondary: "Place the protein view right of the genome view instead of below it" }))));
4
+ const LaunchOptionsMenu = observer(function LaunchOptionsMenu({ anchorEl, onClose, options, }) {
5
+ return (React.createElement(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: onClose, "data-testid": "protein-launch-options-menu" }, options.map(opt => (React.createElement(MenuItem, { key: opt.key, "data-testid": `protein-launch-option-${opt.key}`, onClick: opt.onClick },
6
+ React.createElement(ListItemText, { primary: opt.title, secondary: opt.description }))))));
14
7
  });
15
8
  export default LaunchOptionsMenu;
@@ -3,49 +3,30 @@ import { Dialog } from '@jbrowse/core/ui';
3
3
  import { getSession } from '@jbrowse/core/util';
4
4
  import { Tab, Tabs } from '@mui/material';
5
5
  import { observer } from 'mobx-react';
6
- import AlphaFoldDBSearch from './AlphaFoldDBSearch';
7
6
  import FoldseekSearch from './FoldseekSearch';
7
+ import GeneStructures from './GeneStructures';
8
8
  import HelpButton from './HelpButton';
9
- import PdbSearch from './PdbSearch';
10
9
  import TabPanel from './TabPanel';
11
10
  import UserProvidedStructure from './UserProvidedStructure';
12
- import useUniProtIdLookup from '../hooks/useUniProtIdLookup';
13
- import { getLaunchSideBySide, setLaunchSideBySide } from '../utils/sideBySide';
11
+ import { getGeneDisplayName } from '../utils/util';
14
12
  const LaunchProteinViewDialog = observer(function LaunchProteinViewDialog({ handleClose, feature, preferredTranscriptId, model, view, }) {
15
13
  const [choice, setChoice] = useState(0);
16
14
  const session = getSession(model);
17
- // One lookup for the whole dialog: the tabs stay mounted once visited, so a
18
- // lookup per tab meant the same UniProt search ran twice and a row picked on
19
- // one tab left the other pointing at a different gene.
20
- const lookup = useUniProtIdLookup({
21
- feature,
22
- view,
23
- preferredTranscriptId,
24
- });
25
- // Also the dialog's, for the same reason: a tab that has been mounted since
26
- // before the user changed this would otherwise launch with its own stale copy.
27
- const [sideBySide, setSideBySide] = useState(() => getLaunchSideBySide());
28
- const changeSideBySide = (value) => {
29
- setSideBySide(value);
30
- setLaunchSideBySide(value);
31
- };
15
+ const geneName = getGeneDisplayName(feature) || 'this gene';
32
16
  return (React.createElement(Dialog, { "data-testid": "launch-protein-view-dialog", maxWidth: "xl", title: "Launch protein view", titleNode: React.createElement(React.Fragment, null,
33
17
  "Launch protein view ",
34
18
  React.createElement(HelpButton, null)), open: true, onClose: handleClose },
35
19
  React.createElement(Tabs, { value: choice, onChange: (_, val) => {
36
20
  setChoice(val);
37
21
  } },
38
- React.createElement(Tab, { value: 0, label: "AlphaFoldDB search" }),
39
- React.createElement(Tab, { value: 1, label: "PDB search" }),
40
- React.createElement(Tab, { value: 2, label: "Foldseek search" }),
41
- React.createElement(Tab, { value: 3, label: "File or URL" })),
22
+ React.createElement(Tab, { value: 0, label: `Structures for ${geneName}` }),
23
+ React.createElement(Tab, { value: 1, label: "Similar structures (Foldseek)" }),
24
+ React.createElement(Tab, { value: 2, label: "Your file or URL" })),
42
25
  React.createElement(TabPanel, { value: choice, index: 0 },
43
- React.createElement(AlphaFoldDBSearch, { session: session, view: view, feature: feature, preferredTranscriptId: preferredTranscriptId, handleClose: handleClose, lookup: lookup, sideBySide: sideBySide, onSideBySideChange: changeSideBySide })),
26
+ React.createElement(GeneStructures, { session: session, view: view, feature: feature, geneName: geneName, preferredTranscriptId: preferredTranscriptId, handleClose: handleClose })),
44
27
  React.createElement(TabPanel, { value: choice, index: 1 },
45
- React.createElement(PdbSearch, { session: session, view: view, feature: feature, preferredTranscriptId: preferredTranscriptId, handleClose: handleClose, lookup: lookup, sideBySide: sideBySide, onSideBySideChange: changeSideBySide })),
46
- React.createElement(TabPanel, { value: choice, index: 2 },
47
28
  React.createElement(FoldseekSearch, { session: session, view: view, feature: feature, preferredTranscriptId: preferredTranscriptId, handleClose: handleClose })),
48
- React.createElement(TabPanel, { value: choice, index: 3 },
29
+ React.createElement(TabPanel, { value: choice, index: 2 },
49
30
  React.createElement(UserProvidedStructure, { session: session, view: view, feature: feature, preferredTranscriptId: preferredTranscriptId, handleClose: handleClose }))));
50
31
  });
51
32
  export default LaunchProteinViewDialog;
@@ -1,43 +1,28 @@
1
1
  import React, { useState } from 'react';
2
2
  import { ErrorMessage } from '@jbrowse/core/ui';
3
3
  import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
4
- import { Button, ButtonGroup, Typography } from '@mui/material';
4
+ import { Button, ButtonGroup } from '@mui/material';
5
5
  import { observer } from 'mobx-react';
6
6
  import LaunchOptionsMenu from './LaunchOptionsMenu';
7
- import SequenceMismatchNotice from './SequenceMismatchNotice';
8
7
  import { useSafeLaunch } from '../hooks/useSafeLaunch';
9
- import { getLaunchMissingReasons } from '../utils/launchHelpers';
10
8
  import { PROTEIN_LAUNCH_LABELS, getConditionalProteinLaunches, launch3DProteinView, } from '../utils/launchViewUtils';
11
- const ProteinViewActions = observer(function ProteinViewActions({ handleClose, uniprotId, userSelectedProteinSequence, selectedTranscript, url, pdbId, confidenceUrl, feature, view, session, sideBySide, onSideBySideChange, sequencesMatch, isLoading, error, }) {
9
+ const ProteinViewActions = observer(function ProteinViewActions({ handleClose, ready, uniprotId, userSelectedProteinSequence, selectedTranscript, sources, confidenceUrl, feature, view, session, sideBySide, }) {
12
10
  const [menuAnchor, setMenuAnchor] = useState(null);
13
11
  const closeMenu = () => {
14
12
  setMenuAnchor(null);
15
13
  };
16
14
  const { runLaunch, launchError, launching } = useSafeLaunch(handleClose, closeMenu);
17
- const missingReasons = getLaunchMissingReasons({
18
- uniprotId,
19
- userSelectedProteinSequence,
20
- selectedTranscript,
21
- url,
22
- pdbId,
23
- });
24
- // Loading or errored, SWR's keepPreviousData can still hold the previous
25
- // accession's structure, which Launch would open under the new name.
26
- const canLaunch = !isLoading && !error && !launching && missingReasons.length === 0;
27
- // Suppress the derived reasons while loading or while a real upstream error
28
- // is displayed above via <ErrorMessage> — a duplicate hint would mislead.
29
- const showMissingReasons = !isLoading && !error && missingReasons.length > 0;
30
- const launch3DParams = {
15
+ const canLaunch = ready && !launching;
16
+ const handleLaunch3DView = runLaunch(() => launch3DProteinView({
31
17
  session,
32
18
  view,
33
19
  feature,
34
20
  selectedTranscript,
35
21
  uniprotId,
36
- url,
22
+ sources,
37
23
  userProvidedTranscriptSequence: userSelectedProteinSequence?.seq,
38
24
  sideBySide,
39
- };
40
- const handleLaunch3DView = runLaunch(() => launch3DProteinView(launch3DParams));
25
+ }));
41
26
  const { launch1D } = getConditionalProteinLaunches({
42
27
  session,
43
28
  view,
@@ -66,17 +51,15 @@ const ProteinViewActions = observer(function ProteinViewActions({ handleClose, u
66
51
  ];
67
52
  return (React.createElement(React.Fragment, null,
68
53
  launchError ? React.createElement(ErrorMessage, { error: launchError }) : null,
69
- sequencesMatch === false ? React.createElement(SequenceMismatchNotice, null) : null,
70
54
  React.createElement(Button, { variant: "contained", color: "secondary", size: "small", onClick: () => {
71
55
  handleClose();
72
56
  } }, "Cancel"),
73
- showMissingReasons ? (React.createElement("div", { style: { marginRight: 16 } }, missingReasons.map(reason => (React.createElement(Typography, { key: reason, variant: "body2", color: "error" }, reason))))) : null,
74
57
  React.createElement(ButtonGroup, { variant: "contained", color: "primary", size: "small" },
75
58
  React.createElement(Button, { "data-testid": "protein-launch-button", disabled: !canLaunch, onClick: handleLaunch3DView }, "Launch"),
76
59
  React.createElement(Button, { "data-testid": "protein-launch-options-button", disabled: !canLaunch, onClick: event => {
77
60
  setMenuAnchor(event.currentTarget);
78
61
  }, "aria-label": "More launch options" },
79
62
  React.createElement(ArrowDropDownIcon, null))),
80
- React.createElement(LaunchOptionsMenu, { anchorEl: menuAnchor, onClose: closeMenu, options: launchOptions, sideBySide: sideBySide, onSideBySideChange: onSideBySideChange })));
63
+ React.createElement(LaunchOptionsMenu, { anchorEl: menuAnchor, onClose: closeMenu, options: launchOptions })));
81
64
  });
82
65
  export default ProteinViewActions;
@@ -0,0 +1,103 @@
1
+ import React, { useState } from 'react';
2
+ import { LoadingEllipses } from '@jbrowse/core/ui';
3
+ import { Link, Typography } from '@mui/material';
4
+ import { observer } from 'mobx-react';
5
+ import { makeStyles } from 'tss-react/mui';
6
+ import StructureListRow from './StructureListRow';
7
+ import { SECTIONS } from '../utils/structureList';
8
+ const useStyles = makeStyles()(theme => ({
9
+ list: {
10
+ flex: '1 1 auto',
11
+ minHeight: 160,
12
+ overflowY: 'auto',
13
+ borderTop: `1px solid ${theme.palette.divider}`,
14
+ },
15
+ header: {
16
+ position: 'sticky',
17
+ top: 0,
18
+ zIndex: 1,
19
+ display: 'flex',
20
+ justifyContent: 'space-between',
21
+ alignItems: 'baseline',
22
+ gap: 12,
23
+ padding: '8px 24px 4px',
24
+ background: theme.palette.background.paper,
25
+ borderBottom: `1px solid ${theme.palette.divider}`,
26
+ },
27
+ heading: {
28
+ fontSize: '0.8rem',
29
+ fontWeight: 600,
30
+ letterSpacing: '0.06em',
31
+ textTransform: 'uppercase',
32
+ color: theme.palette.text.secondary,
33
+ },
34
+ line: {
35
+ padding: '6px 24px',
36
+ borderBottom: `1px solid ${theme.palette.divider}`,
37
+ },
38
+ }));
39
+ // the protein on its own is mostly the same crystal again, so the section
40
+ // shows its best few and the partners start above the fold
41
+ const ALONE_SHOWN = 5;
42
+ function sectionText(section, geneName) {
43
+ return section === 'alone'
44
+ ? {
45
+ title: `${geneName} on its own`,
46
+ note: 'whole protein or most of it, with any bound nucleotide or drug',
47
+ }
48
+ : section === 'partner'
49
+ ? {
50
+ title: `${geneName} with another protein`,
51
+ note: 'experimental complexes first, then AlphaFold DB predictions',
52
+ }
53
+ : {
54
+ title: 'Short fragments',
55
+ note: 'under half the protein, so each opens on its own',
56
+ };
57
+ }
58
+ const Section = observer(function Section({ section, geneName, rows, status, checked, uniprotLength, onToggle, }) {
59
+ const { classes } = useStyles();
60
+ const [expanded, setExpanded] = useState(false);
61
+ const { title, note } = sectionText(section, geneName);
62
+ const collapsed = section === 'fragment' &&
63
+ !expanded &&
64
+ !rows.some(r => checked.includes(r.key));
65
+ const shown = section === 'alone' && !expanded ? rows.slice(0, ALONE_SHOWN) : rows;
66
+ const hidden = rows.length - shown.length;
67
+ const loading = status?.loading ?? [];
68
+ const notices = status?.notices ?? [];
69
+ return rows.length + loading.length + notices.length === 0 ? null : (React.createElement("div", { "data-testid": `structure-section-${section}` },
70
+ React.createElement("div", { className: classes.header },
71
+ React.createElement("span", { className: classes.heading },
72
+ title,
73
+ " \u00B7 ",
74
+ rows.length),
75
+ React.createElement(Typography, { variant: "caption", color: "textSecondary" }, note)),
76
+ collapsed ? (rows.length > 0 ? (React.createElement("div", { className: classes.line },
77
+ React.createElement(Link, { component: "button", variant: "body2", onClick: () => {
78
+ setExpanded(true);
79
+ } },
80
+ "Show ",
81
+ rows.length,
82
+ " short fragment",
83
+ rows.length === 1 ? '' : 's'))) : null) : (React.createElement(React.Fragment, null,
84
+ shown.map(row => (React.createElement(StructureListRow, { key: row.key, row: row, checked: checked.includes(row.key), uniprotLength: uniprotLength, onToggle: () => {
85
+ onToggle(row);
86
+ } }))),
87
+ hidden > 0 ? (React.createElement("div", { className: classes.line },
88
+ React.createElement(Link, { component: "button", variant: "body2", onClick: () => {
89
+ setExpanded(true);
90
+ } },
91
+ "Show ",
92
+ hidden,
93
+ " more"))) : null)),
94
+ loading.map(message => (React.createElement("div", { className: classes.line, key: message },
95
+ React.createElement(LoadingEllipses, { variant: "body2", message: message })))),
96
+ notices.map(message => (React.createElement(Typography, { key: message, className: classes.line, variant: "body2", color: "textSecondary" }, message)))));
97
+ });
98
+ /** Every structure for the gene, grouped by what it shows of the protein */
99
+ const StructureList = observer(function StructureList({ rows, sections, geneName, checked, uniprotLength, onToggle, }) {
100
+ const { classes } = useStyles();
101
+ return (React.createElement("div", { className: classes.list, "data-testid": "structure-list" }, SECTIONS.map(section => (React.createElement(Section, { key: section, section: section, geneName: geneName, rows: rows.filter(r => r.section === section), status: sections?.[section], checked: checked, uniprotLength: uniprotLength, onToggle: onToggle })))));
102
+ });
103
+ export default StructureList;