gramene-search 1.6.5 → 1.6.6

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
- 146054972
2
- 1728654878943814000
1
+ 152020407
2
+ 1729029155640539000
@@ -1,2 +1,2 @@
1
- 146052913
2
- 1728654831088453000
1
+ 152019833
2
+ 1729029148314911000
package/dist/index.js CHANGED
@@ -3287,12 +3287,31 @@ var $54c74a4689d5a778$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.conn
3287
3287
 
3288
3288
 
3289
3289
 
3290
+
3290
3291
  const $283508ffcf8a47c4$var$ggURL = {
3291
3292
  IRRI: "https://gringlobal.irri.org/gringlobal/accessiondetail?id=",
3292
3293
  ARS: "https://npgsweb.ars-grin.gov/gringlobal/accessiondetail.aspx?id=",
3294
+ ICRISAT: "https://genebank.icrisat.org/IND/PassportSummary?ID=",
3293
3295
  sorbmutdb: "https://www.depts.ttu.edu/igcast/sorbmutdb.php"
3294
3296
  };
3295
3297
  const $283508ffcf8a47c4$var$metaRenderer = (params)=>{
3298
+ if (params.value.field === "accessions") {
3299
+ const accs = params.value.accessions;
3300
+ return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Accordion), {
3301
+ children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Accordion).Item, {
3302
+ children: [
3303
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Accordion).Header, {
3304
+ children: accs.length
3305
+ }),
3306
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Accordion).Body, {
3307
+ children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("p", {
3308
+ children: 'This is where the "table" goes'
3309
+ })
3310
+ })
3311
+ ]
3312
+ })
3313
+ });
3314
+ }
3296
3315
  if (params.value.field === "germplasm") {
3297
3316
  const genebank = params.value.stock_center;
3298
3317
  const url = $283508ffcf8a47c4$var$ggURL[genebank];
@@ -3408,86 +3427,231 @@ const $283508ffcf8a47c4$var$study_info = {
3408
3427
  "oryza_sativamh63": $283508ffcf8a47c4$var$rice_studies,
3409
3428
  "oryza_sativazs97": $283508ffcf8a47c4$var$rice_studies
3410
3429
  };
3411
- const $283508ffcf8a47c4$var$Detail = (props)=>{
3412
- const gene = props.geneDocs[props.searchResult.id];
3413
- if (props.grameneConsequences && props.grameneConsequences[gene._id] && props.grameneGermplasm) {
3414
- const germplasmLUT = props.grameneGermplasm;
3415
- const vep_obj = props.grameneConsequences[gene._id];
3416
- let accessionTable = [];
3417
- let tableFields = [
3418
- {
3419
- field: "Order Germplasm",
3420
- cellRenderer: $283508ffcf8a47c4$var$metaRenderer,
3421
- comparator: $283508ffcf8a47c4$var$sortByLabel
3422
- },
3423
- {
3424
- field: "Synonyms",
3425
- cellRenderer: $283508ffcf8a47c4$var$metaRenderer,
3426
- comparator: $283508ffcf8a47c4$var$sortByLabel
3427
- },
3428
- {
3429
- field: "Study/Population",
3430
- cellRenderer: $283508ffcf8a47c4$var$metaRenderer,
3431
- comparator: $283508ffcf8a47c4$var$sortByLabel
3432
- },
3433
- {
3434
- field: "VEP consequence",
3435
- cellRenderer: $283508ffcf8a47c4$var$metaRenderer,
3436
- comparator: $283508ffcf8a47c4$var$sortByLabel
3437
- },
3438
- {
3439
- field: "Allele Status",
3440
- cellRenderer: $283508ffcf8a47c4$var$metaRenderer,
3441
- comparator: $283508ffcf8a47c4$var$sortByLabel
3442
- },
3443
- {
3444
- field: "All LOF Genes",
3445
- cellRenderer: $283508ffcf8a47c4$var$metaRenderer,
3446
- comparator: $283508ffcf8a47c4$var$sortByLabel
3430
+ const $283508ffcf8a47c4$var$AccessionLink = ({ germplasm: germplasm, gene_id: gene_id })=>{
3431
+ if (germplasm.germplasm_dbid) {
3432
+ const germ_id = germplasm.germplasm_dbid;
3433
+ const genebank = germplasm.stock_center;
3434
+ const url = $283508ffcf8a47c4$var$ggURL[genebank];
3435
+ if (germ_id && url && germ_id !== "0") return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("a", {
3436
+ target: "_blank",
3437
+ href: `${url}${germ_id}`,
3438
+ children: [
3439
+ germplasm.pub_id,
3440
+ " (",
3441
+ genebank,
3442
+ ")"
3443
+ ]
3444
+ });
3445
+ if (genebank === "sorbmutdb") return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("form", {
3446
+ id: germplasm.pub_id,
3447
+ action: url,
3448
+ method: "post",
3449
+ target: "_blank",
3450
+ children: [
3451
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("input", {
3452
+ type: "hidden",
3453
+ name: "search",
3454
+ value: gene_id.replace("SORBI_3", "Sobic.")
3455
+ }),
3456
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("input", {
3457
+ type: "hidden",
3458
+ name: "submit",
3459
+ value: "Search"
3460
+ }),
3461
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("button", {
3462
+ type: "submit",
3463
+ className: "button-like-link",
3464
+ children: "SorbMutDB"
3465
+ })
3466
+ ]
3467
+ });
3468
+ }
3469
+ return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
3470
+ children: germplasm.pub_id
3471
+ });
3472
+ };
3473
+ function $283508ffcf8a47c4$var$group_germplasm(gene, germplasmLUT, vep_obj) {
3474
+ let accessionTable = [];
3475
+ Object.entries(vep_obj).forEach(([key, accessions])=>{
3476
+ const parts = key.split("__");
3477
+ if (parts[0] === "VEP") {
3478
+ if (parts[1] !== "merged") accessions.forEach((ens_id)=>{
3479
+ const germplasm = germplasmLUT[ens_id][0];
3480
+ const pop = $283508ffcf8a47c4$var$study_info[parts[3]][parts[4]];
3481
+ const conseq = parts[1].replaceAll("_", " ");
3482
+ const status = parts[2] === "het" ? "heterozygous" : "homozygous";
3483
+ const accInfo = {
3484
+ key: [
3485
+ pop.label,
3486
+ conseq,
3487
+ status
3488
+ ].join("%%%"),
3489
+ germplasm: germplasm,
3490
+ pop: pop
3491
+ };
3492
+ accessionTable.push(accInfo);
3493
+ });
3494
+ }
3495
+ });
3496
+ // group accessionTable by key field
3497
+ const groups = (0, ($parcel$interopDefault($gXNCa$lodash))).groupBy(accessionTable, "key");
3498
+ let grouped = [];
3499
+ let id = 0;
3500
+ Object.keys(groups).sort().forEach((group)=>{
3501
+ const [pop, conseq, status] = group.split("%%%");
3502
+ id++;
3503
+ const tally = groups[group].length;
3504
+ grouped.push({
3505
+ id: id,
3506
+ group: group,
3507
+ summary: true,
3508
+ pop: pop,
3509
+ conseq: conseq,
3510
+ status: status,
3511
+ tally: tally
3512
+ });
3513
+ groups[group].forEach((acc)=>{
3514
+ id++;
3515
+ grouped.push({
3516
+ id: id,
3517
+ group: group,
3518
+ summary: false,
3519
+ pop: pop,
3520
+ conseq: conseq,
3521
+ status: status,
3522
+ accession: acc,
3523
+ tally: tally
3524
+ });
3525
+ });
3526
+ });
3527
+ return grouped;
3528
+ }
3529
+ const $283508ffcf8a47c4$var$THRESHOLD = 5;
3530
+ const $283508ffcf8a47c4$var$GridWithGroups = ({ groups: groups, gene_id: gene_id })=>{
3531
+ const [rowData, setRowData] = (0, $gXNCa$react.useState)(groups);
3532
+ const initialExpanded = {};
3533
+ rowData.forEach((row)=>{
3534
+ if (row.summary) initialExpanded[row.group] = row.tally < $283508ffcf8a47c4$var$THRESHOLD;
3535
+ });
3536
+ const [expandedGroups, setExpandedGroups] = (0, $gXNCa$react.useState)(initialExpanded);
3537
+ // const gridRef = useRef();
3538
+ // Toggle group visibility
3539
+ const toggleGroup = (group)=>{
3540
+ setExpandedGroups((prevExpandedGroups)=>({
3541
+ ...prevExpandedGroups,
3542
+ [group]: !prevExpandedGroups[group]
3543
+ }));
3544
+ };
3545
+ // Filter the data to show/hide rows based on the expanded group state
3546
+ const getVisibleRowData = ()=>{
3547
+ const visibleRows = [];
3548
+ rowData.forEach((row)=>{
3549
+ if (row.summary) {
3550
+ if (row.tally > 1) visibleRows.push(row);
3551
+ } else if (expandedGroups[row.group]) visibleRows.push(row); // Show non-summary rows if the group is expanded
3552
+ });
3553
+ return visibleRows;
3554
+ };
3555
+ // Define columns with a custom renderer for the summary rows
3556
+ const columnDefs = [
3557
+ {
3558
+ field: "pop",
3559
+ headerName: "Study",
3560
+ cellRenderer: (params)=>{
3561
+ if (params.data.summary || params.data.tally === 1) return params.value;
3562
+ return null;
3447
3563
  }
3448
- ];
3449
- Object.entries(vep_obj).forEach(([key, accessions])=>{
3450
- const parts = key.split("__");
3451
- if (parts[0] === "VEP") {
3452
- if (parts[1] !== "merged") accessions.forEach((ens_id)=>{
3453
- const germplasm = germplasmLUT[ens_id][0];
3454
- const accInfo = {
3455
- "Study/Population": {
3456
- label: $283508ffcf8a47c4$var$study_info[parts[3]][parts[4]].label
3457
- },
3458
- "VEP consequence": {
3459
- label: parts[1].replaceAll("_", " ")
3460
- },
3461
- "Allele Status": {
3462
- label: parts[2] === "het" ? "heterozygous" : "homozygous"
3463
- },
3464
- "Order Germplasm": {
3465
- field: "germplasm",
3466
- gene_id: props.searchResult.id,
3467
- label: germplasm.pub_id,
3468
- ...germplasm
3469
- },
3470
- "All LOF Genes": {
3471
- field: "search",
3472
- label: germplasm.ens_id,
3473
- pop_type: $283508ffcf8a47c4$var$study_info[parts[3]][parts[4]].type,
3474
- ...germplasm
3475
- },
3476
- "Synonyms": {
3477
- label: germplasm.ens_id
3478
- }
3479
- };
3480
- accessionTable.push(accInfo);
3564
+ },
3565
+ {
3566
+ field: "conseq",
3567
+ headerName: "VEP consequence",
3568
+ cellRenderer: (params)=>{
3569
+ if (params.data.summary || params.data.tally === 1) return params.value;
3570
+ return null;
3571
+ }
3572
+ },
3573
+ {
3574
+ field: "status",
3575
+ headerName: "Allele status",
3576
+ cellRenderer: (params)=>{
3577
+ if (params.data.summary || params.data.tally === 1) return params.value;
3578
+ return null;
3579
+ }
3580
+ },
3581
+ {
3582
+ field: "accession",
3583
+ headerName: "Order Germplasm",
3584
+ cellRenderer: (params)=>{
3585
+ if (params.value) return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($283508ffcf8a47c4$var$AccessionLink, {
3586
+ germplasm: params.value.germplasm,
3587
+ gene_id: gene_id
3588
+ });
3589
+ if (params.data.summary) return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("span", {
3590
+ onClick: ()=>toggleGroup(params.data.group),
3591
+ children: [
3592
+ params.data.tally,
3593
+ " Accessions ",
3594
+ expandedGroups[params.data.group] ? "\u25BC" : "\u25B6"
3595
+ ]
3481
3596
  });
3597
+ return null;
3482
3598
  }
3483
- });
3484
- // const [rowData, setRowData] = useState(accessionTable);
3485
- // const [colDefs, setColDefs] = useState(tableFields);
3486
- const defaultColDef = (0, $gXNCa$react.useMemo)(()=>{
3487
- return {
3488
- filter: true
3599
+ },
3600
+ {
3601
+ field: "search",
3602
+ headerName: "All LOF Genes",
3603
+ cellRenderer: (params)=>{
3604
+ if (params.data.accession) {
3605
+ const currentURL = new URL(window.location.href);
3606
+ const accession = params.data.accession;
3607
+ currentURL.search = "";
3608
+ currentURL.searchParams.set("category", "Germplasm");
3609
+ currentURL.searchParams.set("fq_field", `VEP__merged__${accession.pop.type}__attr_ss`);
3610
+ currentURL.searchParams.set("fq_value", accession.germplasm.ens_id);
3611
+ currentURL.searchParams.set("name", accession.germplasm.ens_id);
3612
+ return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Button), {
3613
+ size: "sm",
3614
+ href: currentURL.toString(),
3615
+ children: "Search"
3616
+ });
3617
+ }
3618
+ return null;
3619
+ }
3620
+ }
3621
+ ];
3622
+ const defaultColDef = {
3623
+ sortable: false,
3624
+ cellStyle: (params)=>{
3625
+ // if (!params.data.summary) {
3626
+ // return {paddingLeft: '30px'};
3627
+ // }
3628
+ if (params.data.summary) return {
3629
+ cursor: "pointer"
3489
3630
  };
3490
- }, []);
3631
+ return null;
3632
+ }
3633
+ };
3634
+ const nVisible = getVisibleRowData().length;
3635
+ const tableHeight = 50 + Math.min(nVisible, 10) * 42;
3636
+ return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
3637
+ className: "ag-theme-quartz",
3638
+ style: {
3639
+ height: tableHeight,
3640
+ width: "100%"
3641
+ },
3642
+ children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$aggridreact.AgGridReact), {
3643
+ rowData: getVisibleRowData(),
3644
+ columnDefs: columnDefs,
3645
+ getRowNodeId: (data)=>data.id,
3646
+ animateRows: true,
3647
+ defaultColDef: defaultColDef
3648
+ })
3649
+ });
3650
+ };
3651
+ const $283508ffcf8a47c4$var$Detail = (props)=>{
3652
+ const gene = props.geneDocs[props.searchResult.id];
3653
+ if (props.grameneConsequences && props.grameneConsequences[gene._id] && props.grameneGermplasm) {
3654
+ const groups = $283508ffcf8a47c4$var$group_germplasm(gene, props.grameneGermplasm, props.grameneConsequences[gene._id]);
3491
3655
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
3492
3656
  children: [
3493
3657
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("h5", {
@@ -3504,16 +3668,9 @@ const $283508ffcf8a47c4$var$Detail = (props)=>{
3504
3668
  " page in the Ensembl genome browser."
3505
3669
  ]
3506
3670
  }),
3507
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
3508
- className: "ag-theme-quartz",
3509
- style: {
3510
- height: `${44 * (accessionTable.length + 2)}px`
3511
- },
3512
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$aggridreact.AgGridReact), {
3513
- rowData: accessionTable,
3514
- columnDefs: tableFields,
3515
- defaultColDef: defaultColDef
3516
- })
3671
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($283508ffcf8a47c4$var$GridWithGroups, {
3672
+ groups: groups,
3673
+ gene_id: gene._id
3517
3674
  })
3518
3675
  ]
3519
3676
  });