jbrowse-plugin-protein3d 1.34.0 → 1.35.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 (73) hide show
  1. package/README.md +10 -11
  2. package/dist/LaunchProteinView/index.js +20 -84
  3. package/dist/chunks/{AddStructureDialog-RO4QWRSL.js → AddStructureDialog-6CWM5DGW.js} +2 -2
  4. package/dist/chunks/{AlphaMissensePathogenicityAdapter-UX7VHUBB.js → AlphaMissensePathogenicityAdapter-JCHDJ5CZ.js} +2 -2
  5. package/dist/chunks/{GenomeTrackColorDialog-EJZ5KTKX.js → GenomeTrackColorDialog-G3RPUVPX.js} +2 -2
  6. package/dist/chunks/{HelpDialog-ZGLXAIOU.js → HelpDialog-MSZSJO5F.js} +2 -2
  7. package/dist/chunks/{LaunchProteinViewDialog-Q6SFXKUZ.js → LaunchProteinViewDialog-PCQQI2FP.js} +3 -3
  8. package/dist/chunks/{LaunchProteinViewDialog-Q6SFXKUZ.js.map → LaunchProteinViewDialog-PCQQI2FP.js.map} +1 -1
  9. package/dist/chunks/{ManualAlignmentDialog-IWVSCVAI.js → ManualAlignmentDialog-E6FEY5OI.js} +2 -2
  10. package/dist/chunks/{ProteinAlignmentHelpDialog-7DFITDVK.js → ProteinAlignmentHelpDialog-OTSZXOOU.js} +2 -2
  11. package/dist/chunks/{ProteinView-IM7GNXMQ.js → ProteinView-RGOD6DEB.js} +3 -3
  12. package/dist/chunks/{chunk-OGP4AJBI.js → chunk-GPMX3YBJ.js} +2 -2
  13. package/dist/chunks/{chunk-VQ5X2CAU.js → chunk-H74KBZLE.js} +2 -2
  14. package/dist/chunks/{chunk-VQ5X2CAU.js.map → chunk-H74KBZLE.js.map} +2 -2
  15. package/dist/chunks/chunk-HNG6EUQA.js +2 -0
  16. package/dist/chunks/{chunk-TZ54BAT7.js.map → chunk-HNG6EUQA.js.map} +4 -4
  17. package/dist/chunks/{chunk-UWFZCUMZ.js → chunk-HSBVTMBK.js} +2 -2
  18. package/dist/chunks/{chunk-A4XT2SQ7.js → chunk-IKXMX5OW.js} +2 -2
  19. package/dist/chunks/{chunk-RPRTWFVS.js → chunk-LQ6SZ6DD.js} +2 -2
  20. package/dist/chunks/chunk-N3ZJYLQ3.js +3 -0
  21. package/dist/chunks/chunk-N3ZJYLQ3.js.map +7 -0
  22. package/dist/chunks/{chunk-EKHBUHHM.js → chunk-OZ6WLM7F.js} +2 -2
  23. package/dist/chunks/{chunk-EKHBUHHM.js.map → chunk-OZ6WLM7F.js.map} +1 -1
  24. package/dist/chunks/{chunk-LVAZFGE6.js → chunk-PUFN5OCK.js} +2 -2
  25. package/dist/chunks/chunk-ZM3UTIKZ.js +2 -0
  26. package/dist/chunks/{chunk-LVHVCXMK.js.map → chunk-ZM3UTIKZ.js.map} +1 -1
  27. package/dist/chunks/{chunk-53Z5PTMG.js → chunk-ZSEHREL2.js} +2 -2
  28. package/dist/chunks/clinVarSource-XMEVWIBY.js +2 -0
  29. package/dist/chunks/launchAnnotationView-BJ7FCRXX.js +2 -0
  30. package/dist/chunks/{launchAnnotationView-CJZQSB7U.js.map → launchAnnotationView-BJ7FCRXX.js.map} +1 -1
  31. package/dist/chunks/launchProteinView-3GPFRKDX.js +2 -0
  32. package/dist/chunks/{launchProteinView-T72MMILS.js.map → launchProteinView-3GPFRKDX.js.map} +1 -1
  33. package/dist/chunks/{model-Z6EC6DXU.js → model-35ZSLFYJ.js} +2 -2
  34. package/dist/chunks/{molstarExports-5EF5VYZ6.js → molstarExports-6RWVF2ZY.js} +2 -2
  35. package/dist/jbrowse-plugin-protein3d.esm.js +1 -1
  36. package/dist/jbrowse-plugin-protein3d.esm.js.map +3 -3
  37. package/dist/version.js +1 -1
  38. package/package.json +1 -1
  39. package/src/LaunchProteinView/index.ts +21 -100
  40. package/src/LaunchProteinView/menuTarget.test.ts +34 -14
  41. package/src/version.ts +1 -1
  42. package/dist/chunks/chunk-7GELEOAH.js +0 -2
  43. package/dist/chunks/chunk-7GELEOAH.js.map +0 -7
  44. package/dist/chunks/chunk-A73LEL2C.js +0 -2
  45. package/dist/chunks/chunk-A73LEL2C.js.map +0 -7
  46. package/dist/chunks/chunk-LVHVCXMK.js +0 -2
  47. package/dist/chunks/chunk-MBUM32YU.js +0 -3
  48. package/dist/chunks/chunk-MBUM32YU.js.map +0 -7
  49. package/dist/chunks/chunk-TZ54BAT7.js +0 -2
  50. package/dist/chunks/clinVarSource-36GTMEOG.js +0 -2
  51. package/dist/chunks/launchAnnotationView-CJZQSB7U.js +0 -2
  52. package/dist/chunks/launchProteinView-T72MMILS.js +0 -2
  53. package/dist/chunks/launchViewUtils-6INIP22K.js +0 -2
  54. package/dist/chunks/launchViewUtils-6INIP22K.js.map +0 -7
  55. package/dist/chunks/resolveGeneLaunch-4AG66E4N.js +0 -2
  56. package/dist/chunks/resolveGeneLaunch-4AG66E4N.js.map +0 -7
  57. package/src/LaunchProteinView/openAlphaFoldStructure.test.ts +0 -94
  58. /package/dist/chunks/{AddStructureDialog-RO4QWRSL.js.map → AddStructureDialog-6CWM5DGW.js.map} +0 -0
  59. /package/dist/chunks/{AlphaMissensePathogenicityAdapter-UX7VHUBB.js.map → AlphaMissensePathogenicityAdapter-JCHDJ5CZ.js.map} +0 -0
  60. /package/dist/chunks/{GenomeTrackColorDialog-EJZ5KTKX.js.map → GenomeTrackColorDialog-G3RPUVPX.js.map} +0 -0
  61. /package/dist/chunks/{HelpDialog-ZGLXAIOU.js.map → HelpDialog-MSZSJO5F.js.map} +0 -0
  62. /package/dist/chunks/{ManualAlignmentDialog-IWVSCVAI.js.map → ManualAlignmentDialog-E6FEY5OI.js.map} +0 -0
  63. /package/dist/chunks/{ProteinAlignmentHelpDialog-7DFITDVK.js.map → ProteinAlignmentHelpDialog-OTSZXOOU.js.map} +0 -0
  64. /package/dist/chunks/{ProteinView-IM7GNXMQ.js.map → ProteinView-RGOD6DEB.js.map} +0 -0
  65. /package/dist/chunks/{chunk-OGP4AJBI.js.map → chunk-GPMX3YBJ.js.map} +0 -0
  66. /package/dist/chunks/{chunk-UWFZCUMZ.js.map → chunk-HSBVTMBK.js.map} +0 -0
  67. /package/dist/chunks/{chunk-A4XT2SQ7.js.map → chunk-IKXMX5OW.js.map} +0 -0
  68. /package/dist/chunks/{chunk-RPRTWFVS.js.map → chunk-LQ6SZ6DD.js.map} +0 -0
  69. /package/dist/chunks/{chunk-LVAZFGE6.js.map → chunk-PUFN5OCK.js.map} +0 -0
  70. /package/dist/chunks/{chunk-53Z5PTMG.js.map → chunk-ZSEHREL2.js.map} +0 -0
  71. /package/dist/chunks/{clinVarSource-36GTMEOG.js.map → clinVarSource-XMEVWIBY.js.map} +0 -0
  72. /package/dist/chunks/{model-Z6EC6DXU.js.map → model-35ZSLFYJ.js.map} +0 -0
  73. /package/dist/chunks/{molstarExports-5EF5VYZ6.js.map → molstarExports-6RWVF2ZY.js.map} +0 -0
package/README.md CHANGED
@@ -11,17 +11,16 @@ selected in magenta on the structure, and its codon is marked on the gene.
11
11
  CI re-renders the figure from `main` every hour
12
12
  ([scripts/readme-figure.mjs](scripts/readme-figure.mjs)).
13
13
 
14
- Right-click a gene and choose **Open AlphaFold structure** for its predicted
15
- model in one click, or **Launch protein view** for the dialog that offers every
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, led by any structures the
20
- site lists for the gene in a dataset of its own. Check several to open them
21
- superposed in one view. It can also search Foldseek for related structures, or
22
- open your own file. The plugin aligns each structure to the transcript's
23
- translation, so hovering a residue highlights its codon and hovering a codon
24
- highlights its residue.
14
+ Right-click a gene and choose **Launch › Protein view...** for the dialog that
15
+ offers every choice. The dialog looks the gene up in UniProt and lists every
16
+ structure found for it in one list: the AlphaFold model, the experimental PDB
17
+ entries RCSB maps to that UniProt entry with their partner proteins and ligands,
18
+ and the complexes AlphaFold DB predicted, grouped by what each shows, led by any
19
+ structures the site lists for the gene in a dataset of its own. Check several to
20
+ open them superposed in one view. It can also search Foldseek for related
21
+ structures, or open your own file. The plugin aligns each structure to the
22
+ transcript's translation, so hovering a residue highlights its codon and
23
+ hovering a codon highlights its residue.
25
24
 
26
25
  ## Try it
27
26
 
@@ -1,9 +1,9 @@
1
1
  import { lazy } from 'react';
2
+ import { pushLaunchViewMenuItem } from '@jbrowse/core/ui';
2
3
  import { getContainingTrack, getContainingView, getSession, isGeneLikeType, } from '@jbrowse/core/util';
3
4
  import AddIcon from '@mui/icons-material/Add';
4
5
  import { isCodingFeature } from './codingFeature';
5
6
  import { isLaunchingGenomeView } from './utils/genomeView';
6
- import { getGeneDisplayName } from './utils/util';
7
7
  // the menu items register at boot; what they open loads on the first click
8
8
  const LaunchProteinViewDialog = lazy(() => import('./components/LaunchProteinViewDialog'));
9
9
  function isDisplay(elt) {
@@ -27,28 +27,6 @@ export function resolveTarget(self) {
27
27
  preferredTranscriptId: subfeature?.featureId,
28
28
  };
29
29
  }
30
- function withCodingFeature(self, target, then) {
31
- const session = getSession(self);
32
- target
33
- .fetchFeature()
34
- .then(feature => {
35
- if (!feature) {
36
- session.notify('Could not load feature for protein view', 'warning');
37
- return undefined;
38
- }
39
- else if (!isCodingFeature(feature)) {
40
- session.notify(`${feature.get('name') ?? feature.get('id') ?? 'This feature'} has no coding sequence, so there is no protein to show`, 'info');
41
- return undefined;
42
- }
43
- else {
44
- return then(feature);
45
- }
46
- })
47
- .catch((e) => {
48
- console.error(e);
49
- session.notifyError(`${e}`, e);
50
- });
51
- }
52
30
  function openDialog(self, target, feature) {
53
31
  const session = getSession(self);
54
32
  const view = getContainingView(self);
@@ -68,62 +46,23 @@ function openDialog(self, target, feature) {
68
46
  ]);
69
47
  }
70
48
  function launchProteinView(self, target) {
71
- withCodingFeature(self, target, feature => {
72
- openDialog(self, target, feature);
73
- });
74
- }
75
- const lookingUp = new Set();
76
- // The dialog's defaults without the dialog. Where they name no single
77
- // structure, a gene two UniProt entries answer to or one AlphaFold has not
78
- // folded, the dialog opens for the choice only a person can make.
79
- function openAlphaFoldStructure(self, target) {
80
49
  const session = getSession(self);
81
- const view = getContainingView(self);
82
- withCodingFeature(self, target, async (feature) => {
83
- const name = getGeneDisplayName(feature);
84
- const genomeView = isLaunchingGenomeView(view) ? view : undefined;
85
- const assemblyName = genomeView?.assemblyNames[0];
86
- if (!genomeView || !assemblyName) {
87
- openDialog(self, target, feature);
88
- return;
89
- }
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;
50
+ target
51
+ .fetchFeature()
52
+ .then(feature => {
53
+ if (!feature) {
54
+ session.notify('Could not load feature for protein view', 'warning');
94
55
  }
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),
104
- feature,
105
- preferredTranscriptId: target.preferredTranscriptId,
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
- sources: [{ url }],
116
- userProvidedTranscriptSequence,
117
- });
118
- }
119
- else {
120
- session.notify(describeMissingStructure(name, launch), launch.lookupError === undefined ? 'info' : 'warning');
121
- openDialog(self, target, feature);
122
- }
56
+ else if (isCodingFeature(feature)) {
57
+ openDialog(self, target, feature);
123
58
  }
124
- finally {
125
- lookingUp.delete(key);
59
+ else {
60
+ session.notify(`${feature.get('name') ?? feature.get('id') ?? 'This feature'} has no coding sequence, so there is no protein to show`, 'info');
126
61
  }
62
+ })
63
+ .catch((e) => {
64
+ console.error(e);
65
+ session.notifyError(`${e}`, e);
127
66
  });
128
67
  }
129
68
  function proteinMenuItems(self) {
@@ -131,14 +70,7 @@ function proteinMenuItems(self) {
131
70
  return target && isGeneLikeType(target.type)
132
71
  ? [
133
72
  {
134
- label: 'Open AlphaFold structure',
135
- icon: AddIcon,
136
- onClick: () => {
137
- openAlphaFoldStructure(self, target);
138
- },
139
- },
140
- {
141
- label: 'Launch protein view',
73
+ label: 'Protein view...',
142
74
  icon: AddIcon,
143
75
  onClick: () => {
144
76
  launchProteinView(self, target);
@@ -151,7 +83,11 @@ function proteinMenuItems(self) {
151
83
  // while reading it would take the host's whole context menu down with it
152
84
  export function withProteinMenuItems(self, hostItems) {
153
85
  try {
154
- return [...hostItems, ...proteinMenuItems(self)];
86
+ const items = [...hostItems];
87
+ for (const item of proteinMenuItems(self)) {
88
+ pushLaunchViewMenuItem(items, item);
89
+ }
90
+ return items;
155
91
  }
156
92
  catch (e) {
157
93
  console.error('Protein view menu items failed', e);
@@ -1,2 +1,2 @@
1
- import{a as b,b as E,c as M,d as L}from"./chunk-UXGREKQA.js";import{E as p,G as m,a as c,c as x,e as A,f as U,g as w,h as F,j as B,k as d,t as a,u as k}from"./chunk-SB4F5EHZ.js";import{b as I}from"./chunk-VQ5X2CAU.js";import{a as D}from"./chunk-BWRMG55K.js";import{r as t,s as e,u as K}from"./chunk-INAB36B4.js";import{eb as f}from"./chunk-JKKI7LFR.js";import"./chunk-XBJKSIMP.js";K();var Q=D(function({model:g,handleClose:h}){let[n,N]=t(),[l,V]=t(""),[u,W]=t(""),[o,q]=t("pdb"),[s,_]=t(""),[v,y]=t(),[G,C]=t(!1),[S,J]=t(!0),O=!!g.primaryStructure?.userProvidedTranscriptSequence,H=async()=>{C(!0),y(void 0);try{let r=o==="pdb"&&l?{pdbId:l}:o==="uniprot"&&u?{uniprotId:u}:o==="url"&&s?{url:s}:o==="file"&&n?{data:await M(n)}:void 0;if(r){let i=g.primaryStructure,z=S&&i?.userProvidedTranscriptSequence?{userProvidedTranscriptSequence:i.userProvidedTranscriptSequence,feature:i.feature,connectedViewId:i.connectedViewId}:{};g.addStructure({...r,...z}),h()}}catch(r){console.error(r),y(r)}finally{C(!1)}},P=l!==""&&!f(l),T=u!==""&&!b(u),j=o==="url"&&s!==""||o==="file"&&n!==void 0||o==="pdb"&&f(l)||o==="uniprot"&&b(u);return e.createElement(A,{open:!0,onClose:h,maxWidth:"sm",fullWidth:!0},e.createElement(F,null,"Add structure"),e.createElement(w,null,v?e.createElement(I,{error:v}):null,e.createElement(m,{variant:"body2",color:"text.secondary",sx:{mb:2}},"Add another structure to superpose on the existing structure(s)."),e.createElement(B,{component:"fieldset",sx:{mb:2}},e.createElement(k,{value:o,onChange:r=>{q(r.target.value)}},e.createElement(d,{value:"pdb",control:e.createElement(a,null),label:"PDB ID"}),e.createElement(d,{value:"uniprot",control:e.createElement(a,null),label:"UniProt ID (AlphaFold)"}),e.createElement(d,{value:"url",control:e.createElement(a,null),label:"URL"}),e.createElement(d,{value:"file",control:e.createElement(a,null),label:"File"}))),o==="pdb"?e.createElement(p,{fullWidth:!0,value:l,onChange:r=>{V(r.target.value.trim().toUpperCase())},label:"PDB ID (e.g. 1CRN)",placeholder:"Enter PDB ID",error:P,helperText:P?"A PDB ID is four characters beginning with a digit":void 0,sx:{mb:2}}):null,o==="uniprot"?e.createElement(p,{fullWidth:!0,value:u,onChange:r=>{W(r.target.value.trim().toUpperCase())},label:"UniProt ID (e.g. P04637)",placeholder:"Enter UniProt ID",error:T,helperText:T?E:"Fetches the AlphaFold predicted structure",sx:{mb:2}}):null,o==="url"?e.createElement(p,{fullWidth:!0,label:"Structure URL",value:s,onChange:r=>{_(r.target.value.trim())},placeholder:"https://files.rcsb.org/download/1CRN.cif",sx:{mb:2}}):null,o==="file"?e.createElement("div",{style:{marginBottom:16}},e.createElement(c,{variant:"outlined",component:"label"},n?n.name:"Choose file",e.createElement("input",{type:"file",hidden:!0,accept:L,onChange:({target:r})=>{let i=r.files?.[0];i&&N(i)}})),n?e.createElement(m,{variant:"body2",sx:{mt:1}},"Selected: ",n.name):null):null,O?e.createElement(d,{control:e.createElement(x,{checked:S,onChange:r=>{J(r.target.checked)}}),label:"Map to the same transcript as the first structure (alignment, hover and click linked to the genome)"}):null,e.createElement(m,{variant:"body2",color:"text.secondary",sx:{mt:1}},"Tip: Structures will be automatically superposed using TM-align. For manual control, use the Mol* controls (\u{1F527} wrench icon).")),e.createElement(U,null,e.createElement(c,{onClick:h},"Cancel"),e.createElement(c,{onClick:()=>{H()},variant:"contained",color:"primary",disabled:!j||G},"Add structure")))}),te=Q;export{te as default};
2
- //# sourceMappingURL=AddStructureDialog-RO4QWRSL.js.map
1
+ import{a as b,b as E,c as M,d as L}from"./chunk-UXGREKQA.js";import{eb as f}from"./chunk-JKKI7LFR.js";import{E as p,G as m,a as c,c as x,e as A,f as U,g as w,h as F,j as B,k as d,t as a,u as k}from"./chunk-SB4F5EHZ.js";import{b as I}from"./chunk-H74KBZLE.js";import{a as D}from"./chunk-BWRMG55K.js";import{r as t,s as e,u as K}from"./chunk-INAB36B4.js";import"./chunk-XBJKSIMP.js";K();var Q=D(function({model:g,handleClose:h}){let[n,N]=t(),[l,V]=t(""),[u,W]=t(""),[o,q]=t("pdb"),[s,_]=t(""),[v,y]=t(),[G,C]=t(!1),[S,J]=t(!0),O=!!g.primaryStructure?.userProvidedTranscriptSequence,H=async()=>{C(!0),y(void 0);try{let r=o==="pdb"&&l?{pdbId:l}:o==="uniprot"&&u?{uniprotId:u}:o==="url"&&s?{url:s}:o==="file"&&n?{data:await M(n)}:void 0;if(r){let i=g.primaryStructure,z=S&&i?.userProvidedTranscriptSequence?{userProvidedTranscriptSequence:i.userProvidedTranscriptSequence,feature:i.feature,connectedViewId:i.connectedViewId}:{};g.addStructure({...r,...z}),h()}}catch(r){console.error(r),y(r)}finally{C(!1)}},P=l!==""&&!f(l),T=u!==""&&!b(u),j=o==="url"&&s!==""||o==="file"&&n!==void 0||o==="pdb"&&f(l)||o==="uniprot"&&b(u);return e.createElement(A,{open:!0,onClose:h,maxWidth:"sm",fullWidth:!0},e.createElement(F,null,"Add structure"),e.createElement(w,null,v?e.createElement(I,{error:v}):null,e.createElement(m,{variant:"body2",color:"text.secondary",sx:{mb:2}},"Add another structure to superpose on the existing structure(s)."),e.createElement(B,{component:"fieldset",sx:{mb:2}},e.createElement(k,{value:o,onChange:r=>{q(r.target.value)}},e.createElement(d,{value:"pdb",control:e.createElement(a,null),label:"PDB ID"}),e.createElement(d,{value:"uniprot",control:e.createElement(a,null),label:"UniProt ID (AlphaFold)"}),e.createElement(d,{value:"url",control:e.createElement(a,null),label:"URL"}),e.createElement(d,{value:"file",control:e.createElement(a,null),label:"File"}))),o==="pdb"?e.createElement(p,{fullWidth:!0,value:l,onChange:r=>{V(r.target.value.trim().toUpperCase())},label:"PDB ID (e.g. 1CRN)",placeholder:"Enter PDB ID",error:P,helperText:P?"A PDB ID is four characters beginning with a digit":void 0,sx:{mb:2}}):null,o==="uniprot"?e.createElement(p,{fullWidth:!0,value:u,onChange:r=>{W(r.target.value.trim().toUpperCase())},label:"UniProt ID (e.g. P04637)",placeholder:"Enter UniProt ID",error:T,helperText:T?E:"Fetches the AlphaFold predicted structure",sx:{mb:2}}):null,o==="url"?e.createElement(p,{fullWidth:!0,label:"Structure URL",value:s,onChange:r=>{_(r.target.value.trim())},placeholder:"https://files.rcsb.org/download/1CRN.cif",sx:{mb:2}}):null,o==="file"?e.createElement("div",{style:{marginBottom:16}},e.createElement(c,{variant:"outlined",component:"label"},n?n.name:"Choose file",e.createElement("input",{type:"file",hidden:!0,accept:L,onChange:({target:r})=>{let i=r.files?.[0];i&&N(i)}})),n?e.createElement(m,{variant:"body2",sx:{mt:1}},"Selected: ",n.name):null):null,O?e.createElement(d,{control:e.createElement(x,{checked:S,onChange:r=>{J(r.target.checked)}}),label:"Map to the same transcript as the first structure (alignment, hover and click linked to the genome)"}):null,e.createElement(m,{variant:"body2",color:"text.secondary",sx:{mt:1}},"Tip: Structures will be automatically superposed using TM-align. For manual control, use the Mol* controls (\u{1F527} wrench icon).")),e.createElement(U,null,e.createElement(c,{onClick:h},"Cancel"),e.createElement(c,{onClick:()=>{H()},variant:"contained",color:"primary",disabled:!j||G},"Add structure")))}),te=Q;export{te as default};
2
+ //# sourceMappingURL=AddStructureDialog-6CWM5DGW.js.map
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-7B4IRZLD.js";import{a as s}from"./chunk-HNO3QZD6.js";import{a as i}from"./chunk-INWFM3CY.js";import{k as o,l as r}from"./chunk-Y5T7GSKP.js";import"./chunk-XBJKSIMP.js";var a=class extends n{async loadFeatures(){return i(await s(this.getConf("location")).readFile("utf8"))}featureData(t,e){return{...t,refName:e,source:t.variant}}async getGlobalStats(t){let e=(await this.loadData()).map(p=>p.score);return{scoreMin:r(e),scoreMax:o(e)}}async getMultiRegionFeatureDensityStats(t){return{featureDensity:0}}async getSources(){return[...new Set((await this.loadData()).map(e=>e.variant))].map(e=>({name:e,__name:e}))}};export{a as default};
2
- //# sourceMappingURL=AlphaMissensePathogenicityAdapter-UX7VHUBB.js.map
1
+ import{a as i}from"./chunk-INWFM3CY.js";import{a as n}from"./chunk-7B4IRZLD.js";import{a as s}from"./chunk-HNO3QZD6.js";import{k as o,l as r}from"./chunk-Y5T7GSKP.js";import"./chunk-XBJKSIMP.js";var a=class extends n{async loadFeatures(){return i(await s(this.getConf("location")).readFile("utf8"))}featureData(t,e){return{...t,refName:e,source:t.variant}}async getGlobalStats(t){let e=(await this.loadData()).map(p=>p.score);return{scoreMin:r(e),scoreMax:o(e)}}async getMultiRegionFeatureDensityStats(t){return{featureDensity:0}}async getSources(){return[...new Set((await this.loadData()).map(e=>e.variant))].map(e=>({name:e,__name:e}))}};export{a as default};
2
+ //# sourceMappingURL=AlphaMissensePathogenicityAdapter-JCHDJ5CZ.js.map
@@ -1,2 +1,2 @@
1
- import{c as C}from"./chunk-F65VCIGM.js";import{E as b,G as V,a as T,e as N,f as B,g as P,h as W,r as g}from"./chunk-SB4F5EHZ.js";import{a as D}from"./chunk-BWRMG55K.js";import{r as f,s as t,u as O}from"./chunk-INAB36B4.js";import{a as _}from"./chunk-NCH7IJII.js";import"./chunk-46MRJY2F.js";import{d as E}from"./chunk-THJLCDMW.js";import{g as A,h as F}from"./chunk-Y5T7GSKP.js";import{d as M}from"./chunk-LGVXT66Y.js";import"./chunk-XBJKSIMP.js";O();var y=["#d7191c","#fdae61","#abd9e9","#2c7bb6"],q={2:["#d7191c","#2c7bb6"],3:["#d7191c","#fdae61","#abd9e9"],4:y};function L(i){let n=q[i];if(n)return n;let r=E({field:"palette",scale:"linear",domainMin:0,domainMax:1,range:y});return Array.from({length:Math.max(i,1)},(s,l)=>r(i>1?l/(i-1):0)??y[0])}function j(i){let n=i.split(/[\s,;]+/).filter(Boolean).map(Number);return n.length>0&&n.every((r,s)=>Number.isFinite(r)&&(s===0||r>n[s-1]))?n:void 0}var z={mean:"Mean of the three bases",max:"Highest of the three bases",min:"Lowest of the three bases",count:"How many features fall on the codon"},Q=new Set(["QuantitativeTrack","VariantTrack","FeatureTrack"]),X=D(function({model:n,handleClose:r}){let s=A(n),l=n.structures.find(e=>e.connectedView)?.connectedView?.assemblyNames[0],p=l?s.assemblyManager.get(l):void 0,v=new Set([...l?[l]:[],...p?[p.name,...p.aliases]:[]]),x=s.tracks.filter(e=>Q.has(e.type)).filter(e=>{let a=_(s,e);return a!==void 0&&(v.size===0||M(a,"assemblyNames").some(d=>v.has(d)))}).map(e=>({trackId:e.trackId,name:F(e,s)})).toSorted((e,a)=>e.name.localeCompare(a.name)),{color:o}=n,[m,G]=f(o.field==="track"?o.trackId??"":""),[u,H]=f(o.field==="track"?o.stat??"mean":"mean"),[c,J]=f(o.field==="track"&&o.scale==="threshold"?"threshold":"linear"),[S,K]=f(o.field==="track"&&o.domain?o.domain.join(", "):""),h=j(S),k=c==="threshold"&&!h;return t.createElement(N,{open:!0,onClose:r,maxWidth:"sm",fullWidth:!0},t.createElement(W,null,"Color by a genome track"),t.createElement(P,null,t.createElement(V,{variant:"body2",color:"text.secondary",sx:{mb:2}},"Each residue takes the track's scores under its codon on the genome view's assembly",l?` (${l})`:"","."," ",u==="count"?"A residue no feature falls on reads 0.":"Residues with no score are grey."),t.createElement(b,{select:!0,fullWidth:!0,label:"Track",value:m,onChange:e=>{G(e.target.value)},helperText:x.length===0?"This session has no quantitative, variant or feature track on the genome view\u2019s assembly":void 0,sx:{mb:2}},x.map(e=>t.createElement(g,{key:e.trackId,value:e.trackId},e.name))),t.createElement(b,{select:!0,fullWidth:!0,label:"Score per residue",value:u,onChange:e=>{let a=C.find(d=>d===e.target.value);a&&H(a)}},C.map(e=>t.createElement(g,{key:e,value:e},z[e]))),t.createElement(b,{select:!0,fullWidth:!0,label:"Scale",value:c,onChange:e=>{J(e.target.value)},sx:{mt:2}},t.createElement(g,{value:"linear"},"Continuous, light to dark"),t.createElement(g,{value:"threshold"},"Thresholds")),c==="threshold"?t.createElement(b,{fullWidth:!0,label:"Cuts, lowest first",placeholder:"-1.328, -0.748",value:S,error:k,helperText:k?"Numbers, each above the last":"Red below the first cut, blue above the last",onChange:e=>{K(e.target.value)},sx:{mt:2}}):null),t.createElement(B,null,t.createElement(T,{onClick:r},"Cancel"),t.createElement(T,{variant:"contained",disabled:!m||k,onClick:()=>{let e=o.field==="track"&&o.trackId===m,a=e&&o.scale==="threshold"==(c==="threshold")?o:void 0,d=e&&u!=="count"?o.scoreField:void 0,w=e?o.filter:void 0,I=a?.range?.length===(h?.length??0)+1;n.setColor(c==="threshold"&&h?{...a,field:"track",trackId:m,stat:u,scoreField:d,filter:w,scale:c,domain:h,range:I?a.range:L(h.length+1),labels:I?a.labels:void 0}:{...a,field:"track",trackId:m,stat:u,scoreField:d,filter:w}),r()}},"Color")))}),re=X;export{re as default};
2
- //# sourceMappingURL=GenomeTrackColorDialog-EJZ5KTKX.js.map
1
+ import{a as _}from"./chunk-NCH7IJII.js";import{c as C}from"./chunk-F65VCIGM.js";import"./chunk-46MRJY2F.js";import{g as A,h as F}from"./chunk-Y5T7GSKP.js";import{d as M}from"./chunk-LGVXT66Y.js";import{d as E}from"./chunk-THJLCDMW.js";import{E as b,G as V,a as T,e as N,f as B,g as P,h as W,r as g}from"./chunk-SB4F5EHZ.js";import{a as D}from"./chunk-BWRMG55K.js";import{r as f,s as t,u as O}from"./chunk-INAB36B4.js";import"./chunk-XBJKSIMP.js";O();var y=["#d7191c","#fdae61","#abd9e9","#2c7bb6"],q={2:["#d7191c","#2c7bb6"],3:["#d7191c","#fdae61","#abd9e9"],4:y};function L(i){let n=q[i];if(n)return n;let r=E({field:"palette",scale:"linear",domainMin:0,domainMax:1,range:y});return Array.from({length:Math.max(i,1)},(s,l)=>r(i>1?l/(i-1):0)??y[0])}function j(i){let n=i.split(/[\s,;]+/).filter(Boolean).map(Number);return n.length>0&&n.every((r,s)=>Number.isFinite(r)&&(s===0||r>n[s-1]))?n:void 0}var z={mean:"Mean of the three bases",max:"Highest of the three bases",min:"Lowest of the three bases",count:"How many features fall on the codon"},Q=new Set(["QuantitativeTrack","VariantTrack","FeatureTrack"]),X=D(function({model:n,handleClose:r}){let s=A(n),l=n.structures.find(e=>e.connectedView)?.connectedView?.assemblyNames[0],p=l?s.assemblyManager.get(l):void 0,v=new Set([...l?[l]:[],...p?[p.name,...p.aliases]:[]]),x=s.tracks.filter(e=>Q.has(e.type)).filter(e=>{let a=_(s,e);return a!==void 0&&(v.size===0||M(a,"assemblyNames").some(d=>v.has(d)))}).map(e=>({trackId:e.trackId,name:F(e,s)})).toSorted((e,a)=>e.name.localeCompare(a.name)),{color:o}=n,[m,G]=f(o.field==="track"?o.trackId??"":""),[u,H]=f(o.field==="track"?o.stat??"mean":"mean"),[c,J]=f(o.field==="track"&&o.scale==="threshold"?"threshold":"linear"),[S,K]=f(o.field==="track"&&o.domain?o.domain.join(", "):""),h=j(S),k=c==="threshold"&&!h;return t.createElement(N,{open:!0,onClose:r,maxWidth:"sm",fullWidth:!0},t.createElement(W,null,"Color by a genome track"),t.createElement(P,null,t.createElement(V,{variant:"body2",color:"text.secondary",sx:{mb:2}},"Each residue takes the track's scores under its codon on the genome view's assembly",l?` (${l})`:"","."," ",u==="count"?"A residue no feature falls on reads 0.":"Residues with no score are grey."),t.createElement(b,{select:!0,fullWidth:!0,label:"Track",value:m,onChange:e=>{G(e.target.value)},helperText:x.length===0?"This session has no quantitative, variant or feature track on the genome view\u2019s assembly":void 0,sx:{mb:2}},x.map(e=>t.createElement(g,{key:e.trackId,value:e.trackId},e.name))),t.createElement(b,{select:!0,fullWidth:!0,label:"Score per residue",value:u,onChange:e=>{let a=C.find(d=>d===e.target.value);a&&H(a)}},C.map(e=>t.createElement(g,{key:e,value:e},z[e]))),t.createElement(b,{select:!0,fullWidth:!0,label:"Scale",value:c,onChange:e=>{J(e.target.value)},sx:{mt:2}},t.createElement(g,{value:"linear"},"Continuous, light to dark"),t.createElement(g,{value:"threshold"},"Thresholds")),c==="threshold"?t.createElement(b,{fullWidth:!0,label:"Cuts, lowest first",placeholder:"-1.328, -0.748",value:S,error:k,helperText:k?"Numbers, each above the last":"Red below the first cut, blue above the last",onChange:e=>{K(e.target.value)},sx:{mt:2}}):null),t.createElement(B,null,t.createElement(T,{onClick:r},"Cancel"),t.createElement(T,{variant:"contained",disabled:!m||k,onClick:()=>{let e=o.field==="track"&&o.trackId===m,a=e&&o.scale==="threshold"==(c==="threshold")?o:void 0,d=e&&u!=="count"?o.scoreField:void 0,w=e?o.filter:void 0,I=a?.range?.length===(h?.length??0)+1;n.setColor(c==="threshold"&&h?{...a,field:"track",trackId:m,stat:u,scoreField:d,filter:w,scale:c,domain:h,range:I?a.range:L(h.length+1),labels:I?a.labels:void 0}:{...a,field:"track",trackId:m,stat:u,scoreField:d,filter:w}),r()}},"Color")))}),re=X;export{re as default};
2
+ //# sourceMappingURL=GenomeTrackColorDialog-G3RPUVPX.js.map
@@ -1,2 +1,2 @@
1
- import{a as h}from"./chunk-RPRTWFVS.js";import{G as t,a as r,f as s,g as a,i as l}from"./chunk-SB4F5EHZ.js";import"./chunk-CFGPSBOM.js";import"./chunk-R3GQXMDR.js";import{a as i}from"./chunk-VQ5X2CAU.js";import{a as n}from"./chunk-BWRMG55K.js";import{s as e,u as p}from"./chunk-INAB36B4.js";import"./chunk-XBJKSIMP.js";p();var u="https://github.com/GMOD/jbrowse-plugin-protein3d/issues",d=n(function({handleClose:o}){return e.createElement(i,{open:!0,maxWidth:"lg",onClose:o,title:"Help"},e.createElement(a,null,e.createElement(t,{sx:{mb:2}},"Each tab finds a structure a different way. All of them end in the same place: the plugin aligns the structure's residues to the protein sequence it translates from the transcript you pick, and that alignment maps genome coordinates onto positions in the 3D view."),e.createElement(t,{component:"div"},e.createElement("ul",null,e.createElement("li",null,e.createElement("b",null,"Structures for the gene")," resolves the feature to a UniProt entry, shown in the bar at the top (",e.createElement("i",null,"Change")," 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. ",e.createElement("i",null,"Open by PDB ID")," opens any entry instead. When this site lists its own structures for the gene, in a dataset its configuration names, they lead the list under the dataset's name and the first is checked, mapped through the transcript it was folded from."),e.createElement("li",null,e.createElement("b",null,"Similar structures (Foldseek)")," sends the protein sequence to the foldseek.com servers and lists structures similar in shape, including ones with little sequence similarity."),e.createElement("li",null,e.createElement("b",null,"Your file or URL")," opens a structure you already have \u2014 the output of ColabFold or another modelling tool, or any PDB/mmCIF file reachable by URL."))),e.createElement(t,{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."),e.createElement(t,null,"If a gene will not resolve, or something looks wrong, please open an issue at"," ",e.createElement(h,{href:u},"github.com/GMOD/jbrowse-plugin-protein3d"),".")),e.createElement(l,null),e.createElement(s,null,e.createElement(r,{onClick:o,color:"primary"},"Close")))}),w=d;export{w as default};
2
- //# sourceMappingURL=HelpDialog-ZGLXAIOU.js.map
1
+ import{a as h}from"./chunk-LQ6SZ6DD.js";import{G as t,a as r,f as s,g as a,i as l}from"./chunk-SB4F5EHZ.js";import"./chunk-CFGPSBOM.js";import{a as i}from"./chunk-H74KBZLE.js";import{a as n}from"./chunk-BWRMG55K.js";import"./chunk-R3GQXMDR.js";import{s as e,u as p}from"./chunk-INAB36B4.js";import"./chunk-XBJKSIMP.js";p();var u="https://github.com/GMOD/jbrowse-plugin-protein3d/issues",d=n(function({handleClose:o}){return e.createElement(i,{open:!0,maxWidth:"lg",onClose:o,title:"Help"},e.createElement(a,null,e.createElement(t,{sx:{mb:2}},"Each tab finds a structure a different way. All of them end in the same place: the plugin aligns the structure's residues to the protein sequence it translates from the transcript you pick, and that alignment maps genome coordinates onto positions in the 3D view."),e.createElement(t,{component:"div"},e.createElement("ul",null,e.createElement("li",null,e.createElement("b",null,"Structures for the gene")," resolves the feature to a UniProt entry, shown in the bar at the top (",e.createElement("i",null,"Change")," 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. ",e.createElement("i",null,"Open by PDB ID")," opens any entry instead. When this site lists its own structures for the gene, in a dataset its configuration names, they lead the list under the dataset's name and the first is checked, mapped through the transcript it was folded from."),e.createElement("li",null,e.createElement("b",null,"Similar structures (Foldseek)")," sends the protein sequence to the foldseek.com servers and lists structures similar in shape, including ones with little sequence similarity."),e.createElement("li",null,e.createElement("b",null,"Your file or URL")," opens a structure you already have \u2014 the output of ColabFold or another modelling tool, or any PDB/mmCIF file reachable by URL."))),e.createElement(t,{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."),e.createElement(t,null,"If a gene will not resolve, or something looks wrong, please open an issue at"," ",e.createElement(h,{href:u},"github.com/GMOD/jbrowse-plugin-protein3d"),".")),e.createElement(l,null),e.createElement(s,null,e.createElement(r,{onClick:o,color:"primary"},"Close")))}),w=d;export{w as default};
2
+ //# sourceMappingURL=HelpDialog-MSZSJO5F.js.map
@@ -1,3 +1,3 @@
1
- import{a as et,b as fr,c as He,d as vr}from"./chunk-UXGREKQA.js";import{b as Tr}from"./chunk-OGP4AJBI.js";import{a as mr}from"./chunk-ENPYAI4H.js";import{a as Y}from"./chunk-RPRTWFVS.js";import{a as yr,c as br,d as Sr,e as kr}from"./chunk-EKHBUHHM.js";import{a as E,b as M,c as Cr}from"./chunk-4F53HQBL.js";import{a as xr}from"./chunk-53Z5PTMG.js";import"./chunk-NY22OOJ6.js";import{A as _e,B as Ge,C as be,D as ur,E as _,F as Ve,G as y,a as A,b as or,c as fe,d as ge,f as he,g as De,j as ye,k as Z,l as nr,m as ir,n as sr,o as ee,p as ar,q as Ue,r as Q,s as ve,t as te,u as qe,v as lr,w as $e,x as Be,y as Oe,z as P}from"./chunk-SB4F5EHZ.js";import{a as D}from"./chunk-3VLTXPRJ.js";import{a as Xt}from"./chunk-CFGPSBOM.js";import{b as Rt}from"./chunk-R3GQXMDR.js";import"./chunk-SEVYWN5I.js";import{a as St,b as H,c as W}from"./chunk-VQ5X2CAU.js";import{a as m}from"./chunk-BWRMG55K.js";import{d as kt,i as xt,n as Pe,p as K,q as Tt,r as h,s as e,u as T}from"./chunk-INAB36B4.js";import"./chunk-HNO3QZD6.js";import{a as dr,b as cr,j as Se,l as ke,m as ze}from"./chunk-MBUM32YU.js";import"./chunk-LVAZFGE6.js";import"./chunk-NCH7IJII.js";import"./chunk-MJZSVHMS.js";import"./chunk-46MRJY2F.js";import{h as pr}from"./chunk-THJLCDMW.js";import"./chunk-TZ54BAT7.js";import{e as pe}from"./chunk-2RFFBSIA.js";import"./chunk-INWFM3CY.js";import"./chunk-A4XT2SQ7.js";import"./chunk-BWZ7PSFU.js";import"./chunk-G67ZYVWG.js";import"./chunk-OU2GWGJP.js";import{a as gr,c as hr}from"./chunk-A73LEL2C.js";import{a as Re,b as Jt}from"./chunk-Q5QGMPYL.js";import{a as Ae,c as er,e as tr,f as me,g as Ee,h as rr,i as Me}from"./chunk-7GELEOAH.js";import{a as Qt}from"./chunk-MYRDDDAG.js";import{g as oe}from"./chunk-Y5T7GSKP.js";import{d as Yt}from"./chunk-6AA7U2KU.js";import{d as bt}from"./chunk-LGVXT66Y.js";import{$ as Lt,Ab as Qe,Bb as Ot,Hb as _t,M as Fe,Mb as Gt,N as It,Nb as Je,O as we,Oa as Pt,Pb as Xe,Qb as Vt,Sb as zt,Tb as Ht,Va as Ft,Vb as jt,Ya as wt,Yb as Wt,Zb as Kt,_a as Nt,_b as Zt,b as vt,bb as Ne,db as At,e as Ct,eb as Ye,fb as Et,ib as Mt,jb as Dt,kb as Ut,ub as qt,xb as $t,yb as Bt}from"./chunk-JKKI7LFR.js";import"./chunk-XBJKSIMP.js";T();T();T();var io=D()({root:{display:"flex",flexDirection:"column",gap:8},header:{display:"flex",alignItems:"center",gap:8},buttons:{display:"flex",gap:4},checkboxGroup:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:0}}),so=m(function({selected:t,onChange:n,disabled:o}){let{classes:i}=io();return e.createElement("div",{className:i.root},e.createElement("div",{className:i.header},e.createElement(y,{variant:"subtitle2"},"Databases to search:"),e.createElement("div",{className:i.buttons},e.createElement(A,{size:"small",onClick:()=>{n(Xe.map(s=>s.id))},disabled:o},"Select all"),e.createElement(A,{size:"small",onClick:()=>{n([])},disabled:o},"Clear"))),e.createElement(nr,{className:i.checkboxGroup},Xe.map(s=>e.createElement(Z,{key:s.id,control:e.createElement(fe,{size:"small",checked:t.includes(s.id),onChange:()=>{t.includes(s.id)?n(t.filter(a=>a!==s.id)):n([...t,s.id])},disabled:o}),label:s.label}))))}),Ir=so;T();T();T();async function Lr(r,t,n){try{await r(),t?.()}catch(o){console.error(o),n?.(o)}}function Pr({structureCount:r,userSelectedProteinSequence:t,selectedTranscript:n}){return[r===0&&"No structure checked",!t?.seq&&"Could not compute protein sequence (feature may be missing CDS subfeatures)",!n&&"No transcript selected"].filter(o=>typeof o=="string")}function xe(r,t){let[n,o]=h(),[i,s]=h(!1);return{runLaunch:u=>()=>{t?.(),i||(s(!0),o(void 0),Lr(u,r,o).then(()=>{s(!1)}))},launchError:n,launching:i}}var ao=m(function({hit:t,session:n,view:o,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:u}){let[l,d]=h(null),p=!!l,c=Mt(t.target),g=F=>{d(F.currentTarget)},v=()=>{d(null)},{runLaunch:k,launchError:C,launching:S}=xe(u,v),f={session:n,view:o,feature:i,selectedTranscript:s,uniprotId:c},b=k(()=>{let F=!t.structureUrl&&Je(t)?Gt(t.tCa,t.tSeq,"A",t.target):void 0;return Se({...f,sources:[{url:t.structureUrl,data:F}],userProvidedTranscriptSequence:a})}),{launch1D:I}=ze({...f,confidenceUrl:Ut(t.target)});return!!t.structureUrl||Je(t)?e.createElement(e.Fragment,null,C?e.createElement(H,{error:C}):null,e.createElement(A,{size:"small",variant:"outlined",disabled:S,onClick:g},"Load"),e.createElement(Ue,{anchorEl:l,open:p,onClose:v},e.createElement(Q,{"data-testid":"protein-launch-option-3d",onClick:b},ke["3d"]),I?e.createElement(Q,{"data-testid":"protein-launch-option-1d",onClick:k(I)},ke["1d"]):null)):e.createElement("span",null,"-")}),Fr=ao;var lo=D()(r=>({root:{display:"flex",flexDirection:"column",gap:16},tableContainer:{maxHeight:400},headerCell:{fontWeight:"bold",backgroundColor:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},noResults:{padding:16,textAlign:"center"}})),uo=100;function co(r){return jt(r).map(t=>({...t,structureUrl:Dt(t.target,t.db)})).toSorted((t,n)=>(t.eval??1/0)-(n.eval??1/0))}var po=m(function({results:t,session:n,view:o,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:u}){let{classes:l}=lo(),d=co(t),p=d.slice(0,uo);return p.length===0?e.createElement(ve,{className:l.noResults},e.createElement(y,null,"No similar structures found")):e.createElement("div",{className:l.root},e.createElement(y,{variant:"subtitle2"},"Found ",d.length," similar structures",d.length>p.length?` (showing top ${p.length})`:""),e.createElement(_e,{component:ve,className:l.tableContainer},e.createElement(Be,{size:"small",stickyHeader:!0},e.createElement(Ge,null,e.createElement(be,null,e.createElement(P,{className:l.headerCell},"Database"),e.createElement(P,{className:l.headerCell},"Target"),e.createElement(P,{className:l.headerCell},"Organism"),e.createElement(P,{className:l.headerCell},e.createElement(Ve,{title:"Foldseek's estimated probability that the hit is a true structural homolog"},e.createElement("span",null,"Prob"))),e.createElement(P,{className:l.headerCell},e.createElement(Ve,{title:"Percentage of aligned residues whose amino acid is identical; structural hits are often low here"},e.createElement("span",null,"Seq. Id."))),e.createElement(P,{className:l.headerCell},"Coverage"),e.createElement(P,{className:l.headerCell},e.createElement(Ve,{title:"Hits of this score expected by chance in a database this size; smaller is stronger"},e.createElement("span",null,"E-value"))),e.createElement(P,{className:l.headerCell},"Actions"))),e.createElement(Oe,null,p.map((c,g)=>e.createElement(be,{key:`${c.db}-${c.target}-${g}`},e.createElement(P,null,c.db),e.createElement(P,null,c.target),e.createElement(P,null,c.taxName??"-"),e.createElement(P,null,c.prob!=null?`${(c.prob*100).toFixed(1)}%`:"-"),e.createElement(P,null,c.seqId!=null?`${c.seqId.toFixed(1)}%`:"-"),e.createElement(P,null,c.alnLength!=null&&c.qLen!=null?`${(c.alnLength/c.qLen*100).toFixed(1)}%`:"-"),e.createElement(P,null,c.eval!=null?c.eval.toExponential(2):"-"),e.createElement(P,null,e.createElement(Fr,{hit:c,session:n,view:o,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:u}))))))))}),wr=po;T();var mo=m(function({message:t}){return t?e.createElement(y,{variant:"body2",color:"warning.main"},t):null}),ne=mo;T();var fo=m(function({val:t,setVal:n,isoforms:o,ranking:i,structureSequence:s,feature:a,disabled:u,size:l}){let d=Ee(a),p=new Map(o.map(f=>[f.id(),f])),c=f=>me(p.get(f))||f,{matches:g,nonMatches:v,noData:k}=i,C=s?Fe(s).length:void 0,S=({id:f,length:b,identical:I},L=I===void 0?"":` (${I}/${C} structure residues identical)`)=>e.createElement(Q,{value:f,key:f},d," - ",c(f)," (",b,"aa)",L);return e.createElement(_,{value:t??"",onChange:f=>{n(f.target.value)},label:"Choose transcript isoform",select:!0,disabled:u,size:l},g.map(f=>S(f," (matches structure residues)")),v.map(f=>S(f)),k.map(f=>e.createElement(Q,{value:f,key:f,disabled:!0},d," - ",c(f)," (no data)")))}),Te=fo;T();function tt(){let[r,t]=h(),[n,o]=h(),[i,s]=h(!1),[a,u]=h(!1),[l,d]=h(),[p,c]=h(""),g=Tt(null);Pe(()=>()=>{g.current?.abort()},[]);let v=()=>{g.current?.abort();let b=new AbortController;return g.current=b,b.signal},k=async b=>{let I=v();u(!0),d(void 0),c("Predicting 3Di structure...");try{let L=await Wt(b,{signal:I});return o(L),L}catch(L){I.aborted||(console.error(L),d(L));return}finally{I.aborted||(u(!1),c(""))}},C=async(b,I,L)=>{let F=v();s(!0),d(void 0),c("Submitting search...");try{let N=await Kt({aaSequence:b,di3Sequence:I,databases:L},{signal:F}),G=await Zt(N.id,{onStatus:c,signal:F});return t(G),G}catch(N){F.aborted||(console.error(N),d(N));return}finally{F.aborted||(s(!1),c(""))}},S=()=>{g.current?.abort(),g.current=null,s(!1),u(!1),c("")},f=()=>{S(),t(void 0),o(void 0),d(void 0)};return{results:r,cleanedAaSequence:n?.aaSequence,di3Sequence:n?.di3Sequence,isLoading:i,isPredicting:a,error:l,statusMessage:p,predictStructure:k,search:C,cancel:S,reset:f}}function Ce({feature:r,view:t}){let{data:n,error:o,isLoading:i}=E(["isoform-sequences",r.id(),t?.assemblyNames?.[0]],async()=>{let a=Ae(r),u=await Yt({transcripts:a,session:oe(t),assemblyName:t?.assemblyNames?.[0]});for(let{feature:d,error:p}of u)p!==void 0&&console.error("[useIsoformProteinSequences] error for",d.id(),p);let l=u.flatMap(d=>d.seq===void 0?[]:[[d.feature.id(),{feature:d.feature,seq:d.seq}]]);return{sequences:Object.fromEntries(l),translated:l.length,total:u.length}},{...M,keepPreviousData:!0}),s=n?n.total-n.translated:0;return{isLoading:i,isoformSequences:n?.sequences,error:o,partialFailure:s>0&&n?`${s} of ${n.total} transcripts have no protein sequence`:void 0}}function rt({view:r,isoforms:t,structureSequences:n}){let o=!!r&&!!n?.length&&t.some(a=>a.seq),{data:i,error:s}=E(o?["isoform-ranking",t,n]:null,()=>Qt({rpcManager:oe(r).rpcManager,name:"ProteinRankIsoforms",args:{isoforms:t,structureSequences:n??[]},inPlace:()=>Re(t,n)}),M);return o?{ranking:i,error:s}:{ranking:Re(t,n)}}T();function go({options:r,isoformSequences:t,ranking:n,preferredTranscriptId:o}){return Me(r,t).some(i=>i.id===o&&i.seq)?o:n&&Jt(n,er(r))}function ot({options:r,isoformSequences:t,ranking:n,preferredTranscriptId:o,resetKey:i}){let[s,a]=h(),[u,l]=h(i);i!==u&&(l(i),a(void 0));let d=t!==void 0?go({options:r,isoformSequences:t,ranking:n,preferredTranscriptId:o}):void 0;return{userSelection:s??d,setUserSelection:a}}function le({feature:r,view:t,structureSequences:n,preferredTranscriptId:o,resetKey:i}){let s=Ae(r),{isoformSequences:a,isLoading:u,error:l,partialFailure:d}=Ce({feature:r,view:t}),{ranking:p,error:c}=rt({view:t,isoforms:Me(s,a),structureSequences:n}),{userSelection:g,setUserSelection:v}=ot({options:s,isoformSequences:a,ranking:p?.ranking,preferredTranscriptId:o,resetKey:i}),k=s.find(S=>S.id()===g),C=g?a?.[g]:void 0;return{transcripts:s,isoformSequences:a,structureSequence:p?.structureSequence,ranking:p?.ranking,isLoading:u,isRanking:!!a&&!p&&!c&&!g,error:l??c,partialFailure:d,selectedTranscriptId:g,setSelectedTranscriptId:v,selectedTranscript:k,selectedIsoform:C}}var ho=D()({dialogContent:{width:"80em",display:"flex",flexDirection:"column",gap:20},sequenceInput:{fontFamily:"monospace"},di3Section:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start"}}),yo=m(function({feature:t,preferredTranscriptId:n,session:o,view:i,handleClose:s}){let{classes:a}=ho(),[u,l]=h(),[d,p]=h(Vt),[c,g]=h(!1),{results:v,cleanedAaSequence:k,di3Sequence:C,isLoading:S,isPredicting:f,error:b,statusMessage:I,predictStructure:L,search:F,cancel:N,reset:G}=tt(),{transcripts:q,isoformSequences:B,ranking:j,isLoading:U,error:$,partialFailure:V,selectedTranscriptId:x,setSelectedTranscriptId:J,selectedTranscript:re,selectedIsoform:z}=le({feature:t,view:i,preferredTranscriptId:n}),X=z?It(z.seq):"",O=u??X,ue=()=>{(C!==void 0||v!==void 0)&&G()},de=ae=>{J(ae),l(void 0),ue()},R=S||f,se=Ht(O),w=zt(O).length>0&&!se&&d.length>0&&!R,ce=async()=>{let ae=k&&C?{aaSequence:k,di3Sequence:C}:await L(O.trim());ae&&await F(ae.aaSequence,ae.di3Sequence,d)},yt=b??$;return e.createElement(e.Fragment,null,e.createElement(De,{className:a.dialogContent},yt&&!U?e.createElement(H,{error:yt}):null,U?e.createElement(W,{variant:"subtitle2",message:"Loading transcript sequences"}):null,e.createElement(ne,{message:V}),B&&j?e.createElement(e.Fragment,null,e.createElement(Te,{val:x,setVal:de,isoforms:q,ranking:j,feature:t,disabled:R}),e.createElement(_,{label:"Protein sequence (amino acids)",multiline:!0,rows:4,value:O,onChange:ae=>{l(ae.target.value),ue()},placeholder:"MKTVRQERLKSIVRILERSKEPVSGAQLAEEL...",disabled:R,error:!!se,helperText:se,slotProps:{input:{className:a.sequenceInput}}})):null,C?e.createElement("div",{className:a.di3Section},e.createElement(ee,{component:"button",type:"button",variant:"body2",onClick:()=>{g(!c)}},c?"Hide 3Di":"Show 3Di"),c?e.createElement(_,{label:"3Di structural alphabet (what the search runs on)",multiline:!0,rows:4,fullWidth:!0,value:C,slotProps:{input:{className:a.sequenceInput,readOnly:!0}}}):null):null,e.createElement(Ir,{selected:d,onChange:p,disabled:R}),I?e.createElement(W,{variant:"subtitle2",message:I}):null,v?e.createElement(wr,{results:v,session:o,view:i,feature:t,selectedTranscript:re,userProvidedTranscriptSequence:z?.seq,onClose:s}):null,e.createElement(y,{variant:"body2",color:"textSecondary"},"Searching sends the protein sequence above to the foldseek.com servers, which predict its 3Di alphabet and run the structure search.")),e.createElement(he,null,e.createElement(A,{variant:"contained",color:"secondary",onClick:()=>{s()}},"Close"),R?e.createElement(A,{variant:"outlined",onClick:()=>{N()}},"Cancel search"):null,v?e.createElement(A,{variant:"outlined",onClick:()=>{G()}},"New search"):null,e.createElement(A,{variant:"contained",color:"primary",disabled:!w,onClick:()=>{ce()}},f?"Predicting 3Di...":S?"Searching...":"Search Foldseek")))}),Nr=yo;T();T();var Ar=Xt(Rt("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");T();var bo=m(function({anchorEl:t,onClose:n,options:o}){return e.createElement(Ue,{anchorEl:t,open:!!t,onClose:n,"data-testid":"protein-launch-options-menu"},o.map(i=>e.createElement(Q,{key:i.key,"data-testid":`protein-launch-option-${i.key}`,onClick:i.onClick},e.createElement(ar,{primary:i.title,secondary:i.description}))))}),Er=bo;var So=m(function({handleClose:t,ready:n,uniprotId:o,userSelectedProteinSequence:i,selectedTranscript:s,sources:a,confidenceUrl:u,feature:l,view:d,session:p,sideBySide:c}){let[g,v]=h(null),k=()=>{v(null)},{runLaunch:C,launchError:S,launching:f}=xe(t,k),b=n&&!f,I=C(()=>Se({session:p,view:d,feature:l,selectedTranscript:s,uniprotId:o,sources:a,userProvidedTranscriptSequence:i?.seq,sideBySide:c})),{launch1D:L}=ze({session:p,view:d,feature:l,selectedTranscript:s,uniprotId:o,confidenceUrl:u}),F=[{key:"3d",title:ke["3d"],description:"View protein structure with genome-to-structure coordinate mapping",onClick:I},...L?[{key:"1d",title:ke["1d"],description:"View protein features and annotations as a linear track",onClick:C(L)}]:[]];return e.createElement(e.Fragment,null,S?e.createElement(H,{error:S}):null,e.createElement(A,{variant:"contained",color:"secondary",size:"small",onClick:()=>{t()}},"Cancel"),e.createElement(or,{variant:"contained",color:"primary",size:"small"},e.createElement(A,{"data-testid":"protein-launch-button",disabled:!b,onClick:I},"Launch"),e.createElement(A,{"data-testid":"protein-launch-options-button",disabled:!b,onClick:N=>{v(N.currentTarget)},"aria-label":"More launch options"},e.createElement(Ar,null))),e.createElement(Er,{anchorEl:g,onClose:k,options:F}))}),Mr=So;T();var ko=m(function(){return e.createElement(y,{variant:"body2",sx:{mr:2}},"Transcript and structure sequences differ, will run"," ",Ct[vt]," alignment")}),je=ko;T();T();var xo="32px 150px minmax(0, 1fr) 170px 150px",Ie=D()(r=>{let t=r.palette.mode==="dark";return{row:{display:"grid",gridTemplateColumns:xo,gap:12,alignItems:"center",padding:"6px 24px 6px 16px",borderBottom:`1px solid ${r.palette.divider}`,cursor:"pointer","&:hover":{backgroundColor:r.palette.action.hover}},checked:{backgroundColor:r.palette.action.selected},idCell:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:3},id:{fontFamily:"monospace",fontWeight:600,whiteSpace:"nowrap"},badge:{fontSize:"0.65rem",fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",padding:"0 6px",borderRadius:3},experimental:{color:t?"#8fd19c":"#2f6b3a",background:t?"#1c2e21":"#e4f1e6"},predicted:{color:t?"#f0c27a":"#7a4c0f",background:t?"#33281a":"#fbf0dc"},what:{display:"flex",flexDirection:"column",gap:4,minWidth:0},tags:{display:"flex",flexWrap:"wrap",gap:4},tag:{fontSize:"0.72rem",padding:"0 6px",border:`1px solid ${r.palette.divider}`,borderRadius:3,color:r.palette.text.secondary},partner:{color:r.palette.text.primary,borderColor:r.palette.primary.main},ligand:{fontFamily:"monospace"},quality:{display:"flex",flexDirection:"column",gap:2,fontVariantNumeric:"tabular-nums"},dot:{display:"inline-block",width:9,height:9,borderRadius:2,marginRight:5},coverage:{display:"flex",flexDirection:"column",gap:3,fontVariantNumeric:"tabular-nums"},bar:{position:"relative",height:8,border:`1px solid ${r.palette.divider}`,borderRadius:2},span:{position:"absolute",top:0,bottom:0,background:r.palette.primary.main,borderRadius:1}}});function To(r){let{domain:t,range:n}=pr.plddt;return n[t.filter(o=>r>o).length]}var Dr=m(function({value:t}){let{classes:n}=Ie();return t===void 0?null:e.createElement(y,{variant:"body2"},e.createElement("span",{className:n.dot,style:{background:To(t)}}),"pLDDT ",t.toFixed(1))}),vo=m(function({row:t}){let{classes:n}=Ie(),o=t.kind==="alphafold"?/model_v(\d+)/.exec(t.model.url)?.[1]:void 0;return e.createElement("div",{className:n.quality},t.kind==="alphafold"?e.createElement(e.Fragment,null,e.createElement(Dr,{value:t.model.meanPlddt}),e.createElement(y,{variant:"caption",color:"textSecondary"},"AlphaFold DB",o?` v${o}`:"")):t.kind==="dataset"?e.createElement(e.Fragment,null,e.createElement(y,{variant:"body2"},t.match.dataset.name),t.match.dataset.description?e.createElement(y,{variant:"caption",color:"textSecondary"},t.match.dataset.description):null):t.kind==="complex"?e.createElement(e.Fragment,null,t.complex.iptm===void 0?null:e.createElement(y,{variant:"body2"},"ipTM ",t.complex.iptm.toFixed(2)),e.createElement(Dr,{value:t.complex.meanPlddt})):e.createElement(e.Fragment,null,e.createElement(y,{variant:"body2"},t.entry.method,t.entry.resolution===void 0?"":` \xB7 ${t.entry.resolution.toFixed(2)} \xC5`),e.createElement(y,{variant:"caption",color:"textSecondary"},t.entry.chains.length===1?"chain":"chains"," ",t.entry.chains.join(", "))))}),Co=m(function({start:t,end:n,length:o}){let{classes:i}=Ie(),s=(n-t+1)/o;return e.createElement("div",{className:i.coverage},e.createElement("div",{className:i.bar,"aria-hidden":!0},e.createElement("span",{className:i.span,style:{left:`${(t-1)/o*100}%`,width:`${Math.min(s,1)*100}%`}})),e.createElement(y,{variant:"caption",color:"textSecondary"},t,"\u2013",n," of ",o," \xB7 ",Math.round(s*100),"%"))}),nt=m(function({tags:t,className:n}){let{classes:o,cx:i}=Ie();return e.createElement(e.Fragment,null,t.map(s=>e.createElement("span",{key:s.label,className:i(o.tag,n),title:s.title},s.label)))}),Io=m(function({row:t,checked:n,uniprotLength:o,onToggle:i}){let{classes:s,cx:a}=Ie(),u=t.partners.length+t.ligands.length+t.notes.length>0;return e.createElement("div",{className:a(s.row,n&&s.checked),"data-testid":`structure-row-${t.key}`,onClick:i},e.createElement(fe,{size:"small",checked:n,onClick:l=>{l.stopPropagation()},onChange:i,slotProps:{input:{"aria-label":`Open ${t.label}`}}}),e.createElement("div",{className:s.idCell},e.createElement(ee,{href:t.href,target:"_blank",rel:"noreferrer",variant:"body2",className:s.id,onClick:l=>{l.stopPropagation()}},t.label),e.createElement("span",{className:a(s.badge,t.predicted?s.predicted:s.experimental)},t.predicted?"Predicted":"Experimental")),e.createElement("div",{className:s.what},e.createElement(y,{variant:"body2"},t.title),u?e.createElement("div",{className:s.tags},e.createElement(nt,{tags:t.partners,className:s.partner}),e.createElement(nt,{tags:t.ligands,className:s.ligand}),e.createElement(nt,{tags:t.notes})):null),e.createElement(vo,{row:t}),t.kind==="dataset"?e.createElement(y,{variant:"caption",color:"textSecondary"},"listed as ",t.match.structure.id):e.createElement(Co,{start:t.start,end:t.end,length:o}))}),Ur=Io;var Lo=.5,Po={ADP:"ADP",AMP:"AMP",ANP:"AMP-PNP",ATP:"ATP",CA:"Ca\xB2\u207A",CD:"Cd\xB2\u207A",CO:"Co\xB2\u207A",CU:"Cu\xB2\u207A",FAD:"FAD",FE:"Fe\xB3\u207A",FE2:"Fe\xB2\u207A",GCP:"GppCp",GDP:"GDP",GNP:"GppNHp",GSP:"GTP\u03B3S",GTP:"GTP",HEM:"heme",MG:"Mg\xB2\u207A",MN:"Mn\xB2\u207A",NAD:"NAD\u207A",NAP:"NADP\u207A",NDP:"NADPH",NI:"Ni\xB2\u207A",SAH:"SAH",SAM:"SAM",ZN:"Zn\xB2\u207A"},Fo=["ATP","ADP","CoA","DNA","EM","Fab","GDP","GTP","HLA","MHC","mRNA","NAD","NADP","NMR","RNA","scFv","TCR","tRNA"];function wo(r,t=[]){let n=new Map([...Fo,...t].map(i=>[i.toUpperCase(),i])),o=r.replace(/[A-Za-z0-9]+(?:[-*:'.][A-Za-z0-9]+)*/g,i=>/\d/.test(i)?i:i.replace(/[A-Za-z]+/g,s=>n.get(s)??s.toLowerCase()));return r===r.toUpperCase()?o.charAt(0).toUpperCase()+o.slice(1):r}function No(r){return r.ligands.filter(t=>!mr.has(t.id)).map(t=>({label:Po[t.id]??t.id,title:t.name}))}function Ao(r,t){let n=Bt(r,t),o=n.filter(a=>a.type==="Protein"),i=n.filter(a=>a.type!=="Protein"),s=[...o.map(a=>({label:a.description??a.entityId,title:a.uniprotIds.join(", ")||void 0})),...[...new Set(i.map(a=>a.type??"Other"))].map(a=>({label:a,title:i.filter(u=>(u.type??"Other")===a).map(u=>u.description??u.entityId).join(`
2
- `)}))];return{tags:s.filter((a,u)=>s.findIndex(l=>l.label===a.label)===u),withProtein:o.length>0}}function Eo({entry:r,summary:t,geneName:n,uniprotId:o}){let i=t?Ao(t,o):void 0,s=t?No(t):[],a=r.pdbId.toUpperCase();return{kind:"pdb",key:`pdb:${r.pdbId}`,entry:r,section:r.coverage<Lo?"fragment":i?.withProtein?"partner":"alone",predicted:!1,label:a,href:Et(r.pdbId),title:t?.title?wo(t.title,[n,...t.ligands.map(u=>u.id)]):`PDB entry ${a}`,partners:i?.tags??[],ligands:s,notes:[],start:r.start,end:r.end}}function $r(r){return`https://alphafold.ebi.ac.uk/entry/${r}`}function Mo({complex:r,geneName:t,uniprotId:n,uniprotLength:o}){let i=n.replace(/-\d+$/,""),s=r.homomer?[]:r.members.filter(a=>a.accession!==i);return{kind:"complex",key:`complex:${r.entity}`,complex:r,section:"partner",predicted:!0,label:r.entity,href:$r(r.entity),title:r.homomer?r.name??`${t} ${r.oligomericState??"homomer"}`:`${t} with ${s.map(a=>a.description??a.gene??a.accession).join(", ")}`,partners:s.map(a=>({label:a.gene??a.accession,title:[a.description,a.accession].filter(Boolean).join(", ")})),ligands:[],notes:[{label:`${r.homomer?"homo":"hetero"}${r.oligomericState??"mer"}`}],start:1,end:o}}function Do({model:r,uniprotId:t,uniprotLength:n}){let o=r.accession!==t.replace(/-\d+$/,"");return{kind:"alphafold",key:"alphafold",model:r,section:"alone",predicted:!0,label:`AF-${r.accession}-F1`,href:$r(r.accession),title:o?`AlphaFold model of isoform ${r.accession}`:"AlphaFold model of the full-length protein",partners:[],ligands:[],notes:[],start:1,end:Math.min(r.sequence?.length??n,n)}}function qr(r){return decodeURIComponent(new URL(r).pathname.split("/").pop()??r)}function Br({match:r,geneName:t,uniprotLength:n}){let{dataset:o,structure:i,transcript:s}=r;return{kind:"dataset",key:`dataset:${o.datasetId}:${i.id}:${qr(i.url)}`,match:r,section:"alone",predicted:!0,label:i.label??qr(i.url),href:i.url,title:s?`${o.name} model of transcript ${me(s)||i.id}`:`${o.name} model of ${t}`,partners:[],ligands:[],notes:[],start:1,end:n}}function Or({geneName:r,uniprotId:t,uniprotLength:n,alphaFold:o,entries:i=[],summaries:s,complexes:a=[]}){return[...o?[Do({model:o,uniprotId:t,uniprotLength:n})]:[],...i.map(u=>Eo({entry:u,summary:s?.get(u.pdbId),geneName:r,uniprotId:t})),...a.map(u=>Mo({complex:u,geneName:r,uniprotId:t,uniprotLength:n}))]}function it(r,t){return t==="all"||t==="predicted"===r.predicted}function _r(r,t,n){let o=new Set(n.filter(i=>i.section==="fragment").map(i=>i.key));return r.includes(t.key)?r.filter(i=>i!==t.key):t.section==="fragment"?[t.key]:[...r.filter(i=>!o.has(i)),t.key]}var st=["alone","partner","fragment"];function at(r){return st.flatMap(t=>r.filter(n=>n.section===t))}function Gr(r){let t=r.find(n=>n.kind==="dataset")??r.find(n=>n.kind==="alphafold")??at(r)[0];return t?[t.key]:[]}var Vr=D()(r=>({list:{flex:"1 1 auto",minHeight:160,overflowY:"auto",borderTop:`1px solid ${r.palette.divider}`},header:{position:"sticky",top:0,zIndex:1,display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12,padding:"8px 24px 4px",background:r.palette.background.paper,borderBottom:`1px solid ${r.palette.divider}`},heading:{fontSize:"0.8rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:r.palette.text.secondary},line:{padding:"6px 24px",borderBottom:`1px solid ${r.palette.divider}`}})),Uo=5;function qo(r,t){return r==="alone"?{title:`${t} on its own`,note:"whole protein or most of it, with any bound nucleotide or drug"}:r==="partner"?{title:`${t} with another protein`,note:"experimental complexes first, then AlphaFold DB predictions"}:{title:"Short fragments",note:"under half the protein, so each opens on its own"}}var $o=m(function({section:t,geneName:n,rows:o,status:i,checked:s,uniprotLength:a,onToggle:u}){let{classes:l}=Vr(),[d,p]=h(!1),{title:c,note:g}=qo(t,n),v=t==="fragment"&&!d&&!o.some(b=>s.includes(b.key)),k=t==="alone"&&!d?o.slice(0,Uo):o,C=o.length-k.length,S=i?.loading??[],f=i?.notices??[];return o.length+S.length+f.length===0?null:e.createElement("div",{"data-testid":`structure-section-${t}`},e.createElement("div",{className:l.header},e.createElement("span",{className:l.heading},c," \xB7 ",o.length),e.createElement(y,{variant:"caption",color:"textSecondary"},g)),v?o.length>0?e.createElement("div",{className:l.line},e.createElement(ee,{component:"button",variant:"body2",onClick:()=>{p(!0)}},"Show ",o.length," short fragment",o.length===1?"":"s")):null:e.createElement(e.Fragment,null,k.map(b=>e.createElement(Ur,{key:b.key,row:b,checked:s.includes(b.key),uniprotLength:a,onToggle:()=>{u(b)}})),C>0?e.createElement("div",{className:l.line},e.createElement(ee,{component:"button",variant:"body2",onClick:()=>{p(!0)}},"Show ",C," more")):null),S.map(b=>e.createElement("div",{className:l.line,key:b},e.createElement(W,{variant:"body2",message:b}))),f.map(b=>e.createElement(y,{key:b,className:l.line,variant:"body2",color:"textSecondary"},b)))}),Bo=m(function({rows:t,sections:n,geneName:o,checked:i,uniprotLength:s,onToggle:a}){let{classes:u}=Vr();return e.createElement("div",{className:u.list,"data-testid":"structure-list"},st.map(l=>e.createElement($o,{key:l,section:l,geneName:o,rows:t.filter(d=>d.section===l),status:n?.[l],checked:i,uniprotLength:s,onToggle:a})))}),zr=Bo;T();T();T();var Oo=m(function({recognizedIds:t,geneName:n,selectedId:o,onSelectedIdChange:i}){let[s,a]=h(!1),u=[{value:"auto",label:"Auto (try all)"},...t.map(l=>({value:l,label:Ot(l)}))];return n&&u.push({value:`gene:${n}`,label:`${n} (gene name)`}),t.length===0&&!n?null:s?e.createElement(ye,{size:"small"},e.createElement(sr,null,"Query UniProt by"),e.createElement(lr,{value:o,label:"Query UniProt by",onChange:l=>{i(l.target.value)}},u.map(l=>e.createElement(Q,{key:l.value,value:l.value},l.label)))):e.createElement(A,{size:"small",variant:"text",onClick:()=>{a(!0)}},"Choose identifier to query...")}),Hr=Oo;T();var _o=["auto","manual","feature"];function Go(r){return _o.some(t=>t===r)}var Vo=m(function({lookupMode:t,onLookupModeChange:n,manualUniprotId:o,onManualUniprotIdChange:i,manualUniprotIdInvalid:s,featureUniprotId:a,hasSearchableIdentifier:u=!0,endContent:l}){return e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap"}},e.createElement(ye,{component:"fieldset"},e.createElement(qe,{row:!0,value:t,onChange:d=>{Go(d.target.value)&&n(d.target.value)}},a&&e.createElement(Z,{value:"feature",control:e.createElement(te,null),label:`From feature (${a})`}),u&&e.createElement(Z,{value:"auto",control:e.createElement(te,null),label:"Look up from the feature's identifiers"}),e.createElement(Z,{value:"manual",control:e.createElement(te,null),label:"Enter manually"}))),l),t==="manual"&&e.createElement("div",null,e.createElement(_,{autoFocus:!0,label:"UniProt ID",variant:"outlined",placeholder:"e.g. P68871",size:"small",value:o,error:s,helperText:s?fr:void 0,onChange:d=>{i(d.target.value)}})),t==="manual"&&!o&&e.createElement(y,{variant:"body2",color:"text.secondary"},"Search"," ",e.createElement(Y,{href:"https://www.uniprot.org/"},"UniProt")," or ",e.createElement(Y,{href:"https://alphafold.ebi.ac.uk/"},"AlphaFoldDB")))}),jr=Vo;var zo=D()({endRow:{display:"flex",flexDirection:"row",gap:12,alignItems:"flex-start"}}),Ho=m(function({lookup:t}){let{classes:n}=zo();return e.createElement(e.Fragment,null,e.createElement(jr,{lookupMode:t.lookupMode,onLookupModeChange:t.setLookupMode,manualUniprotId:t.manualUniprotId,onManualUniprotIdChange:t.setManualUniprotId,manualUniprotIdInvalid:t.manualUniprotIdInvalid,featureUniprotId:t.featureUniprotId,hasSearchableIdentifier:t.hasSearchableIdentifier,endContent:t.showIdentifierSelector?e.createElement("div",{className:n.endRow},e.createElement(Hr,{recognizedIds:t.recognizedIds,geneName:t.geneName,selectedId:t.selectedQueryId,onSelectedIdChange:t.setSelectedQueryId}),e.createElement(_,{size:"small",label:"NCBI taxon id",error:t.taxonIdError,helperText:t.taxonIdError?"Not a taxon id; searching every species":"Narrows the gene-name search to one species",value:t.taxonId,onChange:o=>{t.setTaxonId(o.target.value)},placeholder:"e.g. 9606",slotProps:{inputLabel:{shrink:!0}},sx:{width:180}})):null}),t.showIdentifierSelector?e.createElement(y,{variant:"body2",color:"textSecondary"},t.organismDescription):null,t.nothingToSearch?e.createElement(y,{variant:"body2",color:"textSecondary"},"This feature carries no Ensembl, RefSeq, CCDS or HGNC identifier and no gene name; enter a UniProt accession"):null,e.createElement(ne,{message:t.lookupPartialFailure}))}),Wr=Ho;T();T();var jo=D()(r=>({tableContainer:{maxHeight:200},headerCell:{fontWeight:"bold",backgroundColor:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},selectedRow:{backgroundColor:r.palette.action.selected},clickableRow:{cursor:"pointer","&:hover":{backgroundColor:r.palette.action.hover}},reviewedChip:{backgroundColor:r.palette.success.main,color:r.palette.success.contrastText,fontSize:"0.7rem",height:20},unreviewedChip:{backgroundColor:r.palette.warning.main,color:r.palette.warning.contrastText,fontSize:"0.7rem",height:20}})),Wo=m(function({entries:t,selectedAccession:n,onSelect:o}){let{classes:i,cx:s}=jo();return t.length===0?null:e.createElement("div",null,e.createElement(y,{variant:"body2",sx:{mb:1}},"Found ",t.length," UniProt entries. Select one:"),e.createElement(_e,{component:ve,className:i.tableContainer},e.createElement(Be,{size:"small",stickyHeader:!0,"data-testid":"uniprot-results-table"},e.createElement(Ge,null,e.createElement(be,null,e.createElement(P,{className:i.headerCell,padding:"checkbox"}),e.createElement(P,{className:i.headerCell},"Accession"),e.createElement(P,{className:i.headerCell},"Gene"),e.createElement(P,{className:i.headerCell},"Organism"),e.createElement(P,{className:i.headerCell},"Protein"),e.createElement(P,{className:i.headerCell},"Status"))),e.createElement(Oe,null,t.map(a=>e.createElement(be,{key:a.accession,onClick:()=>{o(a.accession)},className:s(i.clickableRow,n===a.accession&&i.selectedRow)},e.createElement(P,{padding:"checkbox"},e.createElement(te,{checked:n===a.accession,size:"small"})),e.createElement(P,null,e.createElement(Y,{href:Ne(a.accession)},a.accession)),e.createElement(P,null,a.geneName??"-"),e.createElement(P,null,a.organismName??"-"),e.createElement(P,null,a.proteinName?a.proteinName.length>40?`${a.proteinName.slice(0,40)}...`:a.proteinName:"-"),e.createElement(P,null,e.createElement(ge,{label:a.isReviewed?"Reviewed":"Unreviewed",size:"small",className:a.isReviewed?i.reviewedChip:i.unreviewedChip}))))))))}),Kr=Wo;var Zr=m(function(){return e.createElement(Y,{href:"https://www.uniprot.org/"},"UniProt")}),Ko=m(function({lookup:t}){let n=t.uniprotEntries.length>0;return t.isAutoMode?n?e.createElement(e.Fragment,null,e.createElement(y,{variant:"body2",color:"textSecondary"},"Searched UniProt by ",t.searchDescription),e.createElement(Kr,{entries:t.uniprotEntries,selectedAccession:t.selectedTableAccession,onSelect:t.setSelectedUniprotId}),e.createElement(y,{variant:"body2",color:"textSecondary"},"If you don't see the entry you're looking for, try a different identifier above or search ",e.createElement(Zr,null),' directly and use "Enter manually".')):t.isLookupLoading||t.lookupError?null:e.createElement(y,{variant:"body2",color:"textSecondary"},"No UniProt entries found for ",t.searchDescriptionOr,". Try a different identifier above, or search ",e.createElement(Zr,null),' directly and use "Enter manually".'):null}),Yr=Ko;var Zo=D()(r=>({bar:{flex:"none",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px 12px",padding:"8px 24px",background:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},accession:{fontFamily:"monospace",fontWeight:600},reviewed:{backgroundColor:r.palette.success.main,color:r.palette.success.contrastText,fontSize:"0.7rem",height:20},unreviewed:{backgroundColor:r.palette.warning.main,color:r.palette.warning.contrastText,fontSize:"0.7rem",height:20},panel:{flex:"none",maxHeight:"40vh",overflowY:"auto",display:"flex",flexDirection:"column",gap:12,padding:"4px 24px 12px",background:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]}}));function Yo(r){return r.isAutoMode?!r.isLookupLoading&&(!!r.lookupError||!hr(r.uniprotEntries)):!r.uniprotId}var Qo=m(function({lookup:t}){let n=t.uniprotEntries.length;return e.createElement(y,{variant:"body2",color:"textSecondary"},t.lookupMode==="feature"?"named by the feature's own UniProt attribute":t.lookupMode==="manual"?"entered by hand":n===1?`the one UniProt match for ${t.searchDescription}`:`picked from ${n} UniProt matches for ${t.searchDescription}`)}),Jo=m(function({lookup:t}){let{classes:n}=Zo(),[o,i]=h(),s=o??Yo(t),{uniprotId:a}=t,u=t.uniprotEntries.find(l=>l.accession===a);return e.createElement(e.Fragment,null,e.createElement("div",{className:n.bar,"data-testid":"uniprot-summary"},a?e.createElement(e.Fragment,null,e.createElement(y,{variant:"body2"},"Protein"," ",e.createElement(Y,{href:Ne(a),className:n.accession},a),[u?.proteinName,u?.organismName].filter(Boolean).map(l=>` \xB7 ${l}`).join("")),u?e.createElement(ge,{label:u.isReviewed?"Reviewed":"Unreviewed",size:"small",className:u.isReviewed?n.reviewed:n.unreviewed}):null,e.createElement(Qo,{lookup:t})):e.createElement(y,{variant:"body2"},t.isLookupLoading?`Looking up the UniProt entry for ${t.searchDescription}\u2026`:t.lookupMode==="auto"?`No single UniProt entry for ${t.searchDescriptionOr}`:"Enter a UniProt accession to list its structures"),e.createElement(ee,{component:"button",variant:"body2","data-testid":"uniprot-change","aria-expanded":s,onClick:()=>{i(!s)}},s?"Done":"Change")),s?e.createElement("div",{className:n.panel,"data-testid":"uniprot-chooser"},t.lookupError?e.createElement(H,{error:t.lookupError}):null,e.createElement(Wr,{lookup:t}),e.createElement(Yr,{lookup:t})):null)}),Qr=Jo;T();function ie(r,t=300){let[n,o]=h(r);return Pe(()=>{let i=setTimeout(()=>{o(r)},t);return()=>{clearTimeout(i)}},[r,t]),n}T();T();function Xo(r){return[...r].sort((t,n)=>Number(n.homomer)-Number(t.homomer)||(n.iptm??0)-(t.iptm??0))}function Jr(r){let t=r?.replace(/-\d+$/,""),{data:n,error:o,isLoading:i}=E(t?["alphafold-complexes",t]:null,([,u])=>wt(u),M);return{complexes:K(()=>n?Xo(n):void 0,[n]),error:o,isLoading:i}}function Xr(r){let{data:t,error:n,isLoading:o}=E(r?["alphafold-complex-model",r]:null,async([,s])=>{let a=await Nt(s);if(!a)throw new Error(`AlphaFold DB has no files for complex ${s}`);return a},M);return{model:t,error:n,isLoading:o}}T();function lt({uniprotId:r,feature:t,view:n,preferredTranscriptId:o}){let{data:i,isLoading:s,isValidating:a,error:u}=E(r?["alphafold-models",r]:null,([,g])=>Ft(g),{...M,keepPreviousData:!0}),{isoformSequences:l}=Ce({feature:t,view:n}),d=K(()=>r&&(i||u)?gr(r,u?void 0:i,l,o):void 0,[r,i,u,l,o]),p=r?u:void 0,c=r?.replace(/-\d+$/,"");return{isLoading:s,isValidating:a,modelsUnreachable:p,model:d,entryLength:r&&!u?i?.find(g=>g.accession===c)?.sequence.length:void 0,noModel:!!r&&!s&&!u&&i?.length===0}}T();function ut({jbrowse:r,feature:t,preferredTranscriptId:n}){let o=K(()=>yr(r),[r]),i=Sr(r),{data:s,isLoading:a}=E(o.length>0?["structure-datasets",...o.map(d=>`${d.datasetId} ${JSON.stringify(d.mappingLocation)}`)]:null,()=>Promise.allSettled(o.map(d=>kr(d,i))),M),u=K(()=>o.flatMap((d,p)=>{let c=s?.[p];return c?.status==="fulfilled"?br({dataset:d,mapping:c.value,feature:t,preferredTranscriptId:n}):[]}),[o,s,t,n]),l=o.flatMap((d,p)=>{let c=s?.[p];return c?.status==="rejected"?[`${d.name}'s structure list did not load: ${pe(c.reason)}`]:[]});return{matches:u,notices:l,isLoading:a,loadingMessage:`Reading ${o.map(d=>d.name).join(", ")}`}}function dt(r){let{data:t,error:n,isLoading:o}=E(r?["experimental-structures",r]:null,([,i])=>qt(i),M);return{entries:t,error:n,isLoading:o}}function ct(r){let t=r?.map(a=>a.pdbId).join(","),{data:n,error:o,isLoading:i}=E(t?["pdb-entry-summaries",t]:null,([,a])=>$t(a.split(",")),M);return{summaries:n,error:o,isLoading:i}}function Rr(r){return typeof r=="string"}function Ro(r){let t=n=>{let o=r.filter(i=>i.sections.includes(n));return{loading:o.map(i=>i.loading).filter(Rr),notices:o.map(i=>i.notice).filter(Rr)}};return{alone:t("alone"),partner:t("partner"),fragment:t("fragment")}}function pt({jbrowse:r,uniprotId:t,uniprotPending:n,geneName:o,feature:i,view:s,preferredTranscriptId:a}){let u=ut({jbrowse:r,feature:i,preferredTranscriptId:a}),l=lt({uniprotId:t,feature:i,view:s,preferredTranscriptId:a}),d=Jr(t),p=dt(t),c=ct(p.entries),g=p.entries,v=!!g&&(g.length===0||!c.isLoading),k=l.entryLength??l.model?.sequence?.length??Math.max(1,...(g??[]).map(F=>F.end)),C=K(()=>at([...u.matches.map(F=>Br({match:F,geneName:o,uniprotLength:k})),...t?Or({geneName:o,uniprotId:t,uniprotLength:k,alphaFold:l.isLoading?void 0:l.model,entries:v?g:void 0,summaries:c.summaries,complexes:d.complexes}):[]]),[u.matches,t,o,k,l.isLoading,l.model,v,g,c.summaries,d.complexes]),S=["alone","partner","fragment"],f=[{sections:["alone"],loading:u.isLoading&&u.loadingMessage},...u.notices.map(F=>({sections:["alone"],notice:F}))],b=t?[{sections:["alone"],loading:l.isLoading&&"Asking AlphaFold DB for models",notice:l.noModel?`AlphaFold DB has no model for ${t}`:l.modelsUnreachable!==void 0&&`AlphaFold DB's model list did not answer, so its row opens the canonical model file for ${t}, without comparing its sequence to the isoforms`},{sections:S,loading:(p.isLoading||c.isLoading)&&"Listing PDB entries from RCSB",notice:p.error!==void 0&&`RCSB did not list the PDB entries: ${pe(p.error)}`},{sections:["alone","partner"],notice:c.error!==void 0&&`RCSB did not describe the PDB entries, so they are placed by coverage alone: ${pe(c.error)}`},{sections:["alone"],notice:g?.length===0&&`RCSB lists no experimental structure for ${t}`},{sections:["partner"],loading:d.isLoading&&"Asking AlphaFold DB for predicted complexes",notice:d.error!==void 0&&`AlphaFold DB's complex list did not answer: ${pe(d.error)}`}]:[],I=Ro([...f,...b]),L=u.matches.length>0;return{rows:C,uniprotLength:k,sections:I,alphaFold:l,defaultSettled:!u.isLoading&&(L||!n&&!l.isLoading&&(!!l.model||!(p.isLoading||c.isLoading||d.isLoading)))}}T();function mt(r){let{data:t,error:n,isLoading:o,isValidating:i}=E(r?["pdb-entry",r]:null,([,s])=>Pt(s),M);return{entry:t,error:n,isLoading:o,isValidating:i}}async function eo(r){let{PluginContext:t,DefaultPluginSpec:n}=await xr(),o=new t(n());await o.init();try{return await r(o)}finally{o.dispose()}}async function en({file:r,url:t}){let n=r?await He(r):void 0;return eo(async o=>{let i=await Tr({plugin:o,data:n,url:t}),s=await o.builders.structure.createModel(i);return Lt(s)})}function Le({file:r,url:t}){let n=r?["structure-file",r.name,r.size,r.lastModified]:t?["structure-url",t]:null,{data:o,error:i,isLoading:s}=E(n,async()=>{let a=await en({file:r,url:t});if(!a?.length)throw new Error("No protein sequence found in this structure");return a},M);return{error:i,isLoading:s,sequences:o}}function to(r){return r.kind==="alphafold"?{url:r.model.url}:r.kind==="pdb"?{url:At(r.pdbId)}:r.kind==="url"?{url:r.url,uniprotId:r.uniprotId}:{alphaFoldComplexId:r.entity}}function ft({structures:r,uniprotId:t,feature:n,view:o,preferredTranscriptId:i}){let s=r[0],a=mt(s?.kind==="pdb"?s.pdbId:void 0),u=Xr(s?.kind==="complex"?s.entity:void 0),l=Le({url:s?.kind==="url"?s.url:void 0}),d=t?.replace(/-\d+$/,""),p=u.model?.chains,c=p?.find(N=>N.accession===d),g=s?.kind==="alphafold"?s.model.sequence:void 0,v=a.entry?.proteinSequences,k=l.sequences,C=K(()=>s?.kind==="alphafold"?g?[g]:void 0:s?.kind==="pdb"?v:s?.kind==="url"?k:c?[c.sequence]:p?.map(N=>N.sequence),[s?.kind,g,v,k,c,p]),S=le({feature:n,view:o,structureSequences:C,preferredTranscriptId:i,resetKey:s?.key}),f=S.selectedTranscriptId!==i&&(a.isValidating&&!a.error||u.isLoading||l.isLoading),b=[S.isLoading&&"Loading protein sequences from transcript isoforms",S.isRanking&&"Aligning isoforms to the structure",f&&(s?.kind==="pdb"?"Reading the chains of the entry from RCSB":s?.kind==="url"?"Reading residues from the structure":"Asking AlphaFold DB for the complex")].filter(N=>typeof N=="string"),I=b.length>0,L=s?.kind==="alphafold"||s?.kind==="complex"||s?.kind==="url",F=S.selectedIsoform?.seq;return{...S,loadingStatuses:b,isLoading:I,error:I?void 0:S.error??u.error??l.error,pdbEntryError:a.error,sequencesMatch:L&&!u.isLoading&&F&&S.structureSequence?we(F,S.structureSequence):void 0}}T();function tn({attemptedCount:r,failedCount:t}){return t>0&&t<r?`UniProt lookup failed for ${t} of ${r} identifiers`:void 0}function gt({recognizedIds:r=[],geneId:t,geneName:n,organismId:o,selectedQueryId:i="auto",enabled:s=!0}){let a=[],u;i==="auto"?(a=r,u=n):i.startsWith("gene:")?u=i.replace("gene:",""):Qe(i)&&(a=[i]);let l=a.some(g=>Qe(g))||!!u,{data:d,error:p,isLoading:c}=E(s&&l?["uniprotSearch",i,a.join(","),u,t,o]:null,async()=>_t({recognizedIds:a,geneId:t,geneName:u,organismId:o}),{...M,keepPreviousData:!0});return{entries:d?.entries??[],isLoading:c,error:p,partialFailure:d?tn(d):void 0}}function We({selectedQueryId:r,recognizedIds:t,geneName:n,joinWord:o="and"}){return r==="auto"?[t.length>0?`database ID${t.length>1?"s":""} "${t.join('", "')}"`:void 0,n?`gene name "${n}"`:void 0].filter(Boolean).join(` ${o} `):r.startsWith("gene:")?`gene name "${r.replace("gene:","")}"`:`database ID "${r}"`}function rn(r,t){return r===void 0?"Organism: unknown, showing all species; type an NCBI taxon id to narrow":`Organism: ${r} (${t==="user"?"typed above":"from assembly"})`}function ht({feature:r,view:t,preferredTranscriptId:n}){let o=rr(r,n),i=o.uniprotId,s=o.recognizedIds.length>0||!!o.geneName,[a,u]=h(()=>i?"feature":s?"auto":"manual"),[l,d]=h(""),[p,c]=h(""),g=t.assemblyNames[0],v=g?oe(t).assemblyManager.get(g)?.configuration:void 0,k=v?tr(bt(v,["sequence","metadata"])):void 0,C=ie(p.trim(),400),S=Number(C),f=C!==""&&Number.isFinite(S)&&S>0,b=f?S:k,I=C!==""&&!f,[L,F]=h("auto"),[N,G]=h(),q=a==="auto",{entries:B,isLoading:j,error:U,partialFailure:$}=gt({recognizedIds:o.recognizedIds,geneId:o.geneId,geneName:o.geneName,organismId:b,selectedQueryId:L,enabled:q}),V=ie(l,400),J=j||a==="manual"&&l!==V,re=B.some(O=>O.accession===N)?N:void 0,z=B[0]?.accession,X=a==="feature"?i:q?re??z:et(V)?V:void 0;return{lookupMode:a,setLookupMode:u,manualUniprotId:l,setManualUniprotId:O=>{d(O.trim().toUpperCase())},manualUniprotIdInvalid:l!==""&&!et(l),taxonId:p,setTaxonId:c,taxonIdError:I,organismDescription:rn(b,f?"user":"assembly"),selectedQueryId:L,setSelectedQueryId:F,setSelectedUniprotId:G,selectedTableAccession:re??z,uniprotEntries:B,isLookupLoading:J,lookupError:U,lookupPartialFailure:$,uniprotId:X,featureUniprotId:i,recognizedIds:o.recognizedIds,geneName:o.geneName,isAutoMode:q,hasSearchableIdentifier:s,nothingToSearch:!s&&!i,showIdentifierSelector:q&&s,searchDescription:We({selectedQueryId:L,recognizedIds:o.recognizedIds,geneName:o.geneName}),searchDescriptionOr:We({selectedQueryId:L,recognizedIds:o.recognizedIds,geneName:o.geneName,joinWord:"or"})}}var on=D()(r=>({root:{width:"80em",maxWidth:"100%",maxHeight:"calc(100vh - 180px)",display:"flex",flexDirection:"column"},toolbar:{flex:"none",display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",gap:10,padding:"8px 24px"},chips:{display:"flex",gap:6},footer:{flex:"none",display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",gap:12,padding:"8px 24px",borderTop:`1px solid ${r.palette.divider}`},summary:{display:"flex",flexDirection:"column",gap:6,minWidth:0,flex:"1 1 400px"},actions:{padding:0,flexWrap:"wrap"}})),nn=[{filter:"all",label:"All"},{filter:"experimental",label:"Experimental"},{filter:"predicted",label:"Predicted"}];function sn(r){return r.kind==="alphafold"?{key:r.key,kind:"alphafold",model:r.model}:r.kind==="pdb"?{key:r.key,kind:"pdb",pdbId:r.entry.pdbId}:r.kind==="dataset"?{key:r.key,kind:"url",url:r.match.structure.url,uniprotId:r.match.structure.uniprotId}:{key:r.key,kind:"complex",entity:r.complex.entity}}function an(r,t,n){let[o,...i]=r;return t?`PDB ${t.toUpperCase()}, typed above, in place of the checked rows`:o?i.length>0?`${r.map(s=>s.label).join(" + ")}, superposed onto ${o.label}`:o.section==="fragment"?`${o.label}, a short fragment, on its own`:`${o.label}: ${o.title}`:n?"Finding structures\u2026":"Check a structure to open it"}var ln=m(function({feature:t,geneName:n,preferredTranscriptId:o,session:i,view:s,handleClose:a}){let{classes:u}=on(),l=ht({feature:t,view:s,preferredTranscriptId:o}),{uniprotId:d}=l,p=pt({jbrowse:i.jbrowse,uniprotId:d,uniprotPending:l.isLookupLoading,geneName:n,feature:t,view:s,preferredTranscriptId:o}),{rows:c}=p,[g,v]=h("all"),[k,C]=h(),S=k&&k.uniprotId===d?k.keys:void 0,f=!p.defaultSettled,b=S??(f?[]:Gr(c)),I=c.filter(w=>b.includes(w.key)),[L,F]=h(()=>dr()),[N,G]=h(""),q=N.trim(),B=ie(q,400),j=q!==""&&!Ye(q),U=Ye(B)?B.toLowerCase():void 0,$=U?[{key:`typed:${U}`,kind:"pdb",pdbId:U}]:I.map(sn),V=U?void 0:I[0],x=ft({structures:$,uniprotId:d,feature:t,view:s,preferredTranscriptId:(V?.kind==="dataset"?V.match.transcript?.id():void 0)??o}),J=!!U&&x.pdbEntryError instanceof Error&&"status"in x.pdbEntryError&&x.pdbEntryError.status===404,re=q!==B,z=x.isLoading||re||!U&&!S&&f,X=x.error??(J?x.pdbEntryError:void 0),O=Pr({structureCount:$.length,userSelectedProteinSequence:x.selectedIsoform,selectedTranscript:x.selectedTranscript}),ue=!z&&!X&&!j&&O.length===0,de=$.find(w=>w.kind==="alphafold"),R=U&&(l.isLookupLoading||l.lookupError)?void 0:$[0]?.kind==="alphafold"?$[0].model.accession:$[0]?.kind==="url"?$[0].uniprotId??d:d,se=w=>{C({uniprotId:d,keys:_r(b,w,c)})};return e.createElement("div",{className:u.root},e.createElement(Qr,{lookup:l}),e.createElement("div",{className:u.toolbar},e.createElement("div",{className:u.chips,role:"group","aria-label":"Source"},nn.map(w=>e.createElement(ge,{key:w.filter,"data-testid":`structure-filter-${w.filter}`,label:`${w.label} ${c.filter(ce=>it(ce,w.filter)).length}`,color:g===w.filter?"primary":"default",variant:g===w.filter?"filled":"outlined","aria-pressed":g===w.filter,onClick:()=>{v(w.filter)}}))),e.createElement(_,{size:"small",label:"Open by PDB ID",placeholder:"e.g. 1TUP","data-testid":"pdb-id-input",error:j||J,helperText:j?"Four characters beginning with a digit":J?`RCSB has no entry ${B.toUpperCase()}`:void 0,value:N,onChange:w=>{G(w.target.value)},slotProps:{inputLabel:{shrink:!0}},sx:{width:200}})),e.createElement(zr,{rows:c.filter(w=>it(w,g)),sections:p.sections,geneName:n,checked:U?[]:b,uniprotLength:p.uniprotLength,onToggle:w=>{G(""),se(w)}}),e.createElement("div",{className:u.footer},e.createElement("div",{className:u.summary},e.createElement(y,{variant:"body2","data-testid":"launch-summary"},e.createElement("strong",null,an(I,U,!S&&f))),X?e.createElement(H,{error:X}):null,x.loadingStatuses.map(w=>e.createElement(W,{key:w,variant:"caption",message:w})),e.createElement(ne,{message:x.partialFailure}),x.ranking&&x.selectedTranscript?e.createElement(Te,{val:x.selectedTranscriptId,setVal:x.setSelectedTranscriptId,structureSequence:x.structureSequence,feature:t,isoforms:x.transcripts,ranking:x.ranking,size:"small"}):x.selectedTranscript&&x.selectedIsoform?e.createElement(y,{variant:"caption",color:"textSecondary"},"Mapped through transcript"," ",me(x.selectedTranscript)," (",Fe(x.selectedIsoform.seq).length," aa)"):null,x.sequencesMatch===!1?e.createElement(je,null):null,!z&&!X&&O.length>0?e.createElement(y,{variant:"body2",color:"error"},O.join("; ")):null),e.createElement(he,{className:u.actions},e.createElement(Z,{control:e.createElement(fe,{size:"small",checked:L,"data-testid":"protein-launch-side-by-side",onChange:(w,ce)=>{F(ce),cr(ce)}}),label:e.createElement(y,{variant:"body2"},"Open beside the genome view")}),e.createElement(Mr,{handleClose:a,ready:ue,uniprotId:R,userSelectedProteinSequence:x.selectedIsoform,selectedTranscript:x.selectedTranscript,sources:$.map(to),confidenceUrl:de?.kind==="alphafold"?de.model.confidenceUrl:void 0,feature:t,view:s,session:i,sideBySide:L}))))}),ro=ln;T();var un=xt(()=>import("./HelpDialog-ZGLXAIOU.js")),dn=m(function(){let[t,n]=h(!1);return e.createElement(e.Fragment,null,e.createElement(ir,{onClick:()=>{n(!0)}},e.createElement(Cr,null)),t?e.createElement(kt,{fallback:null},e.createElement(un,{handleClose:()=>{n(!1)}})):null)}),Ke=dn;T();var cn=m(function({children:t,value:n,index:o,...i}){let s=n===o,[a,u]=h(s);return s&&!a&&u(!0),e.createElement("div",{role:"tabpanel",hidden:!s,...i},a?t:null)}),Ze=cn;T();T();var pn=m(function({choice:t,setChoice:n,structureURL:o,setStructureURL:i,file:s,setFile:a}){return e.createElement("div",{style:{display:"flex",margin:30}},e.createElement(y,null,"Open your structure file ",e.createElement(Ke,null)),e.createElement(ye,{component:"fieldset"},e.createElement(qe,{value:t,onChange:u=>{n(u.target.value)}},e.createElement(Z,{value:"file",control:e.createElement(te,null),label:"File"}),e.createElement(Z,{value:"url",control:e.createElement(te,null),label:"URL"}))),t==="url"?e.createElement("div",null,e.createElement(y,null,"Open a PDB/mmCIF/etc. file from remote URL"),e.createElement(_,{label:"URL",value:o,onChange:u=>{i(u.target.value)}})):e.createElement("div",{style:{paddingTop:20}},e.createElement(y,null,"Open a PDB/mmCIF/etc. file from your local drive"),e.createElement(A,{variant:"outlined",component:"label"},"Choose file",e.createElement("input",{type:"file",hidden:!0,accept:vr,onChange:({target:u})=>{let l=u.files?.[0];l&&a(l),u.value=""}})),s?e.createElement(y,{variant:"body2"},s.name):null))}),oo=pn;var mn=D()(r=>({dialogContent:{marginTop:r.spacing(6),width:"80em"}})),fn=m(function(){return e.createElement("div",{style:{marginBottom:20}},"Manually supply a protein structure (PDB, mmCIF, etc) for a given transcript. You can open the file from the result of running, for example,"," ",e.createElement(Y,{href:"https://github.com/sokrypton/ColabFold"},"ColabFold"),". This plugin will align the protein sequence calculated from the genome to the protein sequence embedded in the structure file which allows for slight differences in these two representations.")}),gn=m(function({feature:t,preferredTranscriptId:n,session:o,view:i,handleClose:s}){let{classes:a}=mn(),[u,l]=h(),[d,p]=h("file"),[c,g]=h(""),{runLaunch:v,launchError:k,launching:C}=xe(s),S=d==="file"?u:void 0,f=d==="file"?"":c,b=ie(f,600),{sequences:I,isLoading:L,error:F}=Le({file:S,url:b}),{transcripts:N,isoformSequences:G,structureSequence:q,ranking:B,isRanking:j,selectedTranscriptId:U,setSelectedTranscriptId:$,selectedTranscript:V,selectedIsoform:x,error:J,partialFailure:re}=le({feature:t,view:i,structureSequences:I,preferredTranscriptId:n}),z=k??J??F,ue=!!(f||S)&&!!x&&!!V&&!((L||f!==b||j)&&U!==n)&&!(!!F&&f===b)&&!C,de=!!x?.seq&&!!q&&!we(x.seq,q),R=v(async()=>{if(x&&V){let se=S?await He(S):void 0;await Se({session:o,view:i,feature:t,selectedTranscript:V,sources:[{url:f||void 0,data:se}],userProvidedTranscriptSequence:x.seq})}});return e.createElement(e.Fragment,null,e.createElement(De,{className:a.dialogContent},z?e.createElement(H,{error:z}):null,e.createElement(fn,null),e.createElement(oo,{choice:d,setChoice:p,structureURL:c,setStructureURL:g,file:u,setFile:l}),e.createElement("div",{style:{margin:20}},L?e.createElement(W,{variant:"subtitle2",message:"Reading residues from the structure"}):null,e.createElement(ne,{message:re}),j?e.createElement(W,{variant:"subtitle2",message:"Aligning isoforms to the structure"}):null,G?B?e.createElement(Te,{val:U,setVal:$,structureSequence:q,isoforms:N,feature:t,ranking:B}):null:e.createElement(W,{title:"Loading protein sequences",variant:"h6"}))),e.createElement(he,null,de?e.createElement(je,null):null,e.createElement(A,{variant:"contained",color:"secondary",onClick:()=>{s()}},"Cancel"),e.createElement(A,{variant:"contained",color:"primary",disabled:!ue,onClick:()=>{R()}},"Launch 3D protein structure view")))}),no=gn;var hn=m(function({handleClose:t,feature:n,preferredTranscriptId:o,model:i,view:s}){let[a,u]=h(0),l=oe(i),d=Ee(n)||"this gene";return e.createElement(St,{"data-testid":"launch-protein-view-dialog",maxWidth:"xl",title:"Launch protein view",titleNode:e.createElement(e.Fragment,null,"Launch protein view ",e.createElement(Ke,null)),open:!0,onClose:t},e.createElement(ur,{value:a,onChange:(p,c)=>{u(c)}},e.createElement($e,{value:0,label:`Structures for ${d}`}),e.createElement($e,{value:1,label:"Similar structures (Foldseek)"}),e.createElement($e,{value:2,label:"Your file or URL"})),e.createElement(Ze,{value:a,index:0},e.createElement(ro,{session:l,view:s,feature:n,geneName:d,preferredTranscriptId:o,handleClose:t})),e.createElement(Ze,{value:a,index:1},e.createElement(Nr,{session:l,view:s,feature:n,preferredTranscriptId:o,handleClose:t})),e.createElement(Ze,{value:a,index:2},e.createElement(no,{session:l,view:s,feature:n,preferredTranscriptId:o,handleClose:t})))}),Bu=hn;export{Bu as default};
3
- //# sourceMappingURL=LaunchProteinViewDialog-Q6SFXKUZ.js.map
1
+ import{b as Tr}from"./chunk-GPMX3YBJ.js";import{a as yr,c as br,d as Sr,e as kr}from"./chunk-OZ6WLM7F.js";import{a as lr,b as ur,e as dr,f as be,g as Ge,h as cr,i as Ve,p as Se,r as ke,s as ze,t as gr,v as hr}from"./chunk-N3ZJYLQ3.js";import"./chunk-PUFN5OCK.js";import"./chunk-NCH7IJII.js";import{a as E,b as M,c as Cr}from"./chunk-4F53HQBL.js";import{a as xr}from"./chunk-ZSEHREL2.js";import"./chunk-MJZSVHMS.js";import"./chunk-NY22OOJ6.js";import"./chunk-46MRJY2F.js";import{a as et,b as fr,c as He,d as vr}from"./chunk-UXGREKQA.js";import{i as Ae,k as er}from"./chunk-HNG6EUQA.js";import{a as Qt}from"./chunk-MYRDDDAG.js";import{a as D}from"./chunk-3VLTXPRJ.js";import"./chunk-SEVYWN5I.js";import{e as pe}from"./chunk-2RFFBSIA.js";import{a as Re,b as Jt}from"./chunk-Q5QGMPYL.js";import"./chunk-INWFM3CY.js";import"./chunk-HNO3QZD6.js";import{g as oe}from"./chunk-Y5T7GSKP.js";import"./chunk-IKXMX5OW.js";import"./chunk-BWZ7PSFU.js";import{d as Yt}from"./chunk-6AA7U2KU.js";import"./chunk-OU2GWGJP.js";import{d as bt}from"./chunk-LGVXT66Y.js";import{a as mr}from"./chunk-ENPYAI4H.js";import{h as pr}from"./chunk-THJLCDMW.js";import"./chunk-G67ZYVWG.js";import{$ as Lt,Ab as Qe,Bb as Ot,Hb as _t,M as Fe,Mb as Gt,N as It,Nb as Je,O as we,Oa as Pt,Pb as Xe,Qb as Vt,Sb as zt,Tb as Ht,Va as Ft,Vb as jt,Ya as wt,Yb as Wt,Zb as Kt,_a as Nt,_b as Zt,b as vt,bb as Ne,db as At,e as Ct,eb as Ye,fb as Et,ib as Mt,jb as Dt,kb as Ut,ub as qt,xb as $t,yb as Bt}from"./chunk-JKKI7LFR.js";import{a as Y}from"./chunk-LQ6SZ6DD.js";import{A as Be,B as Oe,C as ye,D as ar,E as _,F as _e,G as y,a as A,b as tr,c as me,d as fe,f as ge,g as Ee,j as he,k as Z,l as rr,m as or,n as nr,o as ee,p as ir,q as Me,r as Q,s as ve,t as te,u as De,v as sr,w as Ue,x as qe,y as $e,z as P}from"./chunk-SB4F5EHZ.js";import{a as Xt}from"./chunk-CFGPSBOM.js";import{a as St,b as H,c as W}from"./chunk-H74KBZLE.js";import{a as m}from"./chunk-BWRMG55K.js";import{b as Rt}from"./chunk-R3GQXMDR.js";import{d as kt,i as xt,n as Pe,p as K,q as Tt,r as h,s as e,u as T}from"./chunk-INAB36B4.js";import"./chunk-XBJKSIMP.js";T();T();T();var io=D()({root:{display:"flex",flexDirection:"column",gap:8},header:{display:"flex",alignItems:"center",gap:8},buttons:{display:"flex",gap:4},checkboxGroup:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:0}}),so=m(function({selected:t,onChange:n,disabled:o}){let{classes:i}=io();return e.createElement("div",{className:i.root},e.createElement("div",{className:i.header},e.createElement(y,{variant:"subtitle2"},"Databases to search:"),e.createElement("div",{className:i.buttons},e.createElement(A,{size:"small",onClick:()=>{n(Xe.map(s=>s.id))},disabled:o},"Select all"),e.createElement(A,{size:"small",onClick:()=>{n([])},disabled:o},"Clear"))),e.createElement(rr,{className:i.checkboxGroup},Xe.map(s=>e.createElement(Z,{key:s.id,control:e.createElement(me,{size:"small",checked:t.includes(s.id),onChange:()=>{t.includes(s.id)?n(t.filter(a=>a!==s.id)):n([...t,s.id])},disabled:o}),label:s.label}))))}),Ir=so;T();T();T();async function Lr(r,t,n){try{await r(),t?.()}catch(o){console.error(o),n?.(o)}}function Pr({structureCount:r,userSelectedProteinSequence:t,selectedTranscript:n}){return[r===0&&"No structure checked",!t?.seq&&"Could not compute protein sequence (feature may be missing CDS subfeatures)",!n&&"No transcript selected"].filter(o=>typeof o=="string")}function xe(r,t){let[n,o]=h(),[i,s]=h(!1);return{runLaunch:u=>()=>{t?.(),i||(s(!0),o(void 0),Lr(u,r,o).then(()=>{s(!1)}))},launchError:n,launching:i}}var ao=m(function({hit:t,session:n,view:o,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:u}){let[l,d]=h(null),p=!!l,c=Mt(t.target),g=F=>{d(F.currentTarget)},v=()=>{d(null)},{runLaunch:k,launchError:C,launching:S}=xe(u,v),f={session:n,view:o,feature:i,selectedTranscript:s,uniprotId:c},b=k(()=>{let F=!t.structureUrl&&Je(t)?Gt(t.tCa,t.tSeq,"A",t.target):void 0;return Se({...f,sources:[{url:t.structureUrl,data:F}],userProvidedTranscriptSequence:a})}),{launch1D:I}=ze({...f,confidenceUrl:Ut(t.target)});return!!t.structureUrl||Je(t)?e.createElement(e.Fragment,null,C?e.createElement(H,{error:C}):null,e.createElement(A,{size:"small",variant:"outlined",disabled:S,onClick:g},"Load"),e.createElement(Me,{anchorEl:l,open:p,onClose:v},e.createElement(Q,{"data-testid":"protein-launch-option-3d",onClick:b},ke["3d"]),I?e.createElement(Q,{"data-testid":"protein-launch-option-1d",onClick:k(I)},ke["1d"]):null)):e.createElement("span",null,"-")}),Fr=ao;var lo=D()(r=>({root:{display:"flex",flexDirection:"column",gap:16},tableContainer:{maxHeight:400},headerCell:{fontWeight:"bold",backgroundColor:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},noResults:{padding:16,textAlign:"center"}})),uo=100;function co(r){return jt(r).map(t=>({...t,structureUrl:Dt(t.target,t.db)})).toSorted((t,n)=>(t.eval??1/0)-(n.eval??1/0))}var po=m(function({results:t,session:n,view:o,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:u}){let{classes:l}=lo(),d=co(t),p=d.slice(0,uo);return p.length===0?e.createElement(ve,{className:l.noResults},e.createElement(y,null,"No similar structures found")):e.createElement("div",{className:l.root},e.createElement(y,{variant:"subtitle2"},"Found ",d.length," similar structures",d.length>p.length?` (showing top ${p.length})`:""),e.createElement(Be,{component:ve,className:l.tableContainer},e.createElement(qe,{size:"small",stickyHeader:!0},e.createElement(Oe,null,e.createElement(ye,null,e.createElement(P,{className:l.headerCell},"Database"),e.createElement(P,{className:l.headerCell},"Target"),e.createElement(P,{className:l.headerCell},"Organism"),e.createElement(P,{className:l.headerCell},e.createElement(_e,{title:"Foldseek's estimated probability that the hit is a true structural homolog"},e.createElement("span",null,"Prob"))),e.createElement(P,{className:l.headerCell},e.createElement(_e,{title:"Percentage of aligned residues whose amino acid is identical; structural hits are often low here"},e.createElement("span",null,"Seq. Id."))),e.createElement(P,{className:l.headerCell},"Coverage"),e.createElement(P,{className:l.headerCell},e.createElement(_e,{title:"Hits of this score expected by chance in a database this size; smaller is stronger"},e.createElement("span",null,"E-value"))),e.createElement(P,{className:l.headerCell},"Actions"))),e.createElement($e,null,p.map((c,g)=>e.createElement(ye,{key:`${c.db}-${c.target}-${g}`},e.createElement(P,null,c.db),e.createElement(P,null,c.target),e.createElement(P,null,c.taxName??"-"),e.createElement(P,null,c.prob!=null?`${(c.prob*100).toFixed(1)}%`:"-"),e.createElement(P,null,c.seqId!=null?`${c.seqId.toFixed(1)}%`:"-"),e.createElement(P,null,c.alnLength!=null&&c.qLen!=null?`${(c.alnLength/c.qLen*100).toFixed(1)}%`:"-"),e.createElement(P,null,c.eval!=null?c.eval.toExponential(2):"-"),e.createElement(P,null,e.createElement(Fr,{hit:c,session:n,view:o,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:u}))))))))}),wr=po;T();var mo=m(function({message:t}){return t?e.createElement(y,{variant:"body2",color:"warning.main"},t):null}),ne=mo;T();var fo=m(function({val:t,setVal:n,isoforms:o,ranking:i,structureSequence:s,feature:a,disabled:u,size:l}){let d=Ge(a),p=new Map(o.map(f=>[f.id(),f])),c=f=>be(p.get(f))||f,{matches:g,nonMatches:v,noData:k}=i,C=s?Fe(s).length:void 0,S=({id:f,length:b,identical:I},L=I===void 0?"":` (${I}/${C} structure residues identical)`)=>e.createElement(Q,{value:f,key:f},d," - ",c(f)," (",b,"aa)",L);return e.createElement(_,{value:t??"",onChange:f=>{n(f.target.value)},label:"Choose transcript isoform",select:!0,disabled:u,size:l},g.map(f=>S(f," (matches structure residues)")),v.map(f=>S(f)),k.map(f=>e.createElement(Q,{value:f,key:f,disabled:!0},d," - ",c(f)," (no data)")))}),Te=fo;T();function tt(){let[r,t]=h(),[n,o]=h(),[i,s]=h(!1),[a,u]=h(!1),[l,d]=h(),[p,c]=h(""),g=Tt(null);Pe(()=>()=>{g.current?.abort()},[]);let v=()=>{g.current?.abort();let b=new AbortController;return g.current=b,b.signal},k=async b=>{let I=v();u(!0),d(void 0),c("Predicting 3Di structure...");try{let L=await Wt(b,{signal:I});return o(L),L}catch(L){I.aborted||(console.error(L),d(L));return}finally{I.aborted||(u(!1),c(""))}},C=async(b,I,L)=>{let F=v();s(!0),d(void 0),c("Submitting search...");try{let N=await Kt({aaSequence:b,di3Sequence:I,databases:L},{signal:F}),G=await Zt(N.id,{onStatus:c,signal:F});return t(G),G}catch(N){F.aborted||(console.error(N),d(N));return}finally{F.aborted||(s(!1),c(""))}},S=()=>{g.current?.abort(),g.current=null,s(!1),u(!1),c("")},f=()=>{S(),t(void 0),o(void 0),d(void 0)};return{results:r,cleanedAaSequence:n?.aaSequence,di3Sequence:n?.di3Sequence,isLoading:i,isPredicting:a,error:l,statusMessage:p,predictStructure:k,search:C,cancel:S,reset:f}}function Ce({feature:r,view:t}){let{data:n,error:o,isLoading:i}=E(["isoform-sequences",r.id(),t?.assemblyNames?.[0]],async()=>{let a=Ae(r),u=await Yt({transcripts:a,session:oe(t),assemblyName:t?.assemblyNames?.[0]});for(let{feature:d,error:p}of u)p!==void 0&&console.error("[useIsoformProteinSequences] error for",d.id(),p);let l=u.flatMap(d=>d.seq===void 0?[]:[[d.feature.id(),{feature:d.feature,seq:d.seq}]]);return{sequences:Object.fromEntries(l),translated:l.length,total:u.length}},{...M,keepPreviousData:!0}),s=n?n.total-n.translated:0;return{isLoading:i,isoformSequences:n?.sequences,error:o,partialFailure:s>0&&n?`${s} of ${n.total} transcripts have no protein sequence`:void 0}}function rt({view:r,isoforms:t,structureSequences:n}){let o=!!r&&!!n?.length&&t.some(a=>a.seq),{data:i,error:s}=E(o?["isoform-ranking",t,n]:null,()=>Qt({rpcManager:oe(r).rpcManager,name:"ProteinRankIsoforms",args:{isoforms:t,structureSequences:n??[]},inPlace:()=>Re(t,n)}),M);return o?{ranking:i,error:s}:{ranking:Re(t,n)}}T();function go({options:r,isoformSequences:t,ranking:n,preferredTranscriptId:o}){return Ve(r,t).some(i=>i.id===o&&i.seq)?o:n&&Jt(n,er(r))}function ot({options:r,isoformSequences:t,ranking:n,preferredTranscriptId:o,resetKey:i}){let[s,a]=h(),[u,l]=h(i);i!==u&&(l(i),a(void 0));let d=t!==void 0?go({options:r,isoformSequences:t,ranking:n,preferredTranscriptId:o}):void 0;return{userSelection:s??d,setUserSelection:a}}function le({feature:r,view:t,structureSequences:n,preferredTranscriptId:o,resetKey:i}){let s=Ae(r),{isoformSequences:a,isLoading:u,error:l,partialFailure:d}=Ce({feature:r,view:t}),{ranking:p,error:c}=rt({view:t,isoforms:Ve(s,a),structureSequences:n}),{userSelection:g,setUserSelection:v}=ot({options:s,isoformSequences:a,ranking:p?.ranking,preferredTranscriptId:o,resetKey:i}),k=s.find(S=>S.id()===g),C=g?a?.[g]:void 0;return{transcripts:s,isoformSequences:a,structureSequence:p?.structureSequence,ranking:p?.ranking,isLoading:u,isRanking:!!a&&!p&&!c&&!g,error:l??c,partialFailure:d,selectedTranscriptId:g,setSelectedTranscriptId:v,selectedTranscript:k,selectedIsoform:C}}var ho=D()({dialogContent:{width:"80em",display:"flex",flexDirection:"column",gap:20},sequenceInput:{fontFamily:"monospace"},di3Section:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start"}}),yo=m(function({feature:t,preferredTranscriptId:n,session:o,view:i,handleClose:s}){let{classes:a}=ho(),[u,l]=h(),[d,p]=h(Vt),[c,g]=h(!1),{results:v,cleanedAaSequence:k,di3Sequence:C,isLoading:S,isPredicting:f,error:b,statusMessage:I,predictStructure:L,search:F,cancel:N,reset:G}=tt(),{transcripts:q,isoformSequences:B,ranking:j,isLoading:U,error:$,partialFailure:V,selectedTranscriptId:x,setSelectedTranscriptId:J,selectedTranscript:re,selectedIsoform:z}=le({feature:t,view:i,preferredTranscriptId:n}),X=z?It(z.seq):"",O=u??X,ue=()=>{(C!==void 0||v!==void 0)&&G()},de=ae=>{J(ae),l(void 0),ue()},R=S||f,se=Ht(O),w=zt(O).length>0&&!se&&d.length>0&&!R,ce=async()=>{let ae=k&&C?{aaSequence:k,di3Sequence:C}:await L(O.trim());ae&&await F(ae.aaSequence,ae.di3Sequence,d)},yt=b??$;return e.createElement(e.Fragment,null,e.createElement(Ee,{className:a.dialogContent},yt&&!U?e.createElement(H,{error:yt}):null,U?e.createElement(W,{variant:"subtitle2",message:"Loading transcript sequences"}):null,e.createElement(ne,{message:V}),B&&j?e.createElement(e.Fragment,null,e.createElement(Te,{val:x,setVal:de,isoforms:q,ranking:j,feature:t,disabled:R}),e.createElement(_,{label:"Protein sequence (amino acids)",multiline:!0,rows:4,value:O,onChange:ae=>{l(ae.target.value),ue()},placeholder:"MKTVRQERLKSIVRILERSKEPVSGAQLAEEL...",disabled:R,error:!!se,helperText:se,slotProps:{input:{className:a.sequenceInput}}})):null,C?e.createElement("div",{className:a.di3Section},e.createElement(ee,{component:"button",type:"button",variant:"body2",onClick:()=>{g(!c)}},c?"Hide 3Di":"Show 3Di"),c?e.createElement(_,{label:"3Di structural alphabet (what the search runs on)",multiline:!0,rows:4,fullWidth:!0,value:C,slotProps:{input:{className:a.sequenceInput,readOnly:!0}}}):null):null,e.createElement(Ir,{selected:d,onChange:p,disabled:R}),I?e.createElement(W,{variant:"subtitle2",message:I}):null,v?e.createElement(wr,{results:v,session:o,view:i,feature:t,selectedTranscript:re,userProvidedTranscriptSequence:z?.seq,onClose:s}):null,e.createElement(y,{variant:"body2",color:"textSecondary"},"Searching sends the protein sequence above to the foldseek.com servers, which predict its 3Di alphabet and run the structure search.")),e.createElement(ge,null,e.createElement(A,{variant:"contained",color:"secondary",onClick:()=>{s()}},"Close"),R?e.createElement(A,{variant:"outlined",onClick:()=>{N()}},"Cancel search"):null,v?e.createElement(A,{variant:"outlined",onClick:()=>{G()}},"New search"):null,e.createElement(A,{variant:"contained",color:"primary",disabled:!w,onClick:()=>{ce()}},f?"Predicting 3Di...":S?"Searching...":"Search Foldseek")))}),Nr=yo;T();T();var Ar=Xt(Rt("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");T();var bo=m(function({anchorEl:t,onClose:n,options:o}){return e.createElement(Me,{anchorEl:t,open:!!t,onClose:n,"data-testid":"protein-launch-options-menu"},o.map(i=>e.createElement(Q,{key:i.key,"data-testid":`protein-launch-option-${i.key}`,onClick:i.onClick},e.createElement(ir,{primary:i.title,secondary:i.description}))))}),Er=bo;var So=m(function({handleClose:t,ready:n,uniprotId:o,userSelectedProteinSequence:i,selectedTranscript:s,sources:a,confidenceUrl:u,feature:l,view:d,session:p,sideBySide:c}){let[g,v]=h(null),k=()=>{v(null)},{runLaunch:C,launchError:S,launching:f}=xe(t,k),b=n&&!f,I=C(()=>Se({session:p,view:d,feature:l,selectedTranscript:s,uniprotId:o,sources:a,userProvidedTranscriptSequence:i?.seq,sideBySide:c})),{launch1D:L}=ze({session:p,view:d,feature:l,selectedTranscript:s,uniprotId:o,confidenceUrl:u}),F=[{key:"3d",title:ke["3d"],description:"View protein structure with genome-to-structure coordinate mapping",onClick:I},...L?[{key:"1d",title:ke["1d"],description:"View protein features and annotations as a linear track",onClick:C(L)}]:[]];return e.createElement(e.Fragment,null,S?e.createElement(H,{error:S}):null,e.createElement(A,{variant:"contained",color:"secondary",size:"small",onClick:()=>{t()}},"Cancel"),e.createElement(tr,{variant:"contained",color:"primary",size:"small"},e.createElement(A,{"data-testid":"protein-launch-button",disabled:!b,onClick:I},"Launch"),e.createElement(A,{"data-testid":"protein-launch-options-button",disabled:!b,onClick:N=>{v(N.currentTarget)},"aria-label":"More launch options"},e.createElement(Ar,null))),e.createElement(Er,{anchorEl:g,onClose:k,options:F}))}),Mr=So;T();var ko=m(function(){return e.createElement(y,{variant:"body2",sx:{mr:2}},"Transcript and structure sequences differ, will run"," ",Ct[vt]," alignment")}),je=ko;T();T();var xo="32px 150px minmax(0, 1fr) 170px 150px",Ie=D()(r=>{let t=r.palette.mode==="dark";return{row:{display:"grid",gridTemplateColumns:xo,gap:12,alignItems:"center",padding:"6px 24px 6px 16px",borderBottom:`1px solid ${r.palette.divider}`,cursor:"pointer","&:hover":{backgroundColor:r.palette.action.hover}},checked:{backgroundColor:r.palette.action.selected},idCell:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:3},id:{fontFamily:"monospace",fontWeight:600,whiteSpace:"nowrap"},badge:{fontSize:"0.65rem",fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",padding:"0 6px",borderRadius:3},experimental:{color:t?"#8fd19c":"#2f6b3a",background:t?"#1c2e21":"#e4f1e6"},predicted:{color:t?"#f0c27a":"#7a4c0f",background:t?"#33281a":"#fbf0dc"},what:{display:"flex",flexDirection:"column",gap:4,minWidth:0},tags:{display:"flex",flexWrap:"wrap",gap:4},tag:{fontSize:"0.72rem",padding:"0 6px",border:`1px solid ${r.palette.divider}`,borderRadius:3,color:r.palette.text.secondary},partner:{color:r.palette.text.primary,borderColor:r.palette.primary.main},ligand:{fontFamily:"monospace"},quality:{display:"flex",flexDirection:"column",gap:2,fontVariantNumeric:"tabular-nums"},dot:{display:"inline-block",width:9,height:9,borderRadius:2,marginRight:5},coverage:{display:"flex",flexDirection:"column",gap:3,fontVariantNumeric:"tabular-nums"},bar:{position:"relative",height:8,border:`1px solid ${r.palette.divider}`,borderRadius:2},span:{position:"absolute",top:0,bottom:0,background:r.palette.primary.main,borderRadius:1}}});function To(r){let{domain:t,range:n}=pr.plddt;return n[t.filter(o=>r>o).length]}var Dr=m(function({value:t}){let{classes:n}=Ie();return t===void 0?null:e.createElement(y,{variant:"body2"},e.createElement("span",{className:n.dot,style:{background:To(t)}}),"pLDDT ",t.toFixed(1))}),vo=m(function({row:t}){let{classes:n}=Ie(),o=t.kind==="alphafold"?/model_v(\d+)/.exec(t.model.url)?.[1]:void 0;return e.createElement("div",{className:n.quality},t.kind==="alphafold"?e.createElement(e.Fragment,null,e.createElement(Dr,{value:t.model.meanPlddt}),e.createElement(y,{variant:"caption",color:"textSecondary"},"AlphaFold DB",o?` v${o}`:"")):t.kind==="dataset"?e.createElement(e.Fragment,null,e.createElement(y,{variant:"body2"},t.match.dataset.name),t.match.dataset.description?e.createElement(y,{variant:"caption",color:"textSecondary"},t.match.dataset.description):null):t.kind==="complex"?e.createElement(e.Fragment,null,t.complex.iptm===void 0?null:e.createElement(y,{variant:"body2"},"ipTM ",t.complex.iptm.toFixed(2)),e.createElement(Dr,{value:t.complex.meanPlddt})):e.createElement(e.Fragment,null,e.createElement(y,{variant:"body2"},t.entry.method,t.entry.resolution===void 0?"":` \xB7 ${t.entry.resolution.toFixed(2)} \xC5`),e.createElement(y,{variant:"caption",color:"textSecondary"},t.entry.chains.length===1?"chain":"chains"," ",t.entry.chains.join(", "))))}),Co=m(function({start:t,end:n,length:o}){let{classes:i}=Ie(),s=(n-t+1)/o;return e.createElement("div",{className:i.coverage},e.createElement("div",{className:i.bar,"aria-hidden":!0},e.createElement("span",{className:i.span,style:{left:`${(t-1)/o*100}%`,width:`${Math.min(s,1)*100}%`}})),e.createElement(y,{variant:"caption",color:"textSecondary"},t,"\u2013",n," of ",o," \xB7 ",Math.round(s*100),"%"))}),nt=m(function({tags:t,className:n}){let{classes:o,cx:i}=Ie();return e.createElement(e.Fragment,null,t.map(s=>e.createElement("span",{key:s.label,className:i(o.tag,n),title:s.title},s.label)))}),Io=m(function({row:t,checked:n,uniprotLength:o,onToggle:i}){let{classes:s,cx:a}=Ie(),u=t.partners.length+t.ligands.length+t.notes.length>0;return e.createElement("div",{className:a(s.row,n&&s.checked),"data-testid":`structure-row-${t.key}`,onClick:i},e.createElement(me,{size:"small",checked:n,onClick:l=>{l.stopPropagation()},onChange:i,slotProps:{input:{"aria-label":`Open ${t.label}`}}}),e.createElement("div",{className:s.idCell},e.createElement(ee,{href:t.href,target:"_blank",rel:"noreferrer",variant:"body2",className:s.id,onClick:l=>{l.stopPropagation()}},t.label),e.createElement("span",{className:a(s.badge,t.predicted?s.predicted:s.experimental)},t.predicted?"Predicted":"Experimental")),e.createElement("div",{className:s.what},e.createElement(y,{variant:"body2"},t.title),u?e.createElement("div",{className:s.tags},e.createElement(nt,{tags:t.partners,className:s.partner}),e.createElement(nt,{tags:t.ligands,className:s.ligand}),e.createElement(nt,{tags:t.notes})):null),e.createElement(vo,{row:t}),t.kind==="dataset"?e.createElement(y,{variant:"caption",color:"textSecondary"},"listed as ",t.match.structure.id):e.createElement(Co,{start:t.start,end:t.end,length:o}))}),Ur=Io;var Lo=.5,Po={ADP:"ADP",AMP:"AMP",ANP:"AMP-PNP",ATP:"ATP",CA:"Ca\xB2\u207A",CD:"Cd\xB2\u207A",CO:"Co\xB2\u207A",CU:"Cu\xB2\u207A",FAD:"FAD",FE:"Fe\xB3\u207A",FE2:"Fe\xB2\u207A",GCP:"GppCp",GDP:"GDP",GNP:"GppNHp",GSP:"GTP\u03B3S",GTP:"GTP",HEM:"heme",MG:"Mg\xB2\u207A",MN:"Mn\xB2\u207A",NAD:"NAD\u207A",NAP:"NADP\u207A",NDP:"NADPH",NI:"Ni\xB2\u207A",SAH:"SAH",SAM:"SAM",ZN:"Zn\xB2\u207A"},Fo=["ATP","ADP","CoA","DNA","EM","Fab","GDP","GTP","HLA","MHC","mRNA","NAD","NADP","NMR","RNA","scFv","TCR","tRNA"];function wo(r,t=[]){let n=new Map([...Fo,...t].map(i=>[i.toUpperCase(),i])),o=r.replace(/[A-Za-z0-9]+(?:[-*:'.][A-Za-z0-9]+)*/g,i=>/\d/.test(i)?i:i.replace(/[A-Za-z]+/g,s=>n.get(s)??s.toLowerCase()));return r===r.toUpperCase()?o.charAt(0).toUpperCase()+o.slice(1):r}function No(r){return r.ligands.filter(t=>!mr.has(t.id)).map(t=>({label:Po[t.id]??t.id,title:t.name}))}function Ao(r,t){let n=Bt(r,t),o=n.filter(a=>a.type==="Protein"),i=n.filter(a=>a.type!=="Protein"),s=[...o.map(a=>({label:a.description??a.entityId,title:a.uniprotIds.join(", ")||void 0})),...[...new Set(i.map(a=>a.type??"Other"))].map(a=>({label:a,title:i.filter(u=>(u.type??"Other")===a).map(u=>u.description??u.entityId).join(`
2
+ `)}))];return{tags:s.filter((a,u)=>s.findIndex(l=>l.label===a.label)===u),withProtein:o.length>0}}function Eo({entry:r,summary:t,geneName:n,uniprotId:o}){let i=t?Ao(t,o):void 0,s=t?No(t):[],a=r.pdbId.toUpperCase();return{kind:"pdb",key:`pdb:${r.pdbId}`,entry:r,section:r.coverage<Lo?"fragment":i?.withProtein?"partner":"alone",predicted:!1,label:a,href:Et(r.pdbId),title:t?.title?wo(t.title,[n,...t.ligands.map(u=>u.id)]):`PDB entry ${a}`,partners:i?.tags??[],ligands:s,notes:[],start:r.start,end:r.end}}function $r(r){return`https://alphafold.ebi.ac.uk/entry/${r}`}function Mo({complex:r,geneName:t,uniprotId:n,uniprotLength:o}){let i=n.replace(/-\d+$/,""),s=r.homomer?[]:r.members.filter(a=>a.accession!==i);return{kind:"complex",key:`complex:${r.entity}`,complex:r,section:"partner",predicted:!0,label:r.entity,href:$r(r.entity),title:r.homomer?r.name??`${t} ${r.oligomericState??"homomer"}`:`${t} with ${s.map(a=>a.description??a.gene??a.accession).join(", ")}`,partners:s.map(a=>({label:a.gene??a.accession,title:[a.description,a.accession].filter(Boolean).join(", ")})),ligands:[],notes:[{label:`${r.homomer?"homo":"hetero"}${r.oligomericState??"mer"}`}],start:1,end:o}}function Do({model:r,uniprotId:t,uniprotLength:n}){let o=r.accession!==t.replace(/-\d+$/,"");return{kind:"alphafold",key:"alphafold",model:r,section:"alone",predicted:!0,label:`AF-${r.accession}-F1`,href:$r(r.accession),title:o?`AlphaFold model of isoform ${r.accession}`:"AlphaFold model of the full-length protein",partners:[],ligands:[],notes:[],start:1,end:Math.min(r.sequence?.length??n,n)}}function qr(r){return decodeURIComponent(new URL(r).pathname.split("/").pop()??r)}function Br({match:r,geneName:t,uniprotLength:n}){let{dataset:o,structure:i,transcript:s}=r;return{kind:"dataset",key:`dataset:${o.datasetId}:${i.id}:${qr(i.url)}`,match:r,section:"alone",predicted:!0,label:i.label??qr(i.url),href:i.url,title:s?`${o.name} model of transcript ${be(s)||i.id}`:`${o.name} model of ${t}`,partners:[],ligands:[],notes:[],start:1,end:n}}function Or({geneName:r,uniprotId:t,uniprotLength:n,alphaFold:o,entries:i=[],summaries:s,complexes:a=[]}){return[...o?[Do({model:o,uniprotId:t,uniprotLength:n})]:[],...i.map(u=>Eo({entry:u,summary:s?.get(u.pdbId),geneName:r,uniprotId:t})),...a.map(u=>Mo({complex:u,geneName:r,uniprotId:t,uniprotLength:n}))]}function it(r,t){return t==="all"||t==="predicted"===r.predicted}function _r(r,t,n){let o=new Set(n.filter(i=>i.section==="fragment").map(i=>i.key));return r.includes(t.key)?r.filter(i=>i!==t.key):t.section==="fragment"?[t.key]:[...r.filter(i=>!o.has(i)),t.key]}var st=["alone","partner","fragment"];function at(r){return st.flatMap(t=>r.filter(n=>n.section===t))}function Gr(r){let t=r.find(n=>n.kind==="dataset")??r.find(n=>n.kind==="alphafold")??at(r)[0];return t?[t.key]:[]}var Vr=D()(r=>({list:{flex:"1 1 auto",minHeight:160,overflowY:"auto",borderTop:`1px solid ${r.palette.divider}`},header:{position:"sticky",top:0,zIndex:1,display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12,padding:"8px 24px 4px",background:r.palette.background.paper,borderBottom:`1px solid ${r.palette.divider}`},heading:{fontSize:"0.8rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:r.palette.text.secondary},line:{padding:"6px 24px",borderBottom:`1px solid ${r.palette.divider}`}})),Uo=5;function qo(r,t){return r==="alone"?{title:`${t} on its own`,note:"whole protein or most of it, with any bound nucleotide or drug"}:r==="partner"?{title:`${t} with another protein`,note:"experimental complexes first, then AlphaFold DB predictions"}:{title:"Short fragments",note:"under half the protein, so each opens on its own"}}var $o=m(function({section:t,geneName:n,rows:o,status:i,checked:s,uniprotLength:a,onToggle:u}){let{classes:l}=Vr(),[d,p]=h(!1),{title:c,note:g}=qo(t,n),v=t==="fragment"&&!d&&!o.some(b=>s.includes(b.key)),k=t==="alone"&&!d?o.slice(0,Uo):o,C=o.length-k.length,S=i?.loading??[],f=i?.notices??[];return o.length+S.length+f.length===0?null:e.createElement("div",{"data-testid":`structure-section-${t}`},e.createElement("div",{className:l.header},e.createElement("span",{className:l.heading},c," \xB7 ",o.length),e.createElement(y,{variant:"caption",color:"textSecondary"},g)),v?o.length>0?e.createElement("div",{className:l.line},e.createElement(ee,{component:"button",variant:"body2",onClick:()=>{p(!0)}},"Show ",o.length," short fragment",o.length===1?"":"s")):null:e.createElement(e.Fragment,null,k.map(b=>e.createElement(Ur,{key:b.key,row:b,checked:s.includes(b.key),uniprotLength:a,onToggle:()=>{u(b)}})),C>0?e.createElement("div",{className:l.line},e.createElement(ee,{component:"button",variant:"body2",onClick:()=>{p(!0)}},"Show ",C," more")):null),S.map(b=>e.createElement("div",{className:l.line,key:b},e.createElement(W,{variant:"body2",message:b}))),f.map(b=>e.createElement(y,{key:b,className:l.line,variant:"body2",color:"textSecondary"},b)))}),Bo=m(function({rows:t,sections:n,geneName:o,checked:i,uniprotLength:s,onToggle:a}){let{classes:u}=Vr();return e.createElement("div",{className:u.list,"data-testid":"structure-list"},st.map(l=>e.createElement($o,{key:l,section:l,geneName:o,rows:t.filter(d=>d.section===l),status:n?.[l],checked:i,uniprotLength:s,onToggle:a})))}),zr=Bo;T();T();T();var Oo=m(function({recognizedIds:t,geneName:n,selectedId:o,onSelectedIdChange:i}){let[s,a]=h(!1),u=[{value:"auto",label:"Auto (try all)"},...t.map(l=>({value:l,label:Ot(l)}))];return n&&u.push({value:`gene:${n}`,label:`${n} (gene name)`}),t.length===0&&!n?null:s?e.createElement(he,{size:"small"},e.createElement(nr,null,"Query UniProt by"),e.createElement(sr,{value:o,label:"Query UniProt by",onChange:l=>{i(l.target.value)}},u.map(l=>e.createElement(Q,{key:l.value,value:l.value},l.label)))):e.createElement(A,{size:"small",variant:"text",onClick:()=>{a(!0)}},"Choose identifier to query...")}),Hr=Oo;T();var _o=["auto","manual","feature"];function Go(r){return _o.some(t=>t===r)}var Vo=m(function({lookupMode:t,onLookupModeChange:n,manualUniprotId:o,onManualUniprotIdChange:i,manualUniprotIdInvalid:s,featureUniprotId:a,hasSearchableIdentifier:u=!0,endContent:l}){return e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap"}},e.createElement(he,{component:"fieldset"},e.createElement(De,{row:!0,value:t,onChange:d=>{Go(d.target.value)&&n(d.target.value)}},a&&e.createElement(Z,{value:"feature",control:e.createElement(te,null),label:`From feature (${a})`}),u&&e.createElement(Z,{value:"auto",control:e.createElement(te,null),label:"Look up from the feature's identifiers"}),e.createElement(Z,{value:"manual",control:e.createElement(te,null),label:"Enter manually"}))),l),t==="manual"&&e.createElement("div",null,e.createElement(_,{autoFocus:!0,label:"UniProt ID",variant:"outlined",placeholder:"e.g. P68871",size:"small",value:o,error:s,helperText:s?fr:void 0,onChange:d=>{i(d.target.value)}})),t==="manual"&&!o&&e.createElement(y,{variant:"body2",color:"text.secondary"},"Search"," ",e.createElement(Y,{href:"https://www.uniprot.org/"},"UniProt")," or ",e.createElement(Y,{href:"https://alphafold.ebi.ac.uk/"},"AlphaFoldDB")))}),jr=Vo;var zo=D()({endRow:{display:"flex",flexDirection:"row",gap:12,alignItems:"flex-start"}}),Ho=m(function({lookup:t}){let{classes:n}=zo();return e.createElement(e.Fragment,null,e.createElement(jr,{lookupMode:t.lookupMode,onLookupModeChange:t.setLookupMode,manualUniprotId:t.manualUniprotId,onManualUniprotIdChange:t.setManualUniprotId,manualUniprotIdInvalid:t.manualUniprotIdInvalid,featureUniprotId:t.featureUniprotId,hasSearchableIdentifier:t.hasSearchableIdentifier,endContent:t.showIdentifierSelector?e.createElement("div",{className:n.endRow},e.createElement(Hr,{recognizedIds:t.recognizedIds,geneName:t.geneName,selectedId:t.selectedQueryId,onSelectedIdChange:t.setSelectedQueryId}),e.createElement(_,{size:"small",label:"NCBI taxon id",error:t.taxonIdError,helperText:t.taxonIdError?"Not a taxon id; searching every species":"Narrows the gene-name search to one species",value:t.taxonId,onChange:o=>{t.setTaxonId(o.target.value)},placeholder:"e.g. 9606",slotProps:{inputLabel:{shrink:!0}},sx:{width:180}})):null}),t.showIdentifierSelector?e.createElement(y,{variant:"body2",color:"textSecondary"},t.organismDescription):null,t.nothingToSearch?e.createElement(y,{variant:"body2",color:"textSecondary"},"This feature carries no Ensembl, RefSeq, CCDS or HGNC identifier and no gene name; enter a UniProt accession"):null,e.createElement(ne,{message:t.lookupPartialFailure}))}),Wr=Ho;T();T();var jo=D()(r=>({tableContainer:{maxHeight:200},headerCell:{fontWeight:"bold",backgroundColor:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},selectedRow:{backgroundColor:r.palette.action.selected},clickableRow:{cursor:"pointer","&:hover":{backgroundColor:r.palette.action.hover}},reviewedChip:{backgroundColor:r.palette.success.main,color:r.palette.success.contrastText,fontSize:"0.7rem",height:20},unreviewedChip:{backgroundColor:r.palette.warning.main,color:r.palette.warning.contrastText,fontSize:"0.7rem",height:20}})),Wo=m(function({entries:t,selectedAccession:n,onSelect:o}){let{classes:i,cx:s}=jo();return t.length===0?null:e.createElement("div",null,e.createElement(y,{variant:"body2",sx:{mb:1}},"Found ",t.length," UniProt entries. Select one:"),e.createElement(Be,{component:ve,className:i.tableContainer},e.createElement(qe,{size:"small",stickyHeader:!0,"data-testid":"uniprot-results-table"},e.createElement(Oe,null,e.createElement(ye,null,e.createElement(P,{className:i.headerCell,padding:"checkbox"}),e.createElement(P,{className:i.headerCell},"Accession"),e.createElement(P,{className:i.headerCell},"Gene"),e.createElement(P,{className:i.headerCell},"Organism"),e.createElement(P,{className:i.headerCell},"Protein"),e.createElement(P,{className:i.headerCell},"Status"))),e.createElement($e,null,t.map(a=>e.createElement(ye,{key:a.accession,onClick:()=>{o(a.accession)},className:s(i.clickableRow,n===a.accession&&i.selectedRow)},e.createElement(P,{padding:"checkbox"},e.createElement(te,{checked:n===a.accession,size:"small"})),e.createElement(P,null,e.createElement(Y,{href:Ne(a.accession)},a.accession)),e.createElement(P,null,a.geneName??"-"),e.createElement(P,null,a.organismName??"-"),e.createElement(P,null,a.proteinName?a.proteinName.length>40?`${a.proteinName.slice(0,40)}...`:a.proteinName:"-"),e.createElement(P,null,e.createElement(fe,{label:a.isReviewed?"Reviewed":"Unreviewed",size:"small",className:a.isReviewed?i.reviewedChip:i.unreviewedChip}))))))))}),Kr=Wo;var Zr=m(function(){return e.createElement(Y,{href:"https://www.uniprot.org/"},"UniProt")}),Ko=m(function({lookup:t}){let n=t.uniprotEntries.length>0;return t.isAutoMode?n?e.createElement(e.Fragment,null,e.createElement(y,{variant:"body2",color:"textSecondary"},"Searched UniProt by ",t.searchDescription),e.createElement(Kr,{entries:t.uniprotEntries,selectedAccession:t.selectedTableAccession,onSelect:t.setSelectedUniprotId}),e.createElement(y,{variant:"body2",color:"textSecondary"},"If you don't see the entry you're looking for, try a different identifier above or search ",e.createElement(Zr,null),' directly and use "Enter manually".')):t.isLookupLoading||t.lookupError?null:e.createElement(y,{variant:"body2",color:"textSecondary"},"No UniProt entries found for ",t.searchDescriptionOr,". Try a different identifier above, or search ",e.createElement(Zr,null),' directly and use "Enter manually".'):null}),Yr=Ko;var Zo=D()(r=>({bar:{flex:"none",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px 12px",padding:"8px 24px",background:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},accession:{fontFamily:"monospace",fontWeight:600},reviewed:{backgroundColor:r.palette.success.main,color:r.palette.success.contrastText,fontSize:"0.7rem",height:20},unreviewed:{backgroundColor:r.palette.warning.main,color:r.palette.warning.contrastText,fontSize:"0.7rem",height:20},panel:{flex:"none",maxHeight:"40vh",overflowY:"auto",display:"flex",flexDirection:"column",gap:12,padding:"4px 24px 12px",background:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]}}));function Yo(r){return r.isAutoMode?!r.isLookupLoading&&(!!r.lookupError||!hr(r.uniprotEntries)):!r.uniprotId}var Qo=m(function({lookup:t}){let n=t.uniprotEntries.length;return e.createElement(y,{variant:"body2",color:"textSecondary"},t.lookupMode==="feature"?"named by the feature's own UniProt attribute":t.lookupMode==="manual"?"entered by hand":n===1?`the one UniProt match for ${t.searchDescription}`:`picked from ${n} UniProt matches for ${t.searchDescription}`)}),Jo=m(function({lookup:t}){let{classes:n}=Zo(),[o,i]=h(),s=o??Yo(t),{uniprotId:a}=t,u=t.uniprotEntries.find(l=>l.accession===a);return e.createElement(e.Fragment,null,e.createElement("div",{className:n.bar,"data-testid":"uniprot-summary"},a?e.createElement(e.Fragment,null,e.createElement(y,{variant:"body2"},"Protein"," ",e.createElement(Y,{href:Ne(a),className:n.accession},a),[u?.proteinName,u?.organismName].filter(Boolean).map(l=>` \xB7 ${l}`).join("")),u?e.createElement(fe,{label:u.isReviewed?"Reviewed":"Unreviewed",size:"small",className:u.isReviewed?n.reviewed:n.unreviewed}):null,e.createElement(Qo,{lookup:t})):e.createElement(y,{variant:"body2"},t.isLookupLoading?`Looking up the UniProt entry for ${t.searchDescription}\u2026`:t.lookupMode==="auto"?`No single UniProt entry for ${t.searchDescriptionOr}`:"Enter a UniProt accession to list its structures"),e.createElement(ee,{component:"button",variant:"body2","data-testid":"uniprot-change","aria-expanded":s,onClick:()=>{i(!s)}},s?"Done":"Change")),s?e.createElement("div",{className:n.panel,"data-testid":"uniprot-chooser"},t.lookupError?e.createElement(H,{error:t.lookupError}):null,e.createElement(Wr,{lookup:t}),e.createElement(Yr,{lookup:t})):null)}),Qr=Jo;T();function ie(r,t=300){let[n,o]=h(r);return Pe(()=>{let i=setTimeout(()=>{o(r)},t);return()=>{clearTimeout(i)}},[r,t]),n}T();T();function Xo(r){return[...r].sort((t,n)=>Number(n.homomer)-Number(t.homomer)||(n.iptm??0)-(t.iptm??0))}function Jr(r){let t=r?.replace(/-\d+$/,""),{data:n,error:o,isLoading:i}=E(t?["alphafold-complexes",t]:null,([,u])=>wt(u),M);return{complexes:K(()=>n?Xo(n):void 0,[n]),error:o,isLoading:i}}function Xr(r){let{data:t,error:n,isLoading:o}=E(r?["alphafold-complex-model",r]:null,async([,s])=>{let a=await Nt(s);if(!a)throw new Error(`AlphaFold DB has no files for complex ${s}`);return a},M);return{model:t,error:n,isLoading:o}}T();function lt({uniprotId:r,feature:t,view:n,preferredTranscriptId:o}){let{data:i,isLoading:s,isValidating:a,error:u}=E(r?["alphafold-models",r]:null,([,g])=>Ft(g),{...M,keepPreviousData:!0}),{isoformSequences:l}=Ce({feature:t,view:n}),d=K(()=>r&&(i||u)?gr(r,u?void 0:i,l,o):void 0,[r,i,u,l,o]),p=r?u:void 0,c=r?.replace(/-\d+$/,"");return{isLoading:s,isValidating:a,modelsUnreachable:p,model:d,entryLength:r&&!u?i?.find(g=>g.accession===c)?.sequence.length:void 0,noModel:!!r&&!s&&!u&&i?.length===0}}T();function ut({jbrowse:r,feature:t,preferredTranscriptId:n}){let o=K(()=>yr(r),[r]),i=Sr(r),{data:s,isLoading:a}=E(o.length>0?["structure-datasets",...o.map(d=>`${d.datasetId} ${JSON.stringify(d.mappingLocation)}`)]:null,()=>Promise.allSettled(o.map(d=>kr(d,i))),M),u=K(()=>o.flatMap((d,p)=>{let c=s?.[p];return c?.status==="fulfilled"?br({dataset:d,mapping:c.value,feature:t,preferredTranscriptId:n}):[]}),[o,s,t,n]),l=o.flatMap((d,p)=>{let c=s?.[p];return c?.status==="rejected"?[`${d.name}'s structure list did not load: ${pe(c.reason)}`]:[]});return{matches:u,notices:l,isLoading:a,loadingMessage:`Reading ${o.map(d=>d.name).join(", ")}`}}function dt(r){let{data:t,error:n,isLoading:o}=E(r?["experimental-structures",r]:null,([,i])=>qt(i),M);return{entries:t,error:n,isLoading:o}}function ct(r){let t=r?.map(a=>a.pdbId).join(","),{data:n,error:o,isLoading:i}=E(t?["pdb-entry-summaries",t]:null,([,a])=>$t(a.split(",")),M);return{summaries:n,error:o,isLoading:i}}function Rr(r){return typeof r=="string"}function Ro(r){let t=n=>{let o=r.filter(i=>i.sections.includes(n));return{loading:o.map(i=>i.loading).filter(Rr),notices:o.map(i=>i.notice).filter(Rr)}};return{alone:t("alone"),partner:t("partner"),fragment:t("fragment")}}function pt({jbrowse:r,uniprotId:t,uniprotPending:n,geneName:o,feature:i,view:s,preferredTranscriptId:a}){let u=ut({jbrowse:r,feature:i,preferredTranscriptId:a}),l=lt({uniprotId:t,feature:i,view:s,preferredTranscriptId:a}),d=Jr(t),p=dt(t),c=ct(p.entries),g=p.entries,v=!!g&&(g.length===0||!c.isLoading),k=l.entryLength??l.model?.sequence?.length??Math.max(1,...(g??[]).map(F=>F.end)),C=K(()=>at([...u.matches.map(F=>Br({match:F,geneName:o,uniprotLength:k})),...t?Or({geneName:o,uniprotId:t,uniprotLength:k,alphaFold:l.isLoading?void 0:l.model,entries:v?g:void 0,summaries:c.summaries,complexes:d.complexes}):[]]),[u.matches,t,o,k,l.isLoading,l.model,v,g,c.summaries,d.complexes]),S=["alone","partner","fragment"],f=[{sections:["alone"],loading:u.isLoading&&u.loadingMessage},...u.notices.map(F=>({sections:["alone"],notice:F}))],b=t?[{sections:["alone"],loading:l.isLoading&&"Asking AlphaFold DB for models",notice:l.noModel?`AlphaFold DB has no model for ${t}`:l.modelsUnreachable!==void 0&&`AlphaFold DB's model list did not answer, so its row opens the canonical model file for ${t}, without comparing its sequence to the isoforms`},{sections:S,loading:(p.isLoading||c.isLoading)&&"Listing PDB entries from RCSB",notice:p.error!==void 0&&`RCSB did not list the PDB entries: ${pe(p.error)}`},{sections:["alone","partner"],notice:c.error!==void 0&&`RCSB did not describe the PDB entries, so they are placed by coverage alone: ${pe(c.error)}`},{sections:["alone"],notice:g?.length===0&&`RCSB lists no experimental structure for ${t}`},{sections:["partner"],loading:d.isLoading&&"Asking AlphaFold DB for predicted complexes",notice:d.error!==void 0&&`AlphaFold DB's complex list did not answer: ${pe(d.error)}`}]:[],I=Ro([...f,...b]),L=u.matches.length>0;return{rows:C,uniprotLength:k,sections:I,alphaFold:l,defaultSettled:!u.isLoading&&(L||!n&&!l.isLoading&&(!!l.model||!(p.isLoading||c.isLoading||d.isLoading)))}}T();function mt(r){let{data:t,error:n,isLoading:o,isValidating:i}=E(r?["pdb-entry",r]:null,([,s])=>Pt(s),M);return{entry:t,error:n,isLoading:o,isValidating:i}}async function eo(r){let{PluginContext:t,DefaultPluginSpec:n}=await xr(),o=new t(n());await o.init();try{return await r(o)}finally{o.dispose()}}async function en({file:r,url:t}){let n=r?await He(r):void 0;return eo(async o=>{let i=await Tr({plugin:o,data:n,url:t}),s=await o.builders.structure.createModel(i);return Lt(s)})}function Le({file:r,url:t}){let n=r?["structure-file",r.name,r.size,r.lastModified]:t?["structure-url",t]:null,{data:o,error:i,isLoading:s}=E(n,async()=>{let a=await en({file:r,url:t});if(!a?.length)throw new Error("No protein sequence found in this structure");return a},M);return{error:i,isLoading:s,sequences:o}}function to(r){return r.kind==="alphafold"?{url:r.model.url}:r.kind==="pdb"?{url:At(r.pdbId)}:r.kind==="url"?{url:r.url,uniprotId:r.uniprotId}:{alphaFoldComplexId:r.entity}}function ft({structures:r,uniprotId:t,feature:n,view:o,preferredTranscriptId:i}){let s=r[0],a=mt(s?.kind==="pdb"?s.pdbId:void 0),u=Xr(s?.kind==="complex"?s.entity:void 0),l=Le({url:s?.kind==="url"?s.url:void 0}),d=t?.replace(/-\d+$/,""),p=u.model?.chains,c=p?.find(N=>N.accession===d),g=s?.kind==="alphafold"?s.model.sequence:void 0,v=a.entry?.proteinSequences,k=l.sequences,C=K(()=>s?.kind==="alphafold"?g?[g]:void 0:s?.kind==="pdb"?v:s?.kind==="url"?k:c?[c.sequence]:p?.map(N=>N.sequence),[s?.kind,g,v,k,c,p]),S=le({feature:n,view:o,structureSequences:C,preferredTranscriptId:i,resetKey:s?.key}),f=S.selectedTranscriptId!==i&&(a.isValidating&&!a.error||u.isLoading||l.isLoading),b=[S.isLoading&&"Loading protein sequences from transcript isoforms",S.isRanking&&"Aligning isoforms to the structure",f&&(s?.kind==="pdb"?"Reading the chains of the entry from RCSB":s?.kind==="url"?"Reading residues from the structure":"Asking AlphaFold DB for the complex")].filter(N=>typeof N=="string"),I=b.length>0,L=s?.kind==="alphafold"||s?.kind==="complex"||s?.kind==="url",F=S.selectedIsoform?.seq;return{...S,loadingStatuses:b,isLoading:I,error:I?void 0:S.error??u.error??l.error,pdbEntryError:a.error,sequencesMatch:L&&!u.isLoading&&F&&S.structureSequence?we(F,S.structureSequence):void 0}}T();function tn({attemptedCount:r,failedCount:t}){return t>0&&t<r?`UniProt lookup failed for ${t} of ${r} identifiers`:void 0}function gt({recognizedIds:r=[],geneId:t,geneName:n,organismId:o,selectedQueryId:i="auto",enabled:s=!0}){let a=[],u;i==="auto"?(a=r,u=n):i.startsWith("gene:")?u=i.replace("gene:",""):Qe(i)&&(a=[i]);let l=a.some(g=>Qe(g))||!!u,{data:d,error:p,isLoading:c}=E(s&&l?["uniprotSearch",i,a.join(","),u,t,o]:null,async()=>_t({recognizedIds:a,geneId:t,geneName:u,organismId:o}),{...M,keepPreviousData:!0});return{entries:d?.entries??[],isLoading:c,error:p,partialFailure:d?tn(d):void 0}}function We({selectedQueryId:r,recognizedIds:t,geneName:n,joinWord:o="and"}){return r==="auto"?[t.length>0?`database ID${t.length>1?"s":""} "${t.join('", "')}"`:void 0,n?`gene name "${n}"`:void 0].filter(Boolean).join(` ${o} `):r.startsWith("gene:")?`gene name "${r.replace("gene:","")}"`:`database ID "${r}"`}function rn(r,t){return r===void 0?"Organism: unknown, showing all species; type an NCBI taxon id to narrow":`Organism: ${r} (${t==="user"?"typed above":"from assembly"})`}function ht({feature:r,view:t,preferredTranscriptId:n}){let o=cr(r,n),i=o.uniprotId,s=o.recognizedIds.length>0||!!o.geneName,[a,u]=h(()=>i?"feature":s?"auto":"manual"),[l,d]=h(""),[p,c]=h(""),g=t.assemblyNames[0],v=g?oe(t).assemblyManager.get(g)?.configuration:void 0,k=v?dr(bt(v,["sequence","metadata"])):void 0,C=ie(p.trim(),400),S=Number(C),f=C!==""&&Number.isFinite(S)&&S>0,b=f?S:k,I=C!==""&&!f,[L,F]=h("auto"),[N,G]=h(),q=a==="auto",{entries:B,isLoading:j,error:U,partialFailure:$}=gt({recognizedIds:o.recognizedIds,geneId:o.geneId,geneName:o.geneName,organismId:b,selectedQueryId:L,enabled:q}),V=ie(l,400),J=j||a==="manual"&&l!==V,re=B.some(O=>O.accession===N)?N:void 0,z=B[0]?.accession,X=a==="feature"?i:q?re??z:et(V)?V:void 0;return{lookupMode:a,setLookupMode:u,manualUniprotId:l,setManualUniprotId:O=>{d(O.trim().toUpperCase())},manualUniprotIdInvalid:l!==""&&!et(l),taxonId:p,setTaxonId:c,taxonIdError:I,organismDescription:rn(b,f?"user":"assembly"),selectedQueryId:L,setSelectedQueryId:F,setSelectedUniprotId:G,selectedTableAccession:re??z,uniprotEntries:B,isLookupLoading:J,lookupError:U,lookupPartialFailure:$,uniprotId:X,featureUniprotId:i,recognizedIds:o.recognizedIds,geneName:o.geneName,isAutoMode:q,hasSearchableIdentifier:s,nothingToSearch:!s&&!i,showIdentifierSelector:q&&s,searchDescription:We({selectedQueryId:L,recognizedIds:o.recognizedIds,geneName:o.geneName}),searchDescriptionOr:We({selectedQueryId:L,recognizedIds:o.recognizedIds,geneName:o.geneName,joinWord:"or"})}}var on=D()(r=>({root:{width:"80em",maxWidth:"100%",maxHeight:"calc(100vh - 180px)",display:"flex",flexDirection:"column"},toolbar:{flex:"none",display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",gap:10,padding:"8px 24px"},chips:{display:"flex",gap:6},footer:{flex:"none",display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",gap:12,padding:"8px 24px",borderTop:`1px solid ${r.palette.divider}`},summary:{display:"flex",flexDirection:"column",gap:6,minWidth:0,flex:"1 1 400px"},actions:{padding:0,flexWrap:"wrap"}})),nn=[{filter:"all",label:"All"},{filter:"experimental",label:"Experimental"},{filter:"predicted",label:"Predicted"}];function sn(r){return r.kind==="alphafold"?{key:r.key,kind:"alphafold",model:r.model}:r.kind==="pdb"?{key:r.key,kind:"pdb",pdbId:r.entry.pdbId}:r.kind==="dataset"?{key:r.key,kind:"url",url:r.match.structure.url,uniprotId:r.match.structure.uniprotId}:{key:r.key,kind:"complex",entity:r.complex.entity}}function an(r,t,n){let[o,...i]=r;return t?`PDB ${t.toUpperCase()}, typed above, in place of the checked rows`:o?i.length>0?`${r.map(s=>s.label).join(" + ")}, superposed onto ${o.label}`:o.section==="fragment"?`${o.label}, a short fragment, on its own`:`${o.label}: ${o.title}`:n?"Finding structures\u2026":"Check a structure to open it"}var ln=m(function({feature:t,geneName:n,preferredTranscriptId:o,session:i,view:s,handleClose:a}){let{classes:u}=on(),l=ht({feature:t,view:s,preferredTranscriptId:o}),{uniprotId:d}=l,p=pt({jbrowse:i.jbrowse,uniprotId:d,uniprotPending:l.isLookupLoading,geneName:n,feature:t,view:s,preferredTranscriptId:o}),{rows:c}=p,[g,v]=h("all"),[k,C]=h(),S=k&&k.uniprotId===d?k.keys:void 0,f=!p.defaultSettled,b=S??(f?[]:Gr(c)),I=c.filter(w=>b.includes(w.key)),[L,F]=h(()=>lr()),[N,G]=h(""),q=N.trim(),B=ie(q,400),j=q!==""&&!Ye(q),U=Ye(B)?B.toLowerCase():void 0,$=U?[{key:`typed:${U}`,kind:"pdb",pdbId:U}]:I.map(sn),V=U?void 0:I[0],x=ft({structures:$,uniprotId:d,feature:t,view:s,preferredTranscriptId:(V?.kind==="dataset"?V.match.transcript?.id():void 0)??o}),J=!!U&&x.pdbEntryError instanceof Error&&"status"in x.pdbEntryError&&x.pdbEntryError.status===404,re=q!==B,z=x.isLoading||re||!U&&!S&&f,X=x.error??(J?x.pdbEntryError:void 0),O=Pr({structureCount:$.length,userSelectedProteinSequence:x.selectedIsoform,selectedTranscript:x.selectedTranscript}),ue=!z&&!X&&!j&&O.length===0,de=$.find(w=>w.kind==="alphafold"),R=U&&(l.isLookupLoading||l.lookupError)?void 0:$[0]?.kind==="alphafold"?$[0].model.accession:$[0]?.kind==="url"?$[0].uniprotId??d:d,se=w=>{C({uniprotId:d,keys:_r(b,w,c)})};return e.createElement("div",{className:u.root},e.createElement(Qr,{lookup:l}),e.createElement("div",{className:u.toolbar},e.createElement("div",{className:u.chips,role:"group","aria-label":"Source"},nn.map(w=>e.createElement(fe,{key:w.filter,"data-testid":`structure-filter-${w.filter}`,label:`${w.label} ${c.filter(ce=>it(ce,w.filter)).length}`,color:g===w.filter?"primary":"default",variant:g===w.filter?"filled":"outlined","aria-pressed":g===w.filter,onClick:()=>{v(w.filter)}}))),e.createElement(_,{size:"small",label:"Open by PDB ID",placeholder:"e.g. 1TUP","data-testid":"pdb-id-input",error:j||J,helperText:j?"Four characters beginning with a digit":J?`RCSB has no entry ${B.toUpperCase()}`:void 0,value:N,onChange:w=>{G(w.target.value)},slotProps:{inputLabel:{shrink:!0}},sx:{width:200}})),e.createElement(zr,{rows:c.filter(w=>it(w,g)),sections:p.sections,geneName:n,checked:U?[]:b,uniprotLength:p.uniprotLength,onToggle:w=>{G(""),se(w)}}),e.createElement("div",{className:u.footer},e.createElement("div",{className:u.summary},e.createElement(y,{variant:"body2","data-testid":"launch-summary"},e.createElement("strong",null,an(I,U,!S&&f))),X?e.createElement(H,{error:X}):null,x.loadingStatuses.map(w=>e.createElement(W,{key:w,variant:"caption",message:w})),e.createElement(ne,{message:x.partialFailure}),x.ranking&&x.selectedTranscript?e.createElement(Te,{val:x.selectedTranscriptId,setVal:x.setSelectedTranscriptId,structureSequence:x.structureSequence,feature:t,isoforms:x.transcripts,ranking:x.ranking,size:"small"}):x.selectedTranscript&&x.selectedIsoform?e.createElement(y,{variant:"caption",color:"textSecondary"},"Mapped through transcript"," ",be(x.selectedTranscript)," (",Fe(x.selectedIsoform.seq).length," aa)"):null,x.sequencesMatch===!1?e.createElement(je,null):null,!z&&!X&&O.length>0?e.createElement(y,{variant:"body2",color:"error"},O.join("; ")):null),e.createElement(ge,{className:u.actions},e.createElement(Z,{control:e.createElement(me,{size:"small",checked:L,"data-testid":"protein-launch-side-by-side",onChange:(w,ce)=>{F(ce),ur(ce)}}),label:e.createElement(y,{variant:"body2"},"Open beside the genome view")}),e.createElement(Mr,{handleClose:a,ready:ue,uniprotId:R,userSelectedProteinSequence:x.selectedIsoform,selectedTranscript:x.selectedTranscript,sources:$.map(to),confidenceUrl:de?.kind==="alphafold"?de.model.confidenceUrl:void 0,feature:t,view:s,session:i,sideBySide:L}))))}),ro=ln;T();var un=xt(()=>import("./HelpDialog-MSZSJO5F.js")),dn=m(function(){let[t,n]=h(!1);return e.createElement(e.Fragment,null,e.createElement(or,{onClick:()=>{n(!0)}},e.createElement(Cr,null)),t?e.createElement(kt,{fallback:null},e.createElement(un,{handleClose:()=>{n(!1)}})):null)}),Ke=dn;T();var cn=m(function({children:t,value:n,index:o,...i}){let s=n===o,[a,u]=h(s);return s&&!a&&u(!0),e.createElement("div",{role:"tabpanel",hidden:!s,...i},a?t:null)}),Ze=cn;T();T();var pn=m(function({choice:t,setChoice:n,structureURL:o,setStructureURL:i,file:s,setFile:a}){return e.createElement("div",{style:{display:"flex",margin:30}},e.createElement(y,null,"Open your structure file ",e.createElement(Ke,null)),e.createElement(he,{component:"fieldset"},e.createElement(De,{value:t,onChange:u=>{n(u.target.value)}},e.createElement(Z,{value:"file",control:e.createElement(te,null),label:"File"}),e.createElement(Z,{value:"url",control:e.createElement(te,null),label:"URL"}))),t==="url"?e.createElement("div",null,e.createElement(y,null,"Open a PDB/mmCIF/etc. file from remote URL"),e.createElement(_,{label:"URL",value:o,onChange:u=>{i(u.target.value)}})):e.createElement("div",{style:{paddingTop:20}},e.createElement(y,null,"Open a PDB/mmCIF/etc. file from your local drive"),e.createElement(A,{variant:"outlined",component:"label"},"Choose file",e.createElement("input",{type:"file",hidden:!0,accept:vr,onChange:({target:u})=>{let l=u.files?.[0];l&&a(l),u.value=""}})),s?e.createElement(y,{variant:"body2"},s.name):null))}),oo=pn;var mn=D()(r=>({dialogContent:{marginTop:r.spacing(6),width:"80em"}})),fn=m(function(){return e.createElement("div",{style:{marginBottom:20}},"Manually supply a protein structure (PDB, mmCIF, etc) for a given transcript. You can open the file from the result of running, for example,"," ",e.createElement(Y,{href:"https://github.com/sokrypton/ColabFold"},"ColabFold"),". This plugin will align the protein sequence calculated from the genome to the protein sequence embedded in the structure file which allows for slight differences in these two representations.")}),gn=m(function({feature:t,preferredTranscriptId:n,session:o,view:i,handleClose:s}){let{classes:a}=mn(),[u,l]=h(),[d,p]=h("file"),[c,g]=h(""),{runLaunch:v,launchError:k,launching:C}=xe(s),S=d==="file"?u:void 0,f=d==="file"?"":c,b=ie(f,600),{sequences:I,isLoading:L,error:F}=Le({file:S,url:b}),{transcripts:N,isoformSequences:G,structureSequence:q,ranking:B,isRanking:j,selectedTranscriptId:U,setSelectedTranscriptId:$,selectedTranscript:V,selectedIsoform:x,error:J,partialFailure:re}=le({feature:t,view:i,structureSequences:I,preferredTranscriptId:n}),z=k??J??F,ue=!!(f||S)&&!!x&&!!V&&!((L||f!==b||j)&&U!==n)&&!(!!F&&f===b)&&!C,de=!!x?.seq&&!!q&&!we(x.seq,q),R=v(async()=>{if(x&&V){let se=S?await He(S):void 0;await Se({session:o,view:i,feature:t,selectedTranscript:V,sources:[{url:f||void 0,data:se}],userProvidedTranscriptSequence:x.seq})}});return e.createElement(e.Fragment,null,e.createElement(Ee,{className:a.dialogContent},z?e.createElement(H,{error:z}):null,e.createElement(fn,null),e.createElement(oo,{choice:d,setChoice:p,structureURL:c,setStructureURL:g,file:u,setFile:l}),e.createElement("div",{style:{margin:20}},L?e.createElement(W,{variant:"subtitle2",message:"Reading residues from the structure"}):null,e.createElement(ne,{message:re}),j?e.createElement(W,{variant:"subtitle2",message:"Aligning isoforms to the structure"}):null,G?B?e.createElement(Te,{val:U,setVal:$,structureSequence:q,isoforms:N,feature:t,ranking:B}):null:e.createElement(W,{title:"Loading protein sequences",variant:"h6"}))),e.createElement(ge,null,de?e.createElement(je,null):null,e.createElement(A,{variant:"contained",color:"secondary",onClick:()=>{s()}},"Cancel"),e.createElement(A,{variant:"contained",color:"primary",disabled:!ue,onClick:()=>{R()}},"Launch 3D protein structure view")))}),no=gn;var hn=m(function({handleClose:t,feature:n,preferredTranscriptId:o,model:i,view:s}){let[a,u]=h(0),l=oe(i),d=Ge(n)||"this gene";return e.createElement(St,{"data-testid":"launch-protein-view-dialog",maxWidth:"xl",title:"Launch protein view",titleNode:e.createElement(e.Fragment,null,"Launch protein view ",e.createElement(Ke,null)),open:!0,onClose:t},e.createElement(ar,{value:a,onChange:(p,c)=>{u(c)}},e.createElement(Ue,{value:0,label:`Structures for ${d}`}),e.createElement(Ue,{value:1,label:"Similar structures (Foldseek)"}),e.createElement(Ue,{value:2,label:"Your file or URL"})),e.createElement(Ze,{value:a,index:0},e.createElement(ro,{session:l,view:s,feature:n,geneName:d,preferredTranscriptId:o,handleClose:t})),e.createElement(Ze,{value:a,index:1},e.createElement(Nr,{session:l,view:s,feature:n,preferredTranscriptId:o,handleClose:t})),e.createElement(Ze,{value:a,index:2},e.createElement(no,{session:l,view:s,feature:n,preferredTranscriptId:o,handleClose:t})))}),Bu=hn;export{Bu as default};
3
+ //# sourceMappingURL=LaunchProteinViewDialog-PCQQI2FP.js.map