loom-browser 0.0.15 → 0.0.16
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/loom-react.esm.js +35 -33
- package/dist/loom-react.esm.min.js +1 -1
- package/dist/loom-react.esm.min.js.map +1 -1
- package/dist/loom.esm.js +35 -33
- package/dist/loom.esm.min.js +1 -1
- package/dist/loom.esm.min.js.map +1 -1
- package/dist/loom.js +35 -33
- package/dist/loom.min.js +1 -1
- package/dist/loom.min.js.map +1 -1
- package/dist/tsconfig.src.tsbuildinfo +1 -1
- package/dist/types/genome/genome.d.ts +7 -3
- package/package.json +1 -1
package/dist/loom.js
CHANGED
|
@@ -23004,60 +23004,62 @@
|
|
|
23004
23004
|
/**
|
|
23005
23005
|
* Resolve a sequence provider from config.
|
|
23006
23006
|
*
|
|
23007
|
-
*
|
|
23008
|
-
*
|
|
23009
|
-
*
|
|
23007
|
+
* If a custom `sequenceProvider` is set, it is used directly. Otherwise,
|
|
23008
|
+
* all available sources (twoBitURL, fastaURL, ucscGenome/id) are chained
|
|
23009
|
+
* as a prioritized fallback list:
|
|
23010
23010
|
*
|
|
23011
|
-
*
|
|
23012
|
-
*
|
|
23013
|
-
*
|
|
23011
|
+
* 1. twoBitURL — most efficient (binary range requests)
|
|
23012
|
+
* 2. fastaURL — reliable CDN fallback (igv.org hosts FASTA for common genomes)
|
|
23013
|
+
* 3. UCSC API — last resort (api.genome.ucsc.edu REST endpoint)
|
|
23014
|
+
*
|
|
23015
|
+
* This mirrors igv.js genomes3.json which provides both twoBitURL and fastaURL
|
|
23016
|
+
* for common genomes. On networks where one server is unreachable (e.g.,
|
|
23017
|
+
* hgdownload.soe.ucsc.edu blocked but igv.org reachable), the chain
|
|
23018
|
+
* automatically falls through to the next available source.
|
|
23014
23019
|
*/
|
|
23015
23020
|
function resolveSequenceProvider(config) {
|
|
23016
|
-
var _a
|
|
23017
|
-
|
|
23018
|
-
config.sequenceProvider && 'sequenceProvider',
|
|
23019
|
-
config.twoBitURL && 'twoBitURL',
|
|
23020
|
-
config.fastaURL && 'fastaURL',
|
|
23021
|
-
config.ucscGenome && 'ucscGenome',
|
|
23022
|
-
].filter(Boolean);
|
|
23023
|
-
if (sources.length > 1) {
|
|
23024
|
-
throw new Error(`GenomeConfig has multiple sequence sources: ${sources.join(', ')}. ` +
|
|
23025
|
-
'Set exactly one of: sequenceProvider, twoBitURL, fastaURL, or ucscGenome.');
|
|
23026
|
-
}
|
|
23021
|
+
var _a;
|
|
23022
|
+
// Custom provider — use directly, no chaining
|
|
23027
23023
|
if (config.sequenceProvider) {
|
|
23028
23024
|
return config.sequenceProvider;
|
|
23029
23025
|
}
|
|
23026
|
+
// Build prioritized provider list from available config fields
|
|
23027
|
+
const providers = [];
|
|
23030
23028
|
if (config.twoBitURL) {
|
|
23031
|
-
|
|
23032
|
-
// Add UCSC REST API fallback when a genome ID is known
|
|
23033
|
-
const genomeId = (_a = config.ucscGenome) !== null && _a !== void 0 ? _a : config.id;
|
|
23034
|
-
if (genomeId) {
|
|
23035
|
-
const fallback = (locus, signal) => fetchSequence(locus, { genome: genomeId }, signal);
|
|
23036
|
-
return createCachedSequence(createFallbackProvider(primary, fallback));
|
|
23037
|
-
}
|
|
23038
|
-
return createCachedSequence(primary);
|
|
23029
|
+
providers.push(createTwoBitSequenceProvider(config.twoBitURL, config.fetchImpl));
|
|
23039
23030
|
}
|
|
23040
23031
|
if (config.fastaURL) {
|
|
23041
|
-
|
|
23032
|
+
providers.push(createFastaSequenceProvider(config.fastaURL, config.indexURL, config.compressedIndexURL, config.fetchImpl));
|
|
23042
23033
|
}
|
|
23043
|
-
|
|
23044
|
-
const ucscGenome = (_b = config.ucscGenome) !== null && _b !== void 0 ? _b : config.id;
|
|
23034
|
+
const ucscGenome = (_a = config.ucscGenome) !== null && _a !== void 0 ? _a : config.id;
|
|
23045
23035
|
if (ucscGenome) {
|
|
23046
|
-
|
|
23036
|
+
providers.push((locus, signal) => fetchSequence(locus, { genome: ucscGenome }, signal));
|
|
23047
23037
|
}
|
|
23048
|
-
|
|
23038
|
+
if (providers.length === 0)
|
|
23039
|
+
return undefined;
|
|
23040
|
+
if (providers.length === 1)
|
|
23041
|
+
return createCachedSequence(providers[0]);
|
|
23042
|
+
// Chain all providers: try each in order, fall back on failure
|
|
23043
|
+
const chained = providers.reduceRight((fallback, primary) => createFallbackProvider(primary, fallback));
|
|
23044
|
+
return createCachedSequence(chained);
|
|
23049
23045
|
}
|
|
23050
23046
|
// ─── Pre-built singletons ��─────────��─────────────────────────────────────────
|
|
23051
23047
|
/**
|
|
23052
|
-
* Pre-built hg38 genome with
|
|
23048
|
+
* Pre-built hg38 genome with triple-fallback sequence chain.
|
|
23053
23049
|
*
|
|
23054
23050
|
* This is the default genome used by HeadlessGenomeBrowser when no genome
|
|
23055
|
-
* is specified.
|
|
23056
|
-
*
|
|
23051
|
+
* is specified. Sequence sources are tried in order:
|
|
23052
|
+
* 1. 2-bit from hgdownload.soe.ucsc.edu (most efficient, binary range requests)
|
|
23053
|
+
* 2. Indexed FASTA from igv.org (reliable CDN, reachable on restricted networks)
|
|
23054
|
+
* 3. UCSC REST API from api.genome.ucsc.edu (last resort)
|
|
23055
|
+
*
|
|
23056
|
+
* URLs match igv.js genomes3.json configuration for hg38.
|
|
23057
23057
|
*/
|
|
23058
23058
|
const hg38Genome = createGenomeSync({
|
|
23059
23059
|
id: 'hg38',
|
|
23060
23060
|
twoBitURL: 'https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.2bit',
|
|
23061
|
+
fastaURL: 'https://igv.org/genomes/data/hg38/hg38.fa',
|
|
23062
|
+
indexURL: 'https://igv.org/genomes/data/hg38/hg38.fa.fai',
|
|
23061
23063
|
chromSizes: hg38ChromSizes,
|
|
23062
23064
|
});
|
|
23063
23065
|
|