Mercurial > repos > fubar > jbrowse2
diff x/static/js/6391.aabba4a1.chunk.js.map @ 125:49f3d3878413 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author | fubar |
---|---|
date | Sat, 05 Oct 2024 23:58:05 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/x/static/js/6391.aabba4a1.chunk.js.map Sat Oct 05 23:58:05 2024 +0000 @@ -0,0 +1,1 @@ +{"version":3,"file":"static/js/6391.aabba4a1.chunk.js","mappings":"wOAUe,MAAMA,EAGnBC,WAAAA,CACUC,EACAC,GACR,KAFQD,OAAAA,EAAkB,KAClBC,OAAAA,CACP,CAEHC,SAAAA,GACE,OAAOC,KAAKH,OAAOI,QACrB,CAEAC,UAAAA,GACE,OAAOF,KAAKH,OAAOM,eAAiB,CACtC,CAEAC,QAAAA,GACE,OAAOJ,KAAKH,OAAOM,gBAAkBH,KAAKH,OAAOQ,aAAe,GAAK,CACvE,CAEAC,uBAAAA,GACE,OAAON,KAAKH,OAAOU,YACrB,CAEAC,SAAAA,GACE,MAAO,OACT,CAEAC,UAAAA,GACE,OAAOT,KAAKH,OAAOa,cACrB,CAEAC,UAAAA,GACE,OAAOX,KAAKH,OAAOe,KACrB,CAEAC,WAAAA,GACE,OAAOb,KAAKH,OAAOiB,yBAA2B,EAAI,CACpD,CAEAC,cAAAA,GACE,OAAOf,KAAKF,OAAOkB,UAAUC,aAAajB,KAAKH,OAAOqB,YACxD,CAEAC,SAAAA,GACE,OAAQnB,KAAKH,OAAOuB,eAAiB,IAAIC,KAAK,IAChD,CAEAC,OAAAA,GACE,OAAOtB,KAAKH,OAAOuB,aACrB,CAEAG,YAAAA,GACE,OAAOvB,KAAKF,OAAO0B,YAAYxB,KAAKH,OAAO4B,WAC7C,CAEAC,cAAAA,GACE,QAAS1B,KAAKH,OAAO8B,IACvB,CAEAC,qBA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AQf,EAAOe,MACrB,IAAKA,EAAQ0L,KAAiBA,GAAiB1L,EAAQ2L,EAAvD,CAIA,GAAIC,EAAW,CACb,MAAMC,EACc,OAAlBD,EAAU7B,IACN3J,EAAUC,aAAapB,EAAOqB,aAC9BrB,EAAO2C,KAAKgK,EAAU7B,KACtB+B,EAAYF,EAAUtB,MAC5B,GACgB,MAAdwB,OACgB3K,IAAZ0K,EACA,GAAGA,KAAc,GAAGC,IAExB,QAEJ,CAEIzM,GAAYJ,EAAOI,WAAaA,GAGpCgM,EAASU,KAAK3M,KAAK4M,oBAAoB/M,GApBvC,CAqBF,CAEAoM,EAASC,UAAU,GACnB,GACDP,EACL,CAEAkB,aAAAA,GAAuC,CAEvCD,mBAAAA,CAAoB/M,GAClB,OAAO,IAAIF,EAAwBE,EAAQG,KAC7C,CAGA,uCAAM8M,CACJC,EACA7C,GAIA,MAAO,CACL8C,YAHkBhN,KAAKiN,gBAAgBF,EAAS7C,GAIhDgD,eAHqBlN,KAAKgH,QAAQ,kBAKtC,CAOA,qBAAciG,CAAgBF,EAAmBvE,GAC/C,MAAM,KAAEpB,SAAepH,KAAKmI,YAW5B,aAV2BgF,QAAQC,IACjCL,EAAQnI,KAAI8G,IACV,MAAM,QAAE9C,EAAO,MAAExF,EAAK,IAAEuF,GAAQ+C,EAC1B2B,EAAQrN,KAAKuL,YAAY3C,GAC/B,YAAiB7G,IAAVsL,EACHjG,EAAKI,MAAM8F,mBAAmBD,EAAOjK,EAAOuF,GAC5C,CAAC,CAAE4E,WAAY,GAAI,MAIPC,OAAOC,QAAO,CAACpE,EAAGC,IAAMD,EAAIC,EAAEiE,YAAY,EAChE,E","sources":["../../../plugins/alignments/src/CramAdapter/CramSlightlyLazyFeature.ts","../../../plugins/alignments/src/CramAdapter/util.ts","../../../plugins/alignments/src/CramAdapter/CramAdapter.ts"],"sourcesContent":["import {\n Feature,\n SimpleFeatureSerialized,\n} from '@jbrowse/core/util/simpleFeature'\nimport { CramRecord } from '@gmod/cram'\n\n// locals\nimport CramAdapter from './CramAdapter'\nimport { readFeaturesToCIGAR, readFeaturesToMismatches } from './util'\n\nexport default class CramSlightlyLazyFeature implements Feature {\n // uses parameter properties to automatically create fields on the class\n // https://www.typescriptlang.org/docs/handbook/classes.html#parameter-properties\n constructor(\n private record: CramRecord,\n private _store: CramAdapter,\n ) {}\n\n _get_name() {\n return this.record.readName\n }\n\n _get_start() {\n return this.record.alignmentStart - 1\n }\n\n _get_end() {\n return this.record.alignmentStart + (this.record.lengthOnRef ?? 1) - 1\n }\n\n _get_cram_read_features() {\n return this.record.readFeatures\n }\n\n _get_type() {\n return 'match'\n }\n\n _get_score() {\n return this.record.mappingQuality\n }\n\n _get_flags() {\n return this.record.flags\n }\n\n _get_strand() {\n return this.record.isReverseComplemented() ? -1 : 1\n }\n\n _read_group_id() {\n return this._store.samHeader.readGroups?.[this.record.readGroupId]\n }\n\n _get_qual() {\n return (this.record.qualityScores || []).join(' ')\n }\n\n qualRaw() {\n return this.record.qualityScores\n }\n\n _get_refName() {\n return this._store.refIdToName(this.record.sequenceId)\n }\n\n _get_is_paired() {\n return !!this.record.mate\n }\n\n _get_pair_orientation() {\n return this.record.isPaired() ? this.record.getPairOrientation() : undefined\n }\n\n _get_template_length() {\n return this.record.templateLength || this.record.templateSize\n }\n\n _get_next_ref() {\n return this.record.mate\n ? this._store.refIdToName(this.record.mate.sequenceId)\n : undefined\n }\n\n _get_next_segment_position() {\n return this.record.mate\n ? `${this._store.refIdToName(this.record.mate.sequenceId)}:${\n this.record.mate.alignmentStart\n }`\n : undefined\n }\n\n _get_next_pos() {\n return this.record.mate?.alignmentStart\n }\n\n _get_tags() {\n const RG = this._read_group_id()\n const { tags } = this.record\n // avoids a tag copy if no RG, but just copy if there is one\n return RG !== undefined ? { ...tags, RG } : tags\n }\n\n _get_seq() {\n return this.record.getReadBases()\n }\n\n // generate a CIGAR, based on code from jkbonfield\n _get_CIGAR() {\n return readFeaturesToCIGAR(\n this.record.readFeatures,\n this.record.alignmentStart,\n this.record.readLength,\n this.record._refRegion,\n )\n }\n\n tags() {\n return Object.getOwnPropertyNames(CramSlightlyLazyFeature.prototype)\n .filter(\n prop =>\n prop.startsWith('_get_') &&\n prop !== '_get_mismatches' &&\n prop !== '_get_cram_read_features',\n )\n .map(methodName => methodName.replace('_get_', ''))\n }\n\n id() {\n return `${this._store.id}-${this.record.uniqueId}`\n }\n\n get(field: string) {\n const methodName = `_get_${field}`\n // @ts-expect-error\n if (this[methodName]) {\n // @ts-expect-error\n return this[methodName]()\n }\n return undefined\n }\n\n parent() {\n return undefined\n }\n\n children() {\n return undefined\n }\n\n set() {}\n\n pairedFeature() {\n return false\n }\n\n _get_clipPos() {\n const mismatches = this.get('mismatches')\n if (mismatches.length) {\n const record =\n this.get('strand') === -1 ? mismatches.at(-1) : mismatches[0]\n const { type, cliplen } = record\n if (type === 'softclip' || type === 'hardclip') {\n return cliplen\n }\n }\n return 0\n }\n\n toJSON(): SimpleFeatureSerialized {\n return {\n ...Object.fromEntries(\n this.tags()\n .map(t => [t, this.get(t)])\n .filter(elt => elt[1] !== undefined),\n ),\n uniqueId: this.id(),\n }\n }\n\n _get_mismatches() {\n const readFeatures = this.record.readFeatures\n const qual = this.qualRaw()\n const start = this.get('start')\n return readFeaturesToMismatches(readFeatures, start, qual)\n }\n}\n","import { CramRecord } from '@gmod/cram'\n\ntype ReadFeatures = CramRecord['readFeatures']\n\nexport interface Mismatch {\n qual?: number\n start: number\n length: number\n type: string\n base: string | undefined\n altbase?: string\n seq?: string\n cliplen?: number\n}\n\nexport function readFeaturesToMismatches(\n readFeatures: ReadFeatures,\n start: number,\n qual?: number[] | null,\n) {\n if (!readFeatures) {\n return []\n }\n const mismatches: Mismatch[] = new Array(readFeatures.length)\n let j = 0\n let insLen = 0\n let refPos = 0\n let sublen = 0\n let lastPos = start\n\n for (const { refPos: p, code, pos, data, sub, ref } of readFeatures) {\n sublen = refPos - lastPos\n lastPos = refPos\n\n if (sublen && insLen > 0) {\n mismatches[j++] = {\n start: refPos,\n type: 'insertion',\n base: `${insLen}`,\n length: 0,\n }\n insLen = 0\n }\n refPos = p - 1 - start\n\n if (code === 'X') {\n // substitution\n mismatches[j++] = {\n start: refPos,\n length: 1,\n base: sub,\n qual: qual?.[pos - 1],\n altbase: ref?.toUpperCase(),\n type: 'mismatch',\n }\n } else if (code === 'I') {\n // insertion\n mismatches[j++] = {\n start: refPos,\n type: 'insertion',\n base: `${data.length}`,\n length: 0,\n }\n } else if (code === 'N') {\n // reference skip\n mismatches[j++] = {\n type: 'skip',\n length: data,\n start: refPos,\n base: 'N',\n }\n } else if (code === 'S') {\n // soft clip\n const len = data.length\n mismatches[j++] = {\n start: refPos,\n type: 'softclip',\n base: `S${len}`,\n cliplen: len,\n length: 1,\n }\n } else if (code === 'P') {\n // padding\n } else if (code === 'H') {\n // hard clip\n const len = data\n mismatches[j++] = {\n start: refPos,\n type: 'hardclip',\n base: `H${len}`,\n cliplen: len,\n length: 1,\n }\n } else if (code === 'D') {\n // deletion\n mismatches[j++] = {\n type: 'deletion',\n length: data,\n start: refPos,\n base: '*',\n }\n } else if (code === 'b') {\n // stretch of bases\n } else if (code === 'q') {\n // stretch of qual scores\n } else if (code === 'B') {\n // a pair of [base, qual]\n } else if (code === 'i') {\n // single-base insertion, we collect these if there are multiple in a row\n // into a single insertion entry\n insLen++\n } else if (code === 'Q') {\n // single quality value\n }\n }\n\n if (sublen && insLen > 0) {\n mismatches[j++] = {\n start: refPos,\n type: 'insertion',\n base: `${insLen}`,\n length: 0,\n }\n insLen = 0\n }\n\n return mismatches.slice(0, j)\n}\n\nexport function readFeaturesToCIGAR(\n readFeatures: ReadFeatures,\n alignmentStart: number,\n readLen: number,\n refRegion?: { seq: string; start: number },\n) {\n let seq = ''\n let cigar = ''\n let op = 'M'\n let oplen = 0\n if (!refRegion) {\n return ''\n }\n\n // not sure I should access these, but...\n const ref = refRegion.seq\n const refStart = refRegion.start\n let lastPos = alignmentStart\n let sublen = 0\n let insLen = 0\n if (readFeatures !== undefined) {\n for (const { code, refPos, sub, data } of readFeatures) {\n sublen = refPos - lastPos\n seq += ref.slice(lastPos - refStart, refPos - refStart)\n lastPos = refPos\n\n if (insLen > 0 && sublen) {\n cigar += `${insLen}I`\n insLen = 0\n }\n if (oplen && op !== 'M') {\n cigar += `${oplen}${op}`\n oplen = 0\n }\n if (sublen) {\n op = 'M'\n oplen += sublen\n }\n\n if (code === 'b') {\n // An array of bases stored verbatim\n const ret = data.split(',')\n const added = String.fromCharCode(...ret)\n seq += added\n lastPos += added.length\n oplen += added.length\n } else if (code === 'B') {\n // Single base (+ qual score)\n seq += sub\n lastPos++\n oplen++\n } else if (code === 'X') {\n // Substitution\n seq += sub\n lastPos++\n oplen++\n } else if (code === 'D' || code === 'N') {\n // Deletion or Ref Skip\n lastPos += data\n if (oplen) {\n cigar += `${oplen}${op}`\n }\n cigar += data + code\n oplen = 0\n } else if (code === 'I' || code === 'S') {\n // Insertion or soft-clip\n seq += data\n if (oplen) {\n cigar += `${oplen}${op}`\n }\n cigar += data.length + code\n oplen = 0\n } else if (code === 'i') {\n // Single base insertion\n // seq += data\n if (oplen) {\n cigar += `${oplen}${op}`\n }\n insLen++\n seq += data\n oplen = 0\n } else if (code === 'P') {\n // Padding\n if (oplen) {\n cigar += `${oplen}${op}`\n }\n cigar += `${data}P`\n } else if (code === 'H') {\n // Hard clip\n if (oplen) {\n cigar += `${oplen}${op}`\n }\n cigar += `${data}H`\n oplen = 0\n } // else q or Q\n }\n } else {\n sublen = readLen - seq.length\n }\n if (seq.length !== readLen) {\n sublen = readLen - seq.length\n seq += ref.slice(lastPos - refStart, lastPos - refStart + sublen)\n\n if (oplen && op !== 'M') {\n cigar += `${oplen}${op}`\n oplen = 0\n }\n op = 'M'\n oplen += sublen\n }\n if (sublen && insLen > 0) {\n cigar += `${insLen}I`\n }\n if (oplen) {\n cigar += `${oplen}${op}`\n }\n\n return cigar\n}\n","import { CraiIndex, IndexedCramFile, CramRecord } from '@gmod/cram'\nimport {\n BaseFeatureDataAdapter,\n BaseOptions,\n BaseSequenceAdapter,\n} from '@jbrowse/core/data_adapters/BaseAdapter'\nimport {\n checkAbortSignal,\n Region,\n Feature,\n updateStatus,\n toLocale,\n} from '@jbrowse/core/util'\nimport { openLocation } from '@jbrowse/core/util/io'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\nimport { toArray } from 'rxjs/operators'\nimport { firstValueFrom } from 'rxjs'\n\n// locals\nimport CramSlightlyLazyFeature from './CramSlightlyLazyFeature'\nimport { IFilter } from '../shared'\n\ninterface Header {\n idToName?: string[]\n nameToId?: Record<string, number>\n readGroups?: (string | undefined)[]\n}\n\nexport default class CramAdapter extends BaseFeatureDataAdapter {\n samHeader: Header = {}\n\n private setupP?: Promise<{\n samHeader: Header\n cram: IndexedCramFile\n sequenceAdapter: BaseSequenceAdapter\n }>\n\n private configureP?: Promise<{\n cram: IndexedCramFile\n sequenceAdapter: BaseSequenceAdapter\n }>\n\n // maps a refname to an id\n private seqIdToRefName: string[] | undefined\n\n // maps a seqId to original refname, passed specially to render args, to a seqid\n private seqIdToOriginalRefName: string[] = []\n\n public async configurePre() {\n const cramLocation = this.getConf('cramLocation')\n const craiLocation = this.getConf('craiLocation')\n const pm = this.pluginManager\n\n const cram = new IndexedCramFile({\n cramFilehandle: openLocation(cramLocation, pm),\n index: new CraiIndex({ filehandle: openLocation(craiLocation, pm) }),\n seqFetch: (...args) => this.seqFetch(...args),\n checkSequenceMD5: false,\n })\n\n if (!this.getSubAdapter) {\n throw new Error('Error getting subadapter')\n }\n\n const seqConf = this.getConf('sequenceAdapter')\n if (!seqConf) {\n throw new Error('no sequenceAdapter supplied to CramAdapter config')\n }\n const subadapter = await this.getSubAdapter(seqConf)\n\n return {\n cram,\n sequenceAdapter: subadapter.dataAdapter as BaseSequenceAdapter,\n }\n }\n\n public async configure() {\n if (!this.configureP) {\n this.configureP = this.configurePre().catch((e: unknown) => {\n this.configureP = undefined\n throw e\n })\n }\n return this.configureP\n }\n\n async getHeader(_opts?: BaseOptions) {\n const { cram } = await this.configure()\n return cram.cram.getHeaderText()\n }\n\n private async seqFetch(\n seqId: number,\n start: number,\n end: number,\n ): Promise<string> {\n start -= 1 // convert from 1-based closed to interbase\n\n const { sequenceAdapter } = await this.configure()\n const refName = this.refIdToOriginalName(seqId) || this.refIdToName(seqId)\n if (!refName) {\n throw new Error('unknown')\n }\n\n const seqChunks = await firstValueFrom(\n sequenceAdapter\n .getFeatures({\n refName,\n start,\n end,\n assemblyName: '',\n })\n .pipe(toArray()),\n )\n\n const sequence = seqChunks\n .sort((a, b) => a.get('start') - b.get('start'))\n .map(chunk => {\n const chunkStart = chunk.get('start')\n const chunkEnd = chunk.get('end')\n const trimStart = Math.max(start - chunkStart, 0)\n const trimEnd = Math.min(end - chunkStart, chunkEnd - chunkStart)\n const trimLength = trimEnd - trimStart\n const chunkSeq = chunk.get('seq') || chunk.get('residues')\n return chunkSeq.slice(trimStart, trimStart + trimLength)\n })\n .join('')\n\n const qlen = end - start\n if (sequence.length !== qlen) {\n throw new Error(\n `fetching ${refName}:${toLocale(\n start - 1,\n )}-${toLocale(end)} returned ${toLocale(sequence.length)} bases, should have returned ${toLocale(\n qlen,\n )}`,\n )\n }\n return sequence\n }\n\n private async setupPre(opts?: BaseOptions) {\n const { statusCallback = () => {} } = opts || {}\n return updateStatus('Downloading index', statusCallback, async () => {\n const conf = await this.configure()\n const { cram } = conf\n const samHeader = await cram.cram.getSamHeader()\n\n // use the @SQ lines in the header to figure out the\n // mapping between ref ID numbers and names\n const idToName: string[] = []\n const nameToId: Record<string, number> = {}\n samHeader\n .filter(l => l.tag === 'SQ')\n .forEach((sqLine, refId) => {\n const SN = sqLine.data.find(item => item.tag === 'SN')\n if (SN) {\n const refName = SN.value\n nameToId[refName] = refId\n idToName[refId] = refName\n }\n })\n\n const readGroups = samHeader\n .filter(l => l.tag === 'RG')\n .map(rgLine => rgLine.data.find(item => item.tag === 'ID')?.value)\n\n const data = { idToName, nameToId, readGroups }\n this.samHeader = data\n return { samHeader: data, ...conf }\n })\n }\n\n private async setup(opts?: BaseOptions) {\n if (!this.setupP) {\n this.setupP = this.setupPre(opts).catch((e: unknown) => {\n this.setupP = undefined\n throw e\n })\n }\n return this.setupP\n }\n\n async getRefNames(opts?: BaseOptions) {\n const { samHeader } = await this.setup(opts)\n if (!samHeader.idToName) {\n throw new Error('CRAM file has no header lines')\n }\n return samHeader.idToName\n }\n\n // use info from the SAM header if possible, but fall back to using\n // the ref seq order from when the browser's refseqs were loaded\n refNameToId(refName: string) {\n if (this.samHeader.nameToId) {\n return this.samHeader.nameToId[refName]\n }\n if (this.seqIdToRefName) {\n return this.seqIdToRefName.indexOf(refName)\n }\n return undefined\n }\n\n // use info from the SAM header if possible, but fall back to using\n // the ref seq order from when the browser's refseqs were loaded\n refIdToName(refId: number) {\n return this.samHeader.idToName?.[refId] || this.seqIdToRefName?.[refId]\n }\n\n refIdToOriginalName(refId: number) {\n return this.seqIdToOriginalRefName[refId]\n }\n\n getFeatures(\n region: Region & { originalRefName?: string },\n opts?: BaseOptions & {\n filterBy: IFilter\n },\n ) {\n const { signal, filterBy, statusCallback = () => {} } = opts || {}\n const { refName, start, end, originalRefName } = region\n\n return ObservableCreate<Feature>(async observer => {\n const { cram, samHeader } = await this.setup(opts)\n\n const refId = this.refNameToId(refName)\n if (refId === undefined) {\n console.warn('Unknown refName', refName)\n observer.complete()\n return\n }\n\n if (originalRefName) {\n this.seqIdToOriginalRefName[refId] = originalRefName\n }\n const records = await updateStatus(\n 'Downloading alignments',\n statusCallback,\n () => cram.getRecordsForRange(refId, start, end),\n )\n checkAbortSignal(signal)\n await updateStatus('Processing alignments', statusCallback, () => {\n const {\n flagInclude = 0,\n flagExclude = 0,\n tagFilter,\n readName,\n } = filterBy || {}\n\n for (const record of records) {\n const flags = record.flags\n if ((flags & flagInclude) !== flagInclude && !(flags & flagExclude)) {\n continue\n }\n\n if (tagFilter) {\n const readVal =\n tagFilter.tag === 'RG'\n ? samHeader.readGroups?.[record.readGroupId]\n : record.tags[tagFilter.tag]\n const filterVal = tagFilter.value\n if (\n filterVal === '*'\n ? readVal !== undefined\n : `${readVal}` !== `${filterVal}`\n ) {\n continue\n }\n }\n\n if (readName && record.readName !== readName) {\n continue\n }\n observer.next(this.cramRecordToFeature(record))\n }\n\n observer.complete()\n })\n }, signal)\n }\n\n freeResources(/* { region } */): void {}\n\n cramRecordToFeature(record: CramRecord) {\n return new CramSlightlyLazyFeature(record, this)\n }\n\n // we return the configured fetchSizeLimit, and the bytes for the region\n async getMultiRegionFeatureDensityStats(\n regions: Region[],\n opts?: BaseOptions,\n ) {\n const bytes = await this.bytesForRegions(regions, opts)\n const fetchSizeLimit = this.getConf('fetchSizeLimit')\n return {\n bytes,\n fetchSizeLimit,\n }\n }\n\n /**\n * get the approximate number of bytes queried from the file for the given\n * query regions\n * @param regions - list of query regions\n */\n private async bytesForRegions(regions: Region[], _opts?: BaseOptions) {\n const { cram } = await this.configure()\n const blockResults = await Promise.all(\n regions.map(region => {\n const { refName, start, end } = region\n const chrId = this.refNameToId(refName)\n return chrId !== undefined\n ? cram.index.getEntriesForRange(chrId, start, end)\n : [{ sliceBytes: 0 }]\n }),\n )\n\n return blockResults.flat().reduce((a, b) => a + b.sliceBytes, 0)\n }\n}\n"],"names":["CramSlightlyLazyFeature","constructor","record","_store","_get_name","this","readName","_get_start","alignmentStart","_get_end","lengthOnRef","_get_cram_read_features","readFeatures","_get_type","_get_score","mappingQuality","_get_flags","flags","_get_strand","isReverseComplemented","_read_group_id","samHeader","readGroups","readGroupId","_get_qual","qualityScores","join","qualRaw","_get_refName","refIdToName","sequenceId","_get_is_paired","mate","_get_pair_orientation","isPaired","getPairOrientation","undefined","_get_template_length","templateLength","templateSize","_get_next_ref","_get_next_segment_position","_get_next_pos","_get_tags","RG","tags","_get_seq","getReadBases","_get_CIGAR","readLen","refRegion","seq","cigar","op","oplen","ref","refStart","start","lastPos","sublen","insLen","code","refPos","sub","data","slice","ret","split","added","String","fromCharCode","length","readFeaturesToCIGAR","readLength","_refRegion","Object","getOwnPropertyNames","prototype","filter","prop","startsWith","map","methodName","replace","id","uniqueId","get","field","parent","children","set","pairedFeature","_get_clipPos","mismatches","at","type","cliplen","toJSON","fromEntries","t","elt","_get_mismatches","qual","Array","j","p","pos","base","altbase","toUpperCase","len","readFeaturesToMismatches","CramAdapter","BaseFeatureDataAdapter","seqIdToOriginalRefName","configurePre","cramLocation","getConf","craiLocation","pm","pluginManager","cram","IndexedCramFile","cramFilehandle","openLocation","index","CraiIndex","filehandle","seqFetch","args","checkSequenceMD5","getSubAdapter","Error","seqConf","sequenceAdapter","dataAdapter","configure","configureP","catch","e","getHeader","_opts","getHeaderText","seqId","end","refName","refIdToOriginalName","sequence","firstValueFrom","getFeatures","assemblyName","pipe","toArray","sort","a","b","chunk","chunkStart","chunkEnd","trimStart","Math","max","trimLength","min","qlen","toLocale","setupPre","opts","statusCallback","updateStatus","async","conf","getSamHeader","idToName","nameToId","l","tag","forEach","sqLine","refId","SN","find","item","value","rgLine","setup","setupP","getRefNames","refNameToId","seqIdToRefName","indexOf","region","signal","filterBy","originalRefName","ObservableCreate","console","warn","observer","complete","records","getRecordsForRange","checkAbortSignal","flagInclude","flagExclude","tagFilter","readVal","filterVal","next","cramRecordToFeature","freeResources","getMultiRegionFeatureDensityStats","regions","bytes","bytesForRegions","fetchSizeLimit","Promise","all","chrId","getEntriesForRange","sliceBytes","flat","reduce"],"sourceRoot":""} \ No newline at end of file