gramene-search 2.19.0 → 2.20.0

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/dist/index.js CHANGED
@@ -370,6 +370,50 @@ $9d9aeaf9299e61a1$var$grameneMaps.reactGrameneMaps = (0, $gXNCa$reduxbundler.cre
370
370
  actionCreator: 'doFetchGrameneMaps'
371
371
  };
372
372
  });
373
+ /**
374
+ * The site's reference genome, derived from /maps rather than configured per site.
375
+ *
376
+ * `is_anchor` marks the reference genome of a species group and `anchor_taxon_id`
377
+ * is that group's bare species id. Note the two are deliberately different scales:
378
+ * an anchor's own taxon_id is genome-level (4558006) and never equals its
379
+ * anchor_taxon_id (4558), so the anchor is found by group, not by matching ids.
380
+ *
381
+ * A deployment is whichever group it carries the most genomes for — sorghum_v11
382
+ * has 120 of 128 genomes under 4558, whose anchor is 4558006 (Sb bicolor BTx623
383
+ * v3). Deriving it this way keeps every site correct across releases; the value
384
+ * that used to be configured had drifted to 4558001, a non-anchor wild relative
385
+ * (Sb verticilliflorum 353).
386
+ *
387
+ * Returns null in two cases callers must tolerate: before /maps has loaded, and
388
+ * on a release whose /maps carries no anchor fields at all — gramene main is like
389
+ * that today (114 genomes, not one with is_anchor), so that deployment simply has
390
+ * no reference genome rather than a wrong one.
391
+ *
392
+ * Verified across deployments: sorghum 4558006 (Sb bicolor BTx623 v3),
393
+ * oryza 39947013 and maize 4577003 (both Nipponbare / B73 v5). The genome-level
394
+ * id differs per release, which is the reason to resolve it rather than pin it.
395
+ */ $9d9aeaf9299e61a1$var$grameneMaps.selectTargetTaxonId = (0, $gXNCa$reduxbundler.createSelector)('selectGrameneMaps', (grameneMaps)=>{
396
+ if (!grameneMaps) return null;
397
+ const genomes = Object.values(grameneMaps);
398
+ if (!genomes.length) return null;
399
+ const perGroup = {};
400
+ genomes.forEach((g)=>{
401
+ if (!g || g.anchor_taxon_id === undefined || g.anchor_taxon_id === null) return;
402
+ const k = String(g.anchor_taxon_id);
403
+ perGroup[k] = (perGroup[k] || 0) + 1;
404
+ });
405
+ let group = null;
406
+ let best = -1;
407
+ Object.keys(perGroup).forEach((k)=>{
408
+ if (perGroup[k] > best) {
409
+ best = perGroup[k];
410
+ group = k;
411
+ }
412
+ });
413
+ if (group === null) return null;
414
+ const anchor = genomes.find((g)=>g && g.is_anchor && String(g.anchor_taxon_id) === group);
415
+ return anchor ? anchor.taxon_id : null;
416
+ });
373
417
  const $9d9aeaf9299e61a1$var$expressionStudies = (0, $gXNCa$reduxbundler.createAsyncResourceBundle)({
374
418
  name: 'expressionStudies',
375
419
  actionBaseType: 'EXPRESSION_STUDIES',
@@ -672,50 +716,6 @@ const $9d9aeaf9299e61a1$var$grameneTaxDist = {
672
716
  return null;
673
717
  })
674
718
  };
675
- // this query will give the sorghum orthologs of AT1G01260
676
- // want to provide these on non-sorghum genes if available
677
- // http://data.gramene.org/search?q=homology__all_orthologs:AT1G01260&fq=taxon_id:4558&fl=id
678
- const $9d9aeaf9299e61a1$var$grameneOrthologs = {
679
- name: 'grameneOrthologs',
680
- getReducer: ()=>{
681
- const initialState = {};
682
- return (state = initialState, { type: type, payload: payload })=>{
683
- let newState;
684
- switch(type){
685
- case 'GRAMENE_ORTHOLOGS_REQUESTED':
686
- if (!state.hasOwnProperty(payload)) {
687
- newState = Object.assign({}, state);
688
- newState[payload] = [];
689
- return newState;
690
- }
691
- break;
692
- case 'GRAMENE_ORTHOLOGS_RECEIVED':
693
- return Object.assign({}, state, payload);
694
- }
695
- return state;
696
- };
697
- },
698
- doRequestOrthologs: (geneId)=>({ dispatch: dispatch, store: store })=>{
699
- const orthologs = store.selectGrameneOrthologs();
700
- if (!orthologs.hasOwnProperty(geneId)) {
701
- dispatch({
702
- type: 'GRAMENE_ORTHOLOGS_REQUESTED',
703
- payload: geneId
704
- });
705
- const API = store.selectGrameneAPI();
706
- const taxonId = store.selectTargetTaxonId();
707
- fetch(`${API}/search?q=homology__all_orthologs:${geneId}&fq=taxon_id:${taxonId}&fl=id`).then((res)=>res.json()).then((res)=>{
708
- let newOrthologs = {};
709
- newOrthologs[geneId] = res.response.docs.map((d)=>d.id);
710
- dispatch({
711
- type: 'GRAMENE_ORTHOLOGS_RECEIVED',
712
- payload: newOrthologs
713
- });
714
- });
715
- }
716
- },
717
- selectGrameneOrthologs: (state)=>state.grameneOrthologs
718
- };
719
719
  const $9d9aeaf9299e61a1$var$grameneParalogs = {
720
720
  name: 'grameneParalogs',
721
721
  getReducer: ()=>{
@@ -819,7 +819,6 @@ $9d9aeaf9299e61a1$export$2e2bcd8739ae039 = [
819
819
  $9d9aeaf9299e61a1$var$grameneMaps,
820
820
  $9d9aeaf9299e61a1$var$grameneTaxonomy,
821
821
  $9d9aeaf9299e61a1$var$grameneTaxDist,
822
- $9d9aeaf9299e61a1$var$grameneOrthologs,
823
822
  $9d9aeaf9299e61a1$var$grameneParalogs,
824
823
  $9d9aeaf9299e61a1$var$grameneGermplasm,
825
824
  $9d9aeaf9299e61a1$var$expressionSamples,
@@ -11484,10 +11483,6 @@ class $6c5c4f90059875bf$var$Gene extends (0, ($parcel$interopDefault($gXNCa$reac
11484
11483
  const panSite = this.props.config.panSite;
11485
11484
  const searchResult = this.props.searchResult;
11486
11485
  const taxName = this.props.taxName;
11487
- // let orthologs='';
11488
- // if (this.props.orthologs && this.props.orthologs.hasOwnProperty(searchResult.id)) {
11489
- // orthologs = this.props.orthologs[searchResult.id].join(', ');
11490
- // }
11491
11486
  const numWordsInDescription = searchResult.description.split(' ').length;
11492
11487
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
11493
11488
  className: "result-gene",
@@ -11646,8 +11641,6 @@ const $6c5c4f90059875bf$var$GeneList = (props)=>{
11646
11641
  taxName: props.grameneTaxonomy[g.taxon_id].name,
11647
11642
  geneDocs: props.grameneGenes,
11648
11643
  requestGene: props.doRequestGrameneGene,
11649
- requestOrthologs: props.doRequestOrthologs,
11650
- orthologs: props.grameneOrthologs,
11651
11644
  taxLut: props.grameneTaxonomy,
11652
11645
  expandedDetail: props.grameneSearch.response.numFound === 1 && g.can_show.homology ? 'homology' : null
11653
11646
  }, idx)),
@@ -11659,7 +11652,7 @@ const $6c5c4f90059875bf$var$GeneList = (props)=>{
11659
11652
  }
11660
11653
  return null;
11661
11654
  };
11662
- var $6c5c4f90059875bf$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.connect)('selectConfiguration', 'selectGrameneSearch', 'selectGrameneTaxonomy', 'selectGrameneGenes', 'selectGrameneOrthologs', 'selectGrameneSearchOffset', 'selectGrameneSearchRows', 'doRequestGrameneGene', 'doRequestOrthologs', 'doRequestResultsPage', $6c5c4f90059875bf$var$GeneList);
11655
+ var $6c5c4f90059875bf$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.connect)('selectConfiguration', 'selectGrameneSearch', 'selectGrameneTaxonomy', 'selectGrameneGenes', 'selectGrameneSearchOffset', 'selectGrameneSearchRows', 'doRequestGrameneGene', 'doRequestResultsPage', $6c5c4f90059875bf$var$GeneList);
11663
11656
 
11664
11657
 
11665
11658