gramene-search 2.32.1 → 2.34.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 +62 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -11589,6 +11589,64 @@ function $f49aa8a0cf25aef4$export$30e3f6c97d3f3a29(ensemblRest) {
|
|
|
11589
11589
|
}
|
|
11590
11590
|
|
|
11591
11591
|
|
|
11592
|
+
/**
|
|
11593
|
+
* Allele frequencies for the primer designer's variant picker.
|
|
11594
|
+
*
|
|
11595
|
+
* A variant listing from `/primers` says which alleles exist but not how common
|
|
11596
|
+
* they are, and how common an allele is decides whether a variant is worth
|
|
11597
|
+
* genotyping at all: a marker near fixation in the panel you mean to screen
|
|
11598
|
+
* tells you nothing. Ensembl REST's `variation` endpoint carries the figures,
|
|
11599
|
+
* and its POST form answers about many ids in one request — ids beyond a couple
|
|
11600
|
+
* of hundred are the difference between one call and hundreds.
|
|
11601
|
+
*
|
|
11602
|
+
* Read from `config.ensemblRest`, which must be the same Ensembl release the
|
|
11603
|
+
* primers API reads variants from (release 115 for sorghum_v11), for the same
|
|
11604
|
+
* reason the gene track and the sequence must: a frequency read against another
|
|
11605
|
+
* release could be attached to the wrong variant entirely.
|
|
11606
|
+
*
|
|
11607
|
+
* Two things about the upstream shape are dealt with here. The tally is spelled
|
|
11608
|
+
* `allele_count`, which is mapped to `count` so a host with some other
|
|
11609
|
+
* frequency source is not made to speak Ensembl; and rows arrive repeated, the
|
|
11610
|
+
* same population and allele several times over, which the designer collapses.
|
|
11611
|
+
*/ /** Ids per request. The designer sends batches; this is a guard, not the policy. */ const $24c27aa5d34bb08e$var$MAX_IDS = 500;
|
|
11612
|
+
function $24c27aa5d34bb08e$export$849a7b5b35ad4649(ensemblRest) {
|
|
11613
|
+
if (!ensemblRest) return undefined;
|
|
11614
|
+
return async ({ system_name: system_name, ids: ids }, options)=>{
|
|
11615
|
+
if (!system_name || !Array.isArray(ids) || !ids.length) return {};
|
|
11616
|
+
const signal = options && options.signal;
|
|
11617
|
+
const wanted = ids.filter((id)=>typeof id === 'string' && id).slice(0, $24c27aa5d34bb08e$var$MAX_IDS);
|
|
11618
|
+
if (!wanted.length) return {};
|
|
11619
|
+
const res = await fetch(`${ensemblRest}/variation/${encodeURIComponent(system_name)}?pops=1`, {
|
|
11620
|
+
method: 'POST',
|
|
11621
|
+
headers: {
|
|
11622
|
+
'Content-Type': 'application/json',
|
|
11623
|
+
Accept: 'application/json'
|
|
11624
|
+
},
|
|
11625
|
+
body: JSON.stringify({
|
|
11626
|
+
ids: wanted
|
|
11627
|
+
}),
|
|
11628
|
+
signal: signal
|
|
11629
|
+
});
|
|
11630
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
11631
|
+
const body = await res.json();
|
|
11632
|
+
if (!body || typeof body !== 'object') return {};
|
|
11633
|
+
const out = {};
|
|
11634
|
+
for (const id of wanted){
|
|
11635
|
+
const rows = body[id] && body[id].populations;
|
|
11636
|
+
if (!Array.isArray(rows)) continue;
|
|
11637
|
+
out[id] = rows.filter((r)=>r && typeof r.population === 'string' && typeof r.allele === 'string' && Number.isFinite(Number(r.frequency))).map((r)=>({
|
|
11638
|
+
population: r.population,
|
|
11639
|
+
allele: r.allele,
|
|
11640
|
+
frequency: Number(r.frequency),
|
|
11641
|
+
// Absent is not nought: a missing tally must stay unknown.
|
|
11642
|
+
count: r.allele_count === undefined || r.allele_count === null ? null : Number(r.allele_count)
|
|
11643
|
+
}));
|
|
11644
|
+
}
|
|
11645
|
+
return out;
|
|
11646
|
+
};
|
|
11647
|
+
}
|
|
11648
|
+
|
|
11649
|
+
|
|
11592
11650
|
// Primers detail: PCR/qPCR primer design, genome specificity and pan-genome
|
|
11593
11651
|
// coverage checks (gramene-primers <PrimerDesigner>, backed by the
|
|
11594
11652
|
// gramene-swagger /primers endpoints).
|
|
@@ -11632,6 +11690,9 @@ const $88d24ae9beb83d5d$var$Primers = (props)=>{
|
|
|
11632
11690
|
const sequenceForRegion = (0, $gXNCa$react.useMemo)(()=>(0, $f49aa8a0cf25aef4$export$30e3f6c97d3f3a29)(ensemblRest), [
|
|
11633
11691
|
ensemblRest
|
|
11634
11692
|
]);
|
|
11693
|
+
const alleleFrequencies = (0, $gXNCa$react.useMemo)(()=>(0, $24c27aa5d34bb08e$export$849a7b5b35ad4649)(ensemblRest), [
|
|
11694
|
+
ensemblRest
|
|
11695
|
+
]);
|
|
11635
11696
|
const byGene = props.uiViewState && props.uiViewState.byGene && props.uiViewState.byGene[geneId];
|
|
11636
11697
|
const saved = byGene && byGene.primers;
|
|
11637
11698
|
const { doSetPrimersState: doSetPrimersState } = props;
|
|
@@ -11654,6 +11715,7 @@ const $88d24ae9beb83d5d$var$Primers = (props)=>{
|
|
|
11654
11715
|
modes: $88d24ae9beb83d5d$var$MODES,
|
|
11655
11716
|
genesInRegion: genesInRegion,
|
|
11656
11717
|
sequenceForRegion: sequenceForRegion,
|
|
11718
|
+
alleleFrequencies: alleleFrequencies,
|
|
11657
11719
|
defaultMode: "gene",
|
|
11658
11720
|
// an empty slice (never visited, or a snapshot without primers) leaves
|
|
11659
11721
|
// the designer uncontrolled until its first change is stored
|