gramene-search 1.6.22 → 1.6.25

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
- 88241069
2
- 1741125262813958000
1
+ 64260376
2
+ 1746630965227134000
package/dist/index.js CHANGED
@@ -142,7 +142,8 @@ $9d9aeaf9299e61a1$var$grameneSuggestions.selectGrameneSuggestionsStatus = (0, $g
142
142
  if (!queryString) return '';
143
143
  if (shouldUpdate) return 'update needed';
144
144
  if (isLoading) return 'loading';
145
- if (suggestionsRaw) return suggestionsRaw.data.grouped.category.matches + ' terms';
145
+ if (suggestionsRaw.data) return suggestionsRaw.data.grouped.category.matches + ' terms';
146
+ console.error(suggestionsRaw);
146
147
  return 'error';
147
148
  });
148
149
  $9d9aeaf9299e61a1$var$grameneSuggestions.selectGrameneSuggestionsReady = (0, $gXNCa$reduxbundler.createSelector)('selectGrameneSuggestionsStatus', (status)=>{
@@ -2261,30 +2262,93 @@ function $9e29a4f60318db7a$var$DynamicIframe(props) {
2261
2262
  }
2262
2263
  const $9e29a4f60318db7a$var$Detail = (props)=>{
2263
2264
  const gene = props.geneDocs[props.searchResult.id];
2265
+ const [atlasExperiment, setAtlasExperiment] = (0, $gXNCa$react.useState)(null);
2266
+ const [atlasExperimentList, setAtlasExperimentList] = (0, $gXNCa$react.useState)([]);
2267
+ const [isLocal, setIsLocal] = (0, $gXNCa$react.useState)(false);
2268
+ const handleLocalAPIChange = (event)=>{
2269
+ setIsLocal(event.target.checked);
2270
+ };
2271
+ (0, $gXNCa$react.useEffect)(()=>{
2272
+ const tid = Math.floor(gene.taxon_id / 1000);
2273
+ if (props.expressionStudies[tid]) {
2274
+ let eList = props.expressionStudies[tid].filter((e)=>e.type === "Baseline");
2275
+ setAtlasExperimentList(eList);
2276
+ let refExp = eList.filter((e)=>e.isRef);
2277
+ if (refExp.length === 1) setAtlasExperiment(refExp[0]._id);
2278
+ else // no reference experiment - choose first
2279
+ setAtlasExperiment(eList[0]._id);
2280
+ }
2281
+ }, [
2282
+ props.expressionStudies
2283
+ ]);
2264
2284
  let paralogs_url;
2265
- let gene_url = `/static/atlasWidget.html?reference=0&genes=${gene.atlas_id || gene._id}`;
2266
- if (props.paralogExpression && props.paralogExpression[gene._id]) {
2267
- let paralogs = props.paralogExpression[gene._id].map((p)=>p.atlas_id || p.id);
2268
- if (paralogs.length > 1) paralogs_url = `/static/atlasWidget.html?reference=1&genes=${paralogs.join(' ')}`;
2269
- } else props.doRequestParalogExpression(gene._id);
2285
+ let gene_url = `/static/atlasWidget.html?genes=${gene.atlas_id || gene._id}&localAPI=${isLocal}`;
2286
+ let paralogs = [];
2287
+ 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}`;
2270
2289
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Tabs), {
2271
2290
  children: [
2272
- paralogs_url && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Tab), {
2291
+ paralogs_url && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Tab), {
2273
2292
  tabClassName: "gxa",
2274
2293
  eventKey: "paralogs",
2275
- title: "Reference Study (all paralogs)",
2276
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($9e29a4f60318db7a$var$DynamicIframe, {
2277
- url: paralogs_url
2278
- })
2279
- }),
2280
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Tab), {
2294
+ title: `Paralogs`,
2295
+ 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
+ ]
2329
+ }),
2330
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($9e29a4f60318db7a$var$DynamicIframe, {
2331
+ url: paralogs_url
2332
+ })
2333
+ ]
2334
+ }, "gxaparalogs"),
2335
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Tab), {
2281
2336
  tabClassName: "gxa",
2282
2337
  eventKey: "gene",
2283
2338
  title: "All Studies",
2284
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($9e29a4f60318db7a$var$DynamicIframe, {
2285
- url: gene_url
2286
- })
2287
- }),
2339
+ 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
2346
+ }),
2347
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($9e29a4f60318db7a$var$DynamicIframe, {
2348
+ url: gene_url
2349
+ })
2350
+ ]
2351
+ }, "gxa"),
2288
2352
  (0, $gXNCa$grameneefpbrowser.haveBAR)(gene) && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Tab), {
2289
2353
  tabClassName: "eFP",
2290
2354
  eventKey: "eFP",
@@ -2292,11 +2356,12 @@ const $9e29a4f60318db7a$var$Detail = (props)=>{
2292
2356
  children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, ($parcel$interopDefault($gXNCa$grameneefpbrowser))), {
2293
2357
  gene: gene
2294
2358
  })
2295
- })
2359
+ }, "bar")
2296
2360
  ]
2297
2361
  });
2298
2362
  };
2299
- var $9e29a4f60318db7a$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.connect)('selectParalogExpression', 'doRequestParalogExpression', $9e29a4f60318db7a$var$Detail);
2363
+ var $9e29a4f60318db7a$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.connect)(// 'selectParalogExpression',
2364
+ 'selectExpressionStudies', 'doRequestParalogExpression', $9e29a4f60318db7a$var$Detail);
2300
2365
 
2301
2366
 
2302
2367
 
@@ -5517,17 +5582,38 @@ var $261baeb81c4d4d8a$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.conn
5517
5582
  const $0f50f369018a42ef$var$auth = (0, $gXNCa$firebaseauth.getAuth)((0, $047461923b1badda$export$a4e2c8f07e884e));
5518
5583
  const $0f50f369018a42ef$var$MAX_GENE_IDS = 1000; // Define the maximum number of gene IDs allowed
5519
5584
  const $0f50f369018a42ef$var$GeneListDisplayComponent = (props)=>{
5520
- const [savedGeneLists, setSavedGeneLists] = (0, $gXNCa$react.useState)([]);
5585
+ const [publicGeneLists, setPublicGeneLists] = (0, $gXNCa$react.useState)([]);
5586
+ const [privateGeneLists, setPrivateGeneLists] = (0, $gXNCa$react.useState)([]);
5521
5587
  const [error, setError] = (0, $gXNCa$react.useState)(null);
5522
5588
  const [user, setUser] = (0, $gXNCa$react.useState)({});
5523
5589
  (0, $gXNCa$firebaseauth.onAuthStateChanged)($0f50f369018a42ef$var$auth, (user)=>setUser(user));
5590
+ const fetchPrivateGeneLists = async ()=>{
5591
+ try {
5592
+ const token = await user.getIdToken();
5593
+ // Replace this with actual fetch from your backend or storage
5594
+ const response = await fetch(`${props.api}/gene_lists?site=${props.site}&isPublic=false`, {
5595
+ method: 'GET',
5596
+ headers: {
5597
+ "Content-Type": "application/json",
5598
+ "Authorization": `Bearer ${token}`
5599
+ }
5600
+ });
5601
+ const result = await response.json();
5602
+ if (response.ok) {
5603
+ setError(null);
5604
+ setPrivateGeneLists(result); // array of saved gene lists
5605
+ } else setError('Error fetching gene lists.');
5606
+ } catch (err) {
5607
+ setError('Failed to fetch private gene lists. Please try again later.');
5608
+ }
5609
+ };
5524
5610
  // Fetch saved gene lists from a backend or local storage
5525
- const fetchSavedGeneLists = async ()=>{
5611
+ const fetchPublicGeneLists = async ()=>{
5526
5612
  try {
5527
5613
  // Replace this with actual fetch from your backend or storage
5528
- const response = await fetch(`${props.api}/gene-lists`);
5614
+ const response = await fetch(`${props.api}/gene_lists?site=${props.site}&isPublic=true`);
5529
5615
  const result = await response.json();
5530
- if (response.ok) setSavedGeneLists(result.savedLists); // Assuming savedLists is an array of saved gene lists
5616
+ if (response.ok) setPublicGeneLists(result); // array of saved gene lists
5531
5617
  else setError('Error fetching gene lists.');
5532
5618
  } catch (err) {
5533
5619
  setError('Failed to fetch gene lists. Please try again later.');
@@ -5535,8 +5621,13 @@ const $0f50f369018a42ef$var$GeneListDisplayComponent = (props)=>{
5535
5621
  };
5536
5622
  // Fetch data when the component is mounted
5537
5623
  (0, $gXNCa$react.useEffect)(()=>{
5538
- fetchSavedGeneLists();
5624
+ fetchPublicGeneLists();
5539
5625
  }, []);
5626
+ (0, $gXNCa$react.useEffect)(()=>{
5627
+ fetchPrivateGeneLists();
5628
+ }, [
5629
+ user
5630
+ ]);
5540
5631
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
5541
5632
  className: "gene-list-display-component",
5542
5633
  children: [
@@ -5547,7 +5638,7 @@ const $0f50f369018a42ef$var$GeneListDisplayComponent = (props)=>{
5547
5638
  variant: "danger",
5548
5639
  children: error
5549
5640
  }),
5550
- savedGeneLists.length > 0 ? /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Table), {
5641
+ privateGeneLists.length > 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Table), {
5551
5642
  striped: true,
5552
5643
  bordered: true,
5553
5644
  hover: true,
@@ -5569,13 +5660,13 @@ const $0f50f369018a42ef$var$GeneListDisplayComponent = (props)=>{
5569
5660
  })
5570
5661
  }),
5571
5662
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("tbody", {
5572
- children: savedGeneLists.map((list, index)=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("tr", {
5663
+ children: privateGeneLists.map((list, index)=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("tr", {
5573
5664
  children: [
5574
5665
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
5575
- children: list.name
5666
+ children: list.label
5576
5667
  }),
5577
5668
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
5578
- children: list.genes.length
5669
+ children: list.hash
5579
5670
  }),
5580
5671
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("td", {
5581
5672
  children: [
@@ -5586,7 +5677,57 @@ const $0f50f369018a42ef$var$GeneListDisplayComponent = (props)=>{
5586
5677
  }),
5587
5678
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Button), {
5588
5679
  variant: "danger",
5589
- onClick: ()=>$0f50f369018a42ef$var$deleteGeneList(props.api, list.id),
5680
+ onClick: ()=>$0f50f369018a42ef$var$deleteGeneList(props.api, list._id),
5681
+ className: "ml-2",
5682
+ children: "Delete"
5683
+ })
5684
+ ]
5685
+ })
5686
+ ]
5687
+ }, index))
5688
+ })
5689
+ ]
5690
+ }),
5691
+ publicGeneLists.length > 0 ? /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Table), {
5692
+ striped: true,
5693
+ bordered: true,
5694
+ hover: true,
5695
+ className: "mt-4",
5696
+ children: [
5697
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("thead", {
5698
+ children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("tr", {
5699
+ children: [
5700
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("th", {
5701
+ children: "List Name"
5702
+ }),
5703
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("th", {
5704
+ children: "Number of Genes"
5705
+ }),
5706
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("th", {
5707
+ children: "Actions"
5708
+ })
5709
+ ]
5710
+ })
5711
+ }),
5712
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("tbody", {
5713
+ children: publicGeneLists.map((list, index)=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("tr", {
5714
+ children: [
5715
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
5716
+ children: list.label
5717
+ }),
5718
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
5719
+ children: list.hash
5720
+ }),
5721
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("td", {
5722
+ children: [
5723
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Button), {
5724
+ variant: "info",
5725
+ onClick: ()=>$0f50f369018a42ef$var$viewGeneList(list),
5726
+ children: "View"
5727
+ }),
5728
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Button), {
5729
+ variant: "danger",
5730
+ onClick: ()=>$0f50f369018a42ef$var$deleteGeneList(props.api, list._id),
5590
5731
  className: "ml-2",
5591
5732
  children: "Delete"
5592
5733
  })
@@ -5611,7 +5752,7 @@ const $0f50f369018a42ef$var$viewGeneList = (list)=>{
5611
5752
  const $0f50f369018a42ef$var$deleteGeneList = async (api, listId)=>{
5612
5753
  if (window.confirm('Are you sure you want to delete this gene list?')) // Replace with the actual delete request
5613
5754
  try {
5614
- await fetch(`${api}/gene-lists/${listId}`, {
5755
+ await fetch(`${api}/gene_lists/${listId}`, {
5615
5756
  method: 'DELETE'
5616
5757
  });
5617
5758
  alert('Gene list deleted!');
@@ -5660,9 +5801,7 @@ const $0f50f369018a42ef$var$GeneListComponent = (props)=>{
5660
5801
  headers: {
5661
5802
  'Content-Type': 'application/json'
5662
5803
  },
5663
- body: JSON.stringify({
5664
- ids: geneArray
5665
- })
5804
+ body: JSON.stringify(geneArray)
5666
5805
  });
5667
5806
  const result = await response.json();
5668
5807
  if (result.hash) {
@@ -5688,7 +5827,7 @@ const $0f50f369018a42ef$var$GeneListComponent = (props)=>{
5688
5827
  const queryString = new URLSearchParams(queryParams).toString();
5689
5828
  const token = await user.getIdToken();
5690
5829
  try {
5691
- const response = await fetch(`${props.api}/gene_list?${queryString}`, {
5830
+ const response = await fetch(`${props.api}/gene_lists?${queryString}`, {
5692
5831
  method: 'POST',
5693
5832
  headers: {
5694
5833
  "Content-Type": "application/json",