PageSourceSearch

https://imodulondb.org/assets/IModulonProteinStructure-DOY0kNWm.js

js imodulondb.org collected 2026-09-28 08:08:04 UTC 5,288 bytes, 1 lines download raw bytes

1import{r,j as e}from"./index-3_RVHvkS.js";const b=({geneTable:d})=>{var w;const[n,v]=r.useState(null),[s,N]=r.useState(null),[u,h]=r.useState(!1),[f,j]=r.useState(null),m=r.useRef(null),p=r.useRef(null),o=r.useMemo(()=>{const a=d.filter(l=>l.uniprot_id&&l.in_imodulon).map(l=>({uniprotId:l.uniprot_id,geneName:l.gene_name&&l.gene_name.toLowerCase()!=="unknown"?l.gene_name:l.gene_locus,geneLocus:l.gene_locus,weight:parseFloat(l.weight)}));if(a.sort((l,x)=>Math.abs(x.weight)-Math.abs(l.weight)),a.length<=1)return a;const t=a[0],i=a.slice(1).sort((l,x)=>l.geneName.toLowerCase().localeCompare(x.geneName.toLowerCase()));return[t,...i]},[d]);r.useEffect(()=>{o.length>0&&!n&&v(o[0].uniprotId)},[o,n]),r.useEffect(()=>{if(!n){h(!1);return}(async()=>{try{h(!0),j(null);const t=await fetch(`https://alphafold.ebi.ac.uk/api/prediction/${n}`);if(!t.ok)throw new Error(`AlphaFold API returned ${t.status}`);const i=await t.json();if(i&&i.length>0)N(i[0]);else throw new Error("No structure data available");h(!1)}catch(t){console.error("Error fetching AlphaFold structure:",t),j(t.message),h(!1)}})()},[n]);const g=async()=>{if(!(s!=null&&s.pdbUrl))return;if(!window.PDBeMolstarPlugin){console.error("❌ PDBeMolstarPlugin not loaded.");return}m.current&&(m.current=null,p.current&&(p.current.innerHTML=""));const a=new window.PDBeMolstarPlugin;m.current=a,a.render(p.current,{customData:{url:s.pdbUrl,format:"pdb",binary:!1},sequencePanel:{enabled:!1},landscape:!0,bgColor:{r:255,g:255,b:255},alphafoldView:!0,hideControls:!0,hideCanvasControls:["expand","selection","animation","controlToggle","controlInfo"],reactive:!0,loadingOverlay:!1,validationAnnotation:!1,domainAnnotation:!1,symmetryAnnotation:!1})};if(r.useEffect(()=>{s!=null&&s.pdbUrl&&g()},[s]),o.length===0)return e.jsxs("div",{className:"alphafold-container",children:[e.jsx("div",{className:"alphafold-header",children:e.jsx("h5",{className:"alphafold-title",children:"AlphaFold Protein Structures"})}),e.jsx("div",{className:"alphafold-content",children:e.jsxs("div",{className:"alphafold-empty-state",children:[e.jsx("div",{className:"alphafold-empty-icon",children:"🧬"}),e.jsx("h6",{className:"alphafold-empty-title",children:"No UniProt Mappings Available"}),e.jsxs("p",{className:"alphafold-empty-text",children:["This iModulon contains ",((w=d==null?void 0:d.filter(a=>a.in_imodulon))==null?void 0:w.length)||0," genes, but none have been mapped to UniProt IDs yet."]}),e.jsx("p",{className:"alphafold-empty-note",children:"UniProt mappings are required to retrieve AlphaFold protein structure predictions."})]})})]});const c=r.useMemo(()=>o.find(a=>a.uniprotId===n),[o,n]);return e.jsxs("div",{className:"alphafold-container",children:[e.jsx("div",{className:"alphafold-header",children:e.jsx("h5",{className:"alphafold-title",children:"AlphaFold Protein Structures"})}),e.jsxs("div",{className:"alphafold-content",children:[e.jsxs("p",{className:"alphafold-description",children:["AlphaFold predicted structures from ",e.jsx("a",{href:"https://alphafold.ebi.ac.uk/",target:"_blank",rel:"noopener noreferrer",children:"AlphaFold Protein Structure Database"}),". Select a gene to view its predicted structure colored by confidence scores."]}),e.jsxs("div",{className:"alphafold-main-layout",children:[e.jsx("div",{className:"alphafold-sidebar",children:e.jsx("div",{className:"alphafold-gene-list",children:o.map((a,t)=>{const i=n===a.uniprotId;return e.jsx("div",{className:`alphafold-gene-card ${i?"selected":""}`,children:e.jsx("button",{className:"alphafold-gene-btn-compact",onClick:()=>v(a.uniprotId),children:e.jsxs("div",{className:"alphafold-card-info",children:[e.jsx("div",{className:"alphafold-card-name",children:a.geneName}),e.jsx("div",{className:"alphafold-card-locus",children:a.uniprotId}),e.jsxs("span",{className:"alphafold-card-weight",children:["w: ",a.weight.toFixed(2)]})]})})},a.uniprotId)})})}),e.jsxs("div",{className:"alphafold-viewer-panel",children:[u&&e.jsx("div",{className:"alphafold-viewer-wrapper",children:e.jsxs("div",{className:"alphafold-viewer-loading",children:[e.jsx("div",{className:"spinner-border text-primary",role:"status",children:e.jsx("span",{className:"sr-only",children:"Loading..."})}
1),e.jsx("p",{style:{marginTop:"15px",color:"#666"},children:"Loading protein structure..."})]})}),f&&!u&&e.jsx("div",{className:"alphafold-viewer-wrapper",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{textAlign:"center",color:"#666"},children:[e.jsx("p",{children:"No protein structure available"}),e.jsx("p",{style:{fontSize:"0.9em",color:"#999"},children:f})]})}),!u&&!f&&s&&c&&e.jsxs("div",{className:"alphafold-viewer-wrapper",children:[e.jsx("div",{ref:p,className:"alphafold-viewer-canvas"}),e.jsxs("div",{className:"alphafold-viewer-info-topleft",children:[e.jsx("div",{className:"alphafold-viewer-gene-name",children:c.geneName}),e.jsx("div",{className:"alphafold-viewer-gene-locus",children:c.uniprotId}),e.jsxs("div",{className:"alphafold-viewer-gene-weight",children:["Weight: ",c.weight.toFixed(3)]})]}),e.jsx("a",{href:`https://alphafold.ebi.ac.uk/entry/${c.uniprotId}`,target:"_blank",rel:"noopener noreferrer",className:"alphafold-view-link",children:"View on AlphaFold →"})]})]})]})]})]})};export{b as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.