/** * * @param {string} chromSizesData */ export function parseChromSizes(chromSizesData: string): { name: string; size: number; }[]; /** * * @param {any} value * @return {value is ChromosomalLocus} */ export function isChromosomalLocus(value: any): value is ChromosomalLocus; /** * * @param {any[]} value * @return {value is ChromosomalLocus[]} */ export function isChromosomalLocusInterval(value: any[]): value is ChromosomalLocus[]; /** * Returns true when the right bound is an explicit locus position rather than a * chromosome shortcut such as `{ chrom: "chr2" }`. * * @param {any} value * @returns {value is ChromosomalLocus[]} */ export function hasExplicitLocusUpperBound(value: any): value is ChromosomalLocus[]; /** * @param {any} value * @returns {value is GenomeConfig} */ export function isGenomeConfig(value: any): value is GenomeConfig; /** * @param {any} value * @returns {value is import("../spec/genome.js").UrlGenomeConfig } */ export function isUrlGenomeConfig(value: any): value is import("../spec/genome.js").UrlGenomeConfig; /** * @param {any} value * @returns {value is import("../spec/genome.js").InlineGenomeConfig} */ export function isInlineGenomeConfig(value: any): value is import("../spec/genome.js").InlineGenomeConfig; /** * @typedef {import("../spec/genome.js").GenomeConfig} GenomeConfig * @typedef {import("../spec/genome.js").ChromosomalLocus} ChromosomalLocus * * @typedef {object} Chromosome * @prop {string} name * @prop {number} size * * @typedef {object} ChromosomeAnnotation * @prop {number} index 0-based index * @prop {number} number 1-based index * @prop {number} continuousStart zero-based start, inclusive * @prop {number} continuousEnd zero-based end, exclusive * @prop {number[]} continuousInterval * @prop {boolean} odd true if odd chrom number * * @typedef {object} DiscreteChromosomeInterval * @prop {string} chrom * @prop {number} startPos * @prop {number} endPos */ export default class Genome { /** * @param {GenomeConfig} config */ constructor(config: GenomeConfig); config: { name: string; } | { name: string; url: string; } | { name: string; contigs: import("../spec/genome.js").Contig[]; }; /** @type {(Chromosome & ChromosomeAnnotation)[]} */ chromosomes: (Chromosome & ChromosomeAnnotation)[]; /** @type {Map} */ cumulativeChromPositions: Map; /** @type {Map} */ chromosomesByName: Map; /** @type {number[]} */ startByIndex: number[]; totalSize: number; get name(): string; /** * @param {string} baseUrl */ load(baseUrl: string): Promise; hasChrPrefix(): boolean; /** * * @param {Chromosome[]} chromSizes */ setChromSizes(chromSizes: Chromosome[]): void; getExtent(): number[]; /** * Returns a chromosomal locus in the continuous domain * * @param {string | number} chrom A number or name with or without a "chr" prefix. Examples: 23, chrX, X * @param {number} pos zero-based coordinate */ toContinuous(chrom: string | number, pos: number): number; /** * * @param {number} continuousPos */ toChromosome(continuousPos: number): Chromosome & ChromosomeAnnotation; /** * * @param {number} continuousPos * @returns {ChromosomalLocus} */ toChromosomal(continuousPos: number): ChromosomalLocus; /** * * @param {string} name */ getChromosome(name: string): Chromosome & ChromosomeAnnotation; /** * Returns a UCSC Genome Browser -style string presentation of the interval. * However, the interval may span multiple chromosomes, which is incompatible * with UCSC. * * The inteval is shown as one-based closed-open range. * See https://genome.ucsc.edu/FAQ/FAQtracks#tracks1 * * @param {number[]} interval * @returns {string} */ formatInterval(interval: number[]): string; /** * Returns a UCSC Genome Browser -style string presentation of a single * position. * * @param {number} continuousPos * @returns {string} */ formatLocus(continuousPos: number): string; /** * @param {number[]} interval * @returns {[ChromosomalLocus, ChromosomalLocus]} */ toChromosomalInterval(interval: number[]): [ChromosomalLocus, ChromosomalLocus]; /** * Returns a continuous interval. The optional position of the left end defaults to zero, * the right end defaults to the size of the chromosome. Thus, the chromosome is inclusive * when positions are omitted. * * @param {ChromosomalLocus[]} chromosomal */ toContinuousInterval(chromosomal: ChromosomalLocus[]): number[]; /** * Returns an array of discrete chromosome intervals that fall within the given interval. * * @param {[ChromosomalLocus, ChromosomalLocus]} interval * @returns {DiscreteChromosomeInterval[]} */ toDiscreteChromosomeIntervals(interval: [ChromosomalLocus, ChromosomalLocus]): DiscreteChromosomeInterval[]; /** * Returns an array of discrete chromosome intervals that fall within the given interval. * * @param {number[]} continuousInterval */ continuousToDiscreteChromosomeIntervals(continuousInterval: number[]): DiscreteChromosomeInterval[]; /** * * @param {string} str * @returns {[number, number]} */ parseInterval(str: string): [number, number]; } export type GenomeConfig = import("../spec/genome.js").GenomeConfig; export type ChromosomalLocus = import("../spec/genome.js").ChromosomalLocus; export type Chromosome = { name: string; size: number; }; export type ChromosomeAnnotation = { /** * 0-based index */ index: number; /** * 1-based index */ number: number; /** * zero-based start, inclusive */ continuousStart: number; /** * zero-based end, exclusive */ continuousEnd: number; continuousInterval: number[]; /** * true if odd chrom number */ odd: boolean; }; export type DiscreteChromosomeInterval = { chrom: string; startPos: number; endPos: number; }; //# sourceMappingURL=genome.d.ts.map