gramene-search 1.6.25 → 1.6.27

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.
Binary file
Binary file
@@ -1,2 +1,2 @@
1
- 64260376
2
- 1746630965227134000
1
+ 164935289
2
+ 1749746396350714000
package/dist/index.js CHANGED
@@ -13,6 +13,8 @@ var $gXNCa$reactswitch = require("react-switch");
13
13
  var $gXNCa$reacticonsio5 = require("react-icons/io5");
14
14
  var $gXNCa$reacticonsbs = require("react-icons/bs");
15
15
  var $gXNCa$reacticonsgr = require("react-icons/gr");
16
+ var $gXNCa$reactbootstraptypeahead = require("react-bootstrap-typeahead");
17
+ require("react-bootstrap-typeahead/css/Typeahead.css");
16
18
  var $gXNCa$grameneefpbrowser = require("gramene-efp-browser");
17
19
  var $gXNCa$gramenegenetreevis = require("gramene-genetree-vis");
18
20
  var $gXNCa$lodashkeyBy = require("lodash/keyBy");
@@ -2209,46 +2211,19 @@ var $541b8b0d8c5501d2$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.conn
2209
2211
 
2210
2212
 
2211
2213
 
2214
+
2215
+
2212
2216
 
2213
2217
  function $9e29a4f60318db7a$var$DynamicIframe(props) {
2214
2218
  // Create a ref for the iframe element
2215
2219
  const iframeRef = (0, $gXNCa$react.useRef)(null);
2216
- // Function to resize iframe height
2217
- const resizeIframe = ()=>{
2218
- if (iframeRef.current) {
2219
- const iframe = iframeRef.current;
2220
- const innerDoc = iframe.contentDocument || iframe.contentWindow.document;
2221
- iframe.style.height = 44 + innerDoc.body.scrollHeight + 'px';
2222
- }
2223
- };
2224
- // Resize iframe when content loads
2225
- (0, $gXNCa$react.useEffect)(()=>{
2226
- resizeIframe();
2227
- }, []); // Empty dependency array ensures it only runs once after initial render
2228
- // Optional: Resize iframe when window is resized
2229
- (0, $gXNCa$react.useEffect)(()=>{
2230
- window.addEventListener('resize', resizeIframe);
2231
- return ()=>{
2232
- window.removeEventListener('resize', resizeIframe);
2233
- };
2234
- }, []); // Empty dependency array ensures it only runs once after initial render
2235
- // Resize iframe when content changes
2220
+ const [iframeHeight, setIframeHeight] = (0, $gXNCa$react.useState)(500); // Default height
2236
2221
  (0, $gXNCa$react.useEffect)(()=>{
2237
- const iframe = iframeRef.current;
2238
- if (!iframe) return;
2239
- const observer = new MutationObserver(resizeIframe);
2240
- const checkElement = ()=>{
2241
- const innerDoc = iframe.contentDocument || iframe.contentWindow.document;
2242
- const targetElement = innerDoc.querySelector('#heatmapContainer');
2243
- if (targetElement) observer.observe(targetElement, {
2244
- attributes: true,
2245
- childList: true,
2246
- subtree: true
2247
- });
2248
- else setTimeout(checkElement, 200); // Check again after 100 milliseconds
2222
+ const handleMessage = (event)=>{
2223
+ if (event.data.type === 'heightChange') setIframeHeight(event.data.height + 44);
2249
2224
  };
2250
- checkElement();
2251
- return ()=>observer.disconnect();
2225
+ window.addEventListener("message", handleMessage);
2226
+ return ()=>window.removeEventListener("message", handleMessage);
2252
2227
  }, []);
2253
2228
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("iframe", {
2254
2229
  ref: iframeRef,
@@ -2256,6 +2231,7 @@ function $9e29a4f60318db7a$var$DynamicIframe(props) {
2256
2231
  title: "Dynamic Iframe",
2257
2232
  style: {
2258
2233
  width: '100%',
2234
+ height: `${iframeHeight}px`,
2259
2235
  border: 'none'
2260
2236
  }
2261
2237
  });
@@ -2271,7 +2247,11 @@ const $9e29a4f60318db7a$var$Detail = (props)=>{
2271
2247
  (0, $gXNCa$react.useEffect)(()=>{
2272
2248
  const tid = Math.floor(gene.taxon_id / 1000);
2273
2249
  if (props.expressionStudies[tid]) {
2274
- let eList = props.expressionStudies[tid].filter((e)=>e.type === "Baseline");
2250
+ let eList = props.expressionStudies[tid];
2251
+ if (props.searchResult.hasOwnProperty('expressed_in_gxa_attr_ss')) {
2252
+ const in_gxa = new Set(props.searchResult.expressed_in_gxa_attr_ss);
2253
+ eList = props.expressionStudies[tid].filter((e)=>in_gxa.has(e._id));
2254
+ }
2275
2255
  setAtlasExperimentList(eList);
2276
2256
  let refExp = eList.filter((e)=>e.isRef);
2277
2257
  if (refExp.length === 1) setAtlasExperiment(refExp[0]._id);
@@ -2282,10 +2262,12 @@ const $9e29a4f60318db7a$var$Detail = (props)=>{
2282
2262
  props.expressionStudies
2283
2263
  ]);
2284
2264
  let paralogs_url;
2285
- let gene_url = `/static/atlasWidget.html?genes=${gene.atlas_id || gene._id}&localAPI=${isLocal}`;
2265
+ let gene_url = `https://dev.gramene.org/static/atlasWidget.html?genes=${gene.atlas_id || gene._id}&experiment=${atlasExperiment}&localAPI=${isLocal}`;
2286
2266
  let paralogs = [];
2287
2267
  if (gene.homology && gene.homology.homologous_genes && gene.homology.homologous_genes.within_species_paralog) paralogs = gene.homology.homologous_genes.within_species_paralog;
2288
- if (paralogs.length > 1 && atlasExperiment) paralogs_url = `/static/atlasWidget.html?genes=${paralogs.join(' ')}&experiment=${atlasExperiment}&localAPI=${isLocal}`;
2268
+ if (paralogs.length > 1 && atlasExperiment) paralogs_url = `https://dev.gramene.org/static/atlasWidget.html?genes=${paralogs.join(' ')}&experiment=${atlasExperiment}&localAPI=${isLocal}`;
2269
+ const ref = (0, $gXNCa$react.useRef)(null);
2270
+ const ref2 = (0, $gXNCa$react.useRef)(null);
2289
2271
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Tabs), {
2290
2272
  children: [
2291
2273
  paralogs_url && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Tab), {
@@ -2293,39 +2275,21 @@ const $9e29a4f60318db7a$var$Detail = (props)=>{
2293
2275
  eventKey: "paralogs",
2294
2276
  title: `Paralogs`,
2295
2277
  children: [
2296
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Form), {
2297
- children: [
2298
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Form).Check, {
2299
- type: "switch",
2300
- id: "localAPI",
2301
- label: "Local API",
2302
- checked: isLocal,
2303
- onChange: handleLocalAPIChange
2304
- }),
2305
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Form).Group, {
2306
- as: (0, $gXNCa$reactbootstrap.Row),
2307
- className: "mb-3",
2308
- controlId: "formGroupExperiment",
2309
- children: [
2310
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Form).Label, {
2311
- column: true,
2312
- sm: 1,
2313
- children: "Experiment"
2314
- }),
2315
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Col), {
2316
- sm: 5,
2317
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Form).Select, {
2318
- defaultValue: atlasExperiment,
2319
- onChange: (e)=>setAtlasExperiment(e.target.value),
2320
- children: atlasExperimentList.map((experiment, index)=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("option", {
2321
- value: experiment._id,
2322
- children: experiment.description || experiment._id
2323
- }, index))
2324
- })
2325
- })
2326
- ]
2327
- })
2328
- ]
2278
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstraptypeahead.Typeahead), {
2279
+ clearButton: true,
2280
+ size: "sm",
2281
+ id: "experiment-selector",
2282
+ ref: ref,
2283
+ labelKey: "experiment",
2284
+ onChange: (exps)=>{
2285
+ if (exps.length > 0) {
2286
+ setAtlasExperiment(exps[0]._id);
2287
+ setTimeout(()=>ref.current?.clear(), 2000);
2288
+ }
2289
+ },
2290
+ placeholder: "Choose an experiment...",
2291
+ options: atlasExperimentList,
2292
+ labelKey: (experiment)=>`${experiment.type}: ${experiment.description || experiment._id}`
2329
2293
  }),
2330
2294
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($9e29a4f60318db7a$var$DynamicIframe, {
2331
2295
  url: paralogs_url
@@ -2337,12 +2301,21 @@ const $9e29a4f60318db7a$var$Detail = (props)=>{
2337
2301
  eventKey: "gene",
2338
2302
  title: "All Studies",
2339
2303
  children: [
2340
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Form).Check, {
2341
- type: "switch",
2342
- id: "localAPI",
2343
- label: "Local API",
2344
- checked: isLocal,
2345
- onChange: handleLocalAPIChange
2304
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstraptypeahead.Typeahead), {
2305
+ clearButton: true,
2306
+ size: "sm",
2307
+ id: "experiment-selector2",
2308
+ ref: ref,
2309
+ labelKey: "experiment",
2310
+ onChange: (exps)=>{
2311
+ if (exps.length > 0) {
2312
+ setAtlasExperiment(exps[0]._id);
2313
+ setTimeout(()=>ref.current?.clear(), 2000);
2314
+ }
2315
+ },
2316
+ placeholder: "Choose an experiment...",
2317
+ options: atlasExperimentList,
2318
+ labelKey: (experiment)=>`${experiment.type}: ${experiment.description || experiment._id}`
2346
2319
  }),
2347
2320
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($9e29a4f60318db7a$var$DynamicIframe, {
2348
2321
  url: gene_url
@@ -2360,8 +2333,9 @@ const $9e29a4f60318db7a$var$Detail = (props)=>{
2360
2333
  ]
2361
2334
  });
2362
2335
  };
2363
- var $9e29a4f60318db7a$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.connect)(// 'selectParalogExpression',
2364
- 'selectExpressionStudies', 'doRequestParalogExpression', $9e29a4f60318db7a$var$Detail);
2336
+ var $9e29a4f60318db7a$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.connect)(//'selectParalogExpression',
2337
+ 'selectExpressionStudies', //'doRequestParalogExpression',
2338
+ $9e29a4f60318db7a$var$Detail);
2365
2339
 
2366
2340
 
2367
2341