@rcsb/rcsb-statistics 0.3.42 → 0.3.43

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcsb/rcsb-statistics",
3
- "version": "0.3.42",
3
+ "version": "0.3.43",
4
4
  "private": false,
5
5
  "files": [
6
6
  "build"
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_rcsb_rcsb_statistics=self.webpackChunk_rcsb_rcsb_statistics||[]).push([[317],{7317(e,t,r){r.r(t),r.d(t,{default:()=>C});var a=r(6540),n=r(3679),l=r(7638);const o=async(e,t)=>{var r;return(async(e,t)=>{const r="".concat(t.replace(/\/$/,""),"/rcsbsearch/v2/query"),a=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!a.ok)throw new Error(a.statusText);return a.json()})(e,null==t||null===(r=t.config)||void 0===r?void 0:r.searchApiUrl)},i={request_info:{query_id:"ligand_complex_stats_any_ligand",src:"ui"},request_options:{results_content_type:["experimental"]},return_type:"entry",query:{type:"terminal",service:"text",parameters:{attribute:"rcsb_entry_info.nonpolymer_entity_count",operator:"greater",value:0}}},s=[i,{request_info:{query_id:"ligand_complex_stats_mv100",src:"ui"},return_type:"entry",request_options:{results_content_type:["experimental"]},query:{type:"group",logical_operator:"and",nodes:[i.query,{type:"terminal",service:"text_chem",parameters:{attribute:"chem_comp.formula_weight",operator:"range",value:{from:100,to:300,include_lower:!0,include_upper:!0}}}]}},{request_info:{query_id:"ligand_complex_stats_mv300",src:"ui"},return_type:"entry",request_options:{results_content_type:["experimental"]},query:{type:"group",logical_operator:"and",nodes:[i.query,{type:"terminal",service:"text_chem",parameters:{attribute:"chem_comp.formula_weight",operator:"range",value:{from:300,to:500,include_lower:!0,include_upper:!0}}}]}},{request_info:{query_id:"ligand_complex_stats_mv500",src:"ui"},return_type:"entry",request_options:{results_content_type:["experimental"]},query:{type:"group",logical_operator:"and",nodes:[i.query,{type:"terminal",service:"text_chem",parameters:{attribute:"chem_comp.formula_weight",operator:"range",value:{from:500,to:1200,include_lower:!0,include_upper:!0}}}]}},{request_info:{query_id:"ligand_complex_stats_loi",src:"ui"},return_type:"entry",request_options:{results_content_type:["experimental"]},query:{type:"group",logical_operator:"and",nodes:[{type:"terminal",service:"text",parameters:{attribute:"rcsb_nonpolymer_entity_annotation.comp_id",operator:"exists"}},{type:"terminal",service:"text",parameters:{attribute:"rcsb_nonpolymer_entity_annotation.type",operator:"exact_match",value:"SUBJECT_OF_INVESTIGATION"}}]}},{request_info:{query_id:"ligand_complex_stats_bird",src:"ui"},return_type:"entry",request_options:{results_content_type:["experimental"]},query:{type:"terminal",service:"text_chem",parameters:{attribute:"pdbx_reference_molecule.prd_id",operator:"exists"}}},{request_info:{query_id:"ligand_complex_stats_branched_entities",src:"ui"},return_type:"entry",request_options:{results_content_type:["experimental"]},query:{type:"terminal",service:"text",parameters:{attribute:"pdbx_entity_branch.type",operator:"exact_match",value:"oligosaccharide"}}}],c=["structures with any non-polymer small molecules","structures with non-polymer small molecules of 100-300 Da","structures with non-polymer small molecules of 300-500 Da","structures with non-polymer small molecules of 500-1200 Da","structures with author-designated Ligand/s of Interest","structures with a biologically interesting short oligomer or oligomer-like BIRD molecules","structures with branched entities of oligosaccharides"],u={request_options:{paginate:{start:0,rows:0},results_content_type:["experimental"],facets:[{filter:{type:"terminal",service:"text",parameters:{attribute:"exptl.method",operator:"exact_match",value:"ELECTRON MICROSCOPY"}},facets:[{filter:{type:"terminal",service:"text",parameters:{attribute:"pdbx_database_related.content_type",operator:"exact_match",value:"associated EM volume"}},facets:[{filter:{type:"terminal",service:"text",parameters:{attribute:"pdbx_database_related.db_name",operator:"exact_match",value:"EMDB"}},facets:[{name:"pdbx_database_related.db_id",aggregation_type:"cardinality",attribute:"pdbx_database_related.db_id"}]}]}]}]},return_type:"entry"},p={query:{type:"group",logical_operator:"and",nodes:[{type:"group",logical_operator:"and",nodes:[{type:"terminal",service:"text",parameters:{operator:"exact_match",value:"ELECTRON MICROSCOPY",attribute:"exptl.method"}},{type:"terminal",service:"text",parameters:{operator:"exact_match",value:"EMDB",attribute:"pdbx_database_related.db_name"}},{type:"terminal",service:"text",parameters:{operator:"exact_match",value:"associated EM volume",attribute:"pdbx_database_related.content_type"}}]}]},return_type:"entry",request_options:{results_content_type:["experimental"]}},m=[{key:"exptl-data-counts-info",title:"Experimental Data Counts Info",description:"Experimental Data Counts Info Description",return_type:"entry",facets:[{name:"rcsb_repository_holdings_current.repository_content_types",aggregation_type:"terms",attribute:"rcsb_repository_holdings_current.repository_content_types"}]}],d=e=>{const t={type:"group",logical_operator:"and",nodes:[{type:"terminal",service:"text",parameters:{attribute:"rcsb_repository_holdings_current.repository_content_types",operator:"exact_match",value:e}}]},r={};return r.query=t,r.return_type="entry",r.request_info={src:"ui",query_id:"stats"},encodeURIComponent(JSON.stringify(r))},y={return_type:"entry",request_options:{facets:[{name:"rcsb_entry_info.experimental_method",aggregation_type:"terms",attribute:"rcsb_entry_info.experimental_method",facets:[{name:"rcsb_entry_info.selected_polymer_entity_types",aggregation_type:"terms",attribute:"rcsb_entry_info.selected_polymer_entity_types"}]}],paginate:{start:0,rows:0}}};function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,l,o,i=[],s=!0,c=!1;try{if(l=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(a=l.call(r)).done)&&(i.push(a.value),i.length!==t);s=!0);}catch(e){c=!0,n=e}finally{try{if(!s&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=Array(t);r<t;r++)a[r]=e[r];return a}const b=e=>e instanceof Error?e.message:String(e);var f,g,v,x=r(6637);function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=Array(t);r<t;r++)a[r]=e[r];return a}function w(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const N=["Protein (only)","Protein/Oligosaccharide","Protein/NA","Nucleic acid (only)","Other","Oligosaccharide (only)"],q=n.Ay.h1(f||(f=w(["\n display: block;\n font-size: 18px;\n font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;\n font-weight: bold;\n color: #333;\n padding-top: 0;\n padding-bottom: 15px;\n text-align: start;\n margin-top: -2px;\n margin-bottom: 0;\n"]))),S=n.Ay.div(g||(g=w(["\n display: flex;\n align-items: baseline;\n gap: 4px;\n flex-wrap: wrap;\n margin-bottom: 4px;\n"]))),M=n.Ay.a(v||(v=w(["\n display: inline-block;\n min-width: 80px;\n text-align: right;\n"]))),I=e=>{let t=e.count,r=void 0===t?3:t;return a.createElement(a.Fragment,null,Array.from({length:r},(e,t)=>a.createElement(x.kD,{key:"summary-loading-row-".concat(t)})))},D=e=>[...e].sort((e,t)=>{var r,a;return Number(null!==(r=t.population)&&void 0!==r?r:0)-Number(null!==(a=e.population)&&void 0!==a?a:0)}),C=()=>{const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;const t=(0,l.t)().settings,r=_((0,a.useState)([]),2),n=r[0],i=r[1],h=_((0,a.useState)([]),2),f=h[0],g=h[1],v=_((0,a.useState)(null),2),x=v[0],E=v[1],w=_((0,a.useState)([]),2),N=w[0],q=w[1],S=_((0,a.useState)(!0),2),M=S[0],I=S[1],D=_((0,a.useState)(null),2),C=D[0],U=D[1];return(0,a.useEffect)(()=>{let r=!1;return(async()=>{const a=Math.max(1,Math.floor(Number.isFinite(e)?e:3)),n=new Array(s.length);let l,_,h=null,f=null;const v=()=>{f&&!r&&g(((e,t)=>{const r=[];return e.forEach(e=>{"structure factors"===e.label?r.push({label:"have a structure factor file",population:e.population,searchUrl:d(e.label)}):"NMR restraints V1"===e.label?r.push({label:"have an NMR restraint file",population:e.population,searchUrl:d(e.label)}):"NMR chemical shifts"===e.label?r.push({label:"have a chemical shifts file",population:e.population,searchUrl:d(e.label)}):"Combined NMR data (NEF)"===e.label&&r.push({label:"have NMR unified data files (NEF and/or NMR-STAR format files)",population:e.population,searchUrl:d(e.label)})}),t&&r.push({label:t.label,population:t.population,searchUrl:encodeURIComponent(JSON.stringify(t.searchUrl))}),r})(f,null!=h?h:void 0))},x=()=>{void 0===l||void 0===_||r||(h={label:"PDB structures were determined using ".concat(_.toLocaleString("en-US")," 3DEM maps"),population:l,searchUrl:p},E(h),v())},w=m[0],N={return_type:w.return_type||"entry",request_options:{paginate:{rows:0},facets:w.facets}},S=y,M=s.map((e,a)=>({label:c[a],run:async()=>{var l;const s=await o(e,t);r||(n[a]={label:c[a],population:Number(null!==(l=s.total_count)&&void 0!==l?l:0),searchUrl:e},i(n.filter(Boolean)))}})),D=[{label:"experimental data counts",run:async()=>{var e,a;const n=await o(N,t);r||(f=null!==(e=null==n||null===(a=n.facets)||void 0===a||null===(a=a[0])||void 0===a?void 0:a.buckets)&&void 0!==e?e:[],v())}},{label:"summary holdings data",run:async()=>{var e,a;const n=await o(S,t);if(r)return;const l=null!==(e=null==n||null===(a=n.facets)||void 0===a||null===(a=a[0])||void 0===a?void 0:a.buckets)&&void 0!==e?e:[];q(l)}},M[0],{label:"EMDB-associated PDB structures",run:async()=>{var e;const a=await o(p,t);r||(l=Number(null!==(e=a.total_count)&&void 0!==e?e:0),x())}},{label:"unique 3DEM maps",run:async()=>{var e,a;const n=await o(u,t);r||(_=Number(null!==(e=null==n||null===(a=n.facets)||void 0===a||null===(a=a[0])||void 0===a?void 0:a.value)&&void 0!==e?e:0),x())}},...M.slice(1)].filter(e=>Boolean(e));let C=D.length;I(!0),U(null),i([]),g([]),E(null),await(async()=>{let e=0;const t=Math.min(a,D.length);if(0===t)return void I(!1);const n=Array.from({length:t},async()=>{for(;!r;){const t=e;e+=1;const a=D[t];if(!a)return;try{await a.run()}catch(e){r||U(t=>{const r="".concat(a.label,": ").concat(b(e));return t?"".concat(t,"; ").concat(r):r})}finally{r||(C-=1,0===C&&I(!1))}}});await Promise.all(n)})()})().catch(e=>{r||(U(b(e)),I(!1))}),()=>{r=!0}},[t,e]),{ligandInfo:n,exptlInfo:f,emCounts:x,holdingsChartData:N,loading:M,error:C}}(3),t=e.ligandInfo,r=e.exptlInfo,n=e.emCounts,i=e.holdingsChartData,h=e.loading,f=e.error,g=e=>encodeURIComponent(JSON.stringify(e||{})),v=Boolean(n),x=(0,a.useMemo)(()=>D(r),[r]),w=(0,a.useMemo)(()=>D(t),[t]),C=Math.max(0,s.length-t.length),U=(R=(0,a.useState)({columnIndex:1,direction:"desc"}),j=2,function(e){if(Array.isArray(e))return e}(R)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,l,o,i=[],s=!0,c=!1;try{if(l=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(a=l.call(r)).done)&&(i.push(a.value),i.length!==t);s=!0);}catch(e){c=!0,n=e}finally{try{if(!s&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw n}}return i}}(R,j)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(e,t):void 0}}(R,j)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),T=U[0],A=U[1],O=(e,t)=>({type:"terminal",service:"text",parameters:{attribute:e,operator:"exact_match",value:t}}),k=e=>"/search?request=".concat(g((e=>({query:1===e.length?e[0]:{type:"group",logical_operator:"and",nodes:e},return_type:"entry",request_info:{src:"ui",query_id:"stats"}}))(e))),B=e=>{A(t=>t.columnIndex===e?{columnIndex:e,direction:"desc"===t.direction?"asc":"desc"}:{columnIndex:e,direction:"desc"})},P=(0,a.useMemo)(()=>{const e=N.map(e=>{const t=i.map(t=>((e,t)=>{var r,a,n;const l=(null!==(r=null==e||null===(a=e.facets)||void 0===a||null===(a=a[0])||void 0===a?void 0:a.buckets)&&void 0!==r?r:[]).find(e=>e.label===t);return l?Number(null!==(n=l.population)&&void 0!==n?n:0):0})(t,e));return{molecularType:e,rowCounts:t,rowTotal:t.reduce((e,t)=>e+t,0)}}),t=T.columnIndex;return 0===t?[...e].sort((e,t)=>e.molecularType<t.molecularType?"asc"===T.direction?-1:1:e.molecularType>t.molecularType?"asc"===T.direction?1:-1:0):[...e].sort((e,r)=>{var a,n;const l=null!==(a=e.rowCounts[t-1])&&void 0!==a?a:0,o=null!==(n=r.rowCounts[t-1])&&void 0!==n?n:0;return"asc"===T.direction?l-o:o-l})},[i,T]);var R,j;return a.createElement("div",null,a.createElement(q,null,"PDB Data Distribution Summary"),f&&a.createElement("p",{style:{color:"red"}},f),a.createElement("div",{className:"table-responsive"},a.createElement("table",{className:"table table-condensed table-bordered dt-responsive nowrap",cellSpacing:0,width:"100%"},a.createElement("thead",null,a.createElement("tr",{className:"light-gray"},a.createElement("th",{onClick:()=>B(0),style:{cursor:"pointer"}},"Molecular Type",0===T.columnIndex?"desc"===T.direction?" ▼":" ▲":""),i.map((e,t)=>a.createElement("th",{key:t,className:"text-end",onClick:()=>B(t+1),style:{cursor:"pointer"}},e.label,T.columnIndex===t+1?"desc"===T.direction?" ▼":" ▲":"")),a.createElement("th",{className:"fw-bold text-end"},"Total"))),a.createElement("tbody",null,P.map(e=>{return a.createElement("tr",{key:e.molecularType},a.createElement("td",null,e.molecularType),e.rowCounts.map((t,r)=>{return a.createElement("td",{key:"".concat(e.molecularType,"-").concat(r),className:"text-end"},t>0?a.createElement("a",{href:(n=i[r].label,l=e.molecularType,k([O("rcsb_entry_info.experimental_method",n),O("rcsb_entry_info.selected_polymer_entity_types",l)]))},t.toLocaleString("en-US")):0);var n,l}),a.createElement("td",{className:"text-end"},a.createElement("a",{href:(t=e.molecularType,k([O("rcsb_entry_info.selected_polymer_entity_types",t)]))},e.rowTotal.toLocaleString("en-US"))));var t})),a.createElement("tfoot",null,a.createElement("tr",{className:"table-light fw-bold"},a.createElement("th",{scope:"row"},"Total"),i.map((e,t)=>{var r,n;return a.createElement("td",{key:t,className:"text-end"},a.createElement("a",{href:(n=e.label,k([O("rcsb_entry_info.experimental_method",n)]))},Number(null!==(r=e.population)&&void 0!==r?r:0).toLocaleString("en-US")))}),a.createElement("td",{className:"text-end"},i.reduce((e,t)=>{var r;return e+Number(null!==(r=t.population)&&void 0!==r?r:0)},0).toLocaleString("en-US")))))),a.createElement("div",{className:"row",style:{marginTop:"10px"}},a.createElement("div",{className:"col-lg-12 col-md-12 col-sm-12"},a.createElement("p",null,a.createElement("strong",null,"Multiple Methods:")," Atomic structures substantially underpinned by more than one experimental method currently supported by the PDB archive (NMR, 3DEM, or crystallography/diffraction) with or without some additional data provided by currently unsupported methods."),a.createElement("p",null,a.createElement("strong",null,"Integrative Methods:")," Atomic structures with all data coming from currently unsupported methods by the PDB, or only partially underpinned by an experimental method currently supported by the PDB, or partially/entirely non-atomic structures supported by the PDB-IHM."))),a.createElement("div",{className:"row"},a.createElement("div",{className:"col-lg-6 col-md-6 col-sm-12"},a.createElement("h4",null,"PDB Structures with Experimental Data"),a.createElement("div",{className:"list-group"},r&&r.length>0?a.createElement(a.Fragment,null,x.map((e,t)=>a.createElement(S,{key:t},a.createElement(M,{href:"/search?request=".concat("string"==typeof e.searchUrl?e.searchUrl:g(e.searchUrl))},Number(e.population).toLocaleString("en-US")),a.createElement("span",null,e.label))),h&&!v&&a.createElement(I,{count:1})):h?a.createElement(I,null):a.createElement("div",null,"No experimental data counts available."))),a.createElement("div",{className:"col-lg-6 col-md-6 col-sm-12"},a.createElement("h4",null,"PDB Structures with Small Molecule Data"),a.createElement("div",{className:"list-group"},t&&t.length>0?a.createElement(a.Fragment,null,w.map((e,t)=>a.createElement(S,{key:t},a.createElement(M,{href:"/search?request=".concat("string"==typeof e.searchUrl?e.searchUrl:g(e.searchUrl))},Number(e.population).toLocaleString("en-US")),a.createElement("span",null,e.label))),h&&C>0&&a.createElement(I,{count:Math.min(3,C)})):h?a.createElement(I,null):a.createElement("div",null,"No ligand data available.")))))}}}]);