gramene-search 2.27.0 → 2.29.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
@@ -11549,6 +11549,46 @@ function $31284fcdc45a1688$export$3a249e9030170bda(ensemblRest) {
11549
11549
  }
11550
11550
 
11551
11551
 
11552
+ /**
11553
+ * Reference sequence for the primer designer's CAPS annotation.
11554
+ *
11555
+ * A variant listing from `/primers` carries coordinates and alleles but no
11556
+ * bases, and restriction sites cannot be found without them, so the designer
11557
+ * takes sequence from its host. Ensembl REST's `sequence/region` returns the
11558
+ * plus strand of a window as `{molecule, seq, id, query}`.
11559
+ *
11560
+ * Read from `config.ensemblRest`, which must be the same Ensembl release the
11561
+ * primers API reads variants from (release 115 for sorghum_v11). This matters
11562
+ * more here than it does for the gene track: a gene model from the wrong
11563
+ * release is visibly out of place, whereas sequence from the wrong release
11564
+ * produces a confident and wrong enzyme call. The designer checks every window
11565
+ * against the reference alleles the API reports and shows nothing if they
11566
+ * disagree, but the right release is still the actual fix.
11567
+ */ /**
11568
+ * Beyond this the annotation is not worth the transfer; the variant listing is
11569
+ * already capped well below it, so this only guards against a stray query.
11570
+ */ const $f49aa8a0cf25aef4$var$MAX_SPAN = 200000;
11571
+ function $f49aa8a0cf25aef4$export$30e3f6c97d3f3a29(ensemblRest) {
11572
+ if (!ensemblRest) return undefined;
11573
+ return async ({ system_name: system_name, region: region, start: start, end: end }, options)=>{
11574
+ if (!system_name || !region || start < 1 || end < start || end - start + 1 > $f49aa8a0cf25aef4$var$MAX_SPAN) return null;
11575
+ const signal = options && options.signal;
11576
+ const url = `${ensemblRest}/sequence/region/${encodeURIComponent(system_name)}/${encodeURIComponent(region)}:${start}-${end}` + `?content-type=application/json`;
11577
+ const res = await fetch(url, {
11578
+ headers: {
11579
+ Accept: 'application/json'
11580
+ },
11581
+ signal: signal
11582
+ });
11583
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
11584
+ const body = await res.json();
11585
+ // A short or absent read would be indexed with genomic offsets and give
11586
+ // wrong answers quietly; the designer discards it, and so does this.
11587
+ return body && typeof body.seq === 'string' ? body.seq.toUpperCase() : null;
11588
+ };
11589
+ }
11590
+
11591
+
11552
11592
  // Primers detail: PCR/qPCR primer design, genome specificity and pan-genome
11553
11593
  // coverage checks (gramene-primers <PrimerDesigner>, backed by the
11554
11594
  // gramene-swagger /primers endpoints).
@@ -11589,6 +11629,9 @@ const $88d24ae9beb83d5d$var$Primers = (props)=>{
11589
11629
  const genesInRegion = (0, $gXNCa$react.useMemo)(()=>(0, $31284fcdc45a1688$export$3a249e9030170bda)(ensemblRest), [
11590
11630
  ensemblRest
11591
11631
  ]);
11632
+ const sequenceForRegion = (0, $gXNCa$react.useMemo)(()=>(0, $f49aa8a0cf25aef4$export$30e3f6c97d3f3a29)(ensemblRest), [
11633
+ ensemblRest
11634
+ ]);
11592
11635
  const byGene = props.uiViewState && props.uiViewState.byGene && props.uiViewState.byGene[geneId];
11593
11636
  const saved = byGene && byGene.primers;
11594
11637
  const { doSetPrimersState: doSetPrimersState } = props;
@@ -11610,6 +11653,7 @@ const $88d24ae9beb83d5d$var$Primers = (props)=>{
11610
11653
  systemName: gene.system_name,
11611
11654
  modes: $88d24ae9beb83d5d$var$MODES,
11612
11655
  genesInRegion: genesInRegion,
11656
+ sequenceForRegion: sequenceForRegion,
11613
11657
  defaultMode: "gene",
11614
11658
  // an empty slice (never visited, or a snapshot without primers) leaves
11615
11659
  // the designer uncontrolled until its first change is stored