Mercurial > repos > fubar > jbrowse2
view x/static/js/4770.3d757d6b.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 source
{"version":3,"file":"static/js/4770.3d757d6b.chunk.js","mappings":"mPAUe,MAAMA,EAGnBC,WAAAA,CACUC,EACAC,EACAC,GACR,KAHQF,OAAAA,EAAiB,KACjBC,QAAAA,EAAmB,KACnBC,IAAAA,CACP,CAEHC,SAAAA,GACE,OAAOC,KAAKJ,OAAOK,IAAI,OACzB,CAEAC,SAAAA,GACE,MAAO,OACT,CAEAC,UAAAA,GACE,OAAOH,KAAKJ,OAAOK,IAAI,KACzB,CAEAG,UAAAA,GACE,OAAOJ,KAAKJ,OAAOS,KACrB,CAEAC,WAAAA,GACE,OAAON,KAAKJ,OAAOW,yBAA2B,EAAI,CACpD,CAEAC,qBAAAA,GACE,OAAOR,KAAKJ,OAAOa,WAAaT,KAAKJ,OAAOc,0BAAuBC,CACrE,CAEAC,aAAAA,GACE,OAAOZ,KAAKJ,OAAOa,WACfT,KAAKH,QAAQgB,YAAYb,KAAKJ,OAAOkB,oBACrCH,CACN,CAEAI,aAAAA,GACE,OAAOf,KAAKJ,OAAOa,WAAaT,KAAKJ,OAAOoB,iBAAcL,CAC5D,CAEAM,0BAAAA,GACE,OAAOjB,KAAKJ,OAAOa,WACf,GAAGT,KAAKH,QAAQgB,YAAYb,KAAKJ,OAAOkB,kBACtCd,KAAKJ,OAAOoB,YAAc,SAE5BL,CACN,CAEAO,QAAAA,GACE,OAAOlB,KAAKJ,OAAOuB,cACrB,CAEAC,OAAAA,GACE,OAAOpB,KAAKJ,OAAOwB,SACrB,CAEAC,GAAAA,GAAO,CAEPC,IAAAA,GACE,MAAMC,EAAaC,OAAOC,oBACxB/B,EAAuBgC,WAGz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QAAgBlD,EAAAA,EAAAA,cACpB,yBACAF,GACA,IAAMrB,EAAI0E,mBAAmBtC,EAASM,EAAOC,EAAKzB,WAG9CK,EAAAA,EAAAA,cAAa,wBAAyBF,GAAgBG,UAC1D,MAAM,YACJmD,EAAc,EAAC,YACfC,EAAc,EAAC,UACfC,EAAS,SACTC,GACEP,GAAY,CAAC,EAEjB,IAAK,MAAM1I,KAAU4I,EAAS,CAC5B,IAAI1I,EACCF,EAAOK,IAAI,QACdH,QAAYE,KAAKwG,SACf4B,GAAmBjC,EACnBvG,EAAOK,IAAI,SACXL,EAAOK,IAAI,SAIf,MAAMI,EAAQT,EAAOS,MACrB,IAAKA,EAAQqI,KAAiBA,GAAiBrI,EAAQsI,EAAvD,CAIA,GAAIC,EAAW,CACb,MAAME,EAAUlJ,EAAOK,IAAI2I,EAAUjD,KAC/BoD,EAAYH,EAAUxC,MAC5B,GACgB,MAAd2C,OACgBpI,IAAZmI,EACA,GAAGA,KAAc,GAAGC,IAExB,QAEJ,CAEIF,GAAYjJ,EAAOK,IAAI,UAAY4I,GAIvCG,EAASC,KAAK,IAAIvJ,EAAuBE,EAAQI,KAAMF,GAlBvD,CAmBF,CACAkJ,EAASE,UAAU,GACnB,GACDb,EACL,CAEA,uCAAMc,CACJC,EACAnE,GAEA,MAAM,IAAElB,SAAc/D,KAAK4E,YAE3B,OAAIb,EAAIsF,MAGC,CAAEC,YAFWC,EAAAA,EAAAA,iBAAgBH,EAASrF,GAE7ByF,eADOxJ,KAAKyD,QAAQ,mBAG/BgG,MAAMN,kCAAkCC,EAASnE,EAC1D,CAEAyE,aAAAA,GAAuC,CAGvC7I,WAAAA,CAAYiF,GACV,OAAO9F,KAAKqF,WAAWG,SAASM,EAClC,E","sources":["../../../plugins/alignments/src/BamAdapter/BamSlightlyLazyFeature.ts","../../../plugins/alignments/src/BamAdapter/BamAdapter.ts"],"sourcesContent":["import {\n Feature,\n SimpleFeatureSerialized,\n} from '@jbrowse/core/util/simpleFeature'\nimport { BamRecord } from '@gmod/bam'\n\n// locals\nimport { getClip, getMismatches } from '../MismatchParser'\nimport BamAdapter from './BamAdapter'\n\nexport default class BamSlightlyLazyFeature 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: BamRecord,\n private adapter: BamAdapter,\n private ref?: string,\n ) {}\n\n _get_name() {\n return this.record.get('name')\n }\n\n _get_type(): string {\n return 'match'\n }\n\n _get_score(): number {\n return this.record.get('mq')\n }\n\n _get_flags(): string {\n return this.record.flags\n }\n\n _get_strand(): number {\n return this.record.isReverseComplemented() ? -1 : 1\n }\n\n _get_pair_orientation() {\n return this.record.isPaired() ? this.record.getPairOrientation() : undefined\n }\n\n _get_next_ref() {\n return this.record.isPaired()\n ? this.adapter.refIdToName(this.record._next_refid())\n : undefined\n }\n\n _get_next_pos() {\n return this.record.isPaired() ? this.record._next_pos() : undefined\n }\n\n _get_next_segment_position() {\n return this.record.isPaired()\n ? `${this.adapter.refIdToName(this.record._next_refid())}:${\n this.record._next_pos() + 1\n }`\n : undefined\n }\n\n _get_seq() {\n return this.record.getReadBases()\n }\n\n qualRaw() {\n return this.record.qualRaw()\n }\n\n set() {}\n\n tags() {\n const properties = Object.getOwnPropertyNames(\n BamSlightlyLazyFeature.prototype,\n )\n\n return [\n ...new Set(\n properties\n .filter(\n prop =>\n prop.startsWith('_get_') &&\n prop !== '_get_mismatches' &&\n prop !== '_get_tags',\n )\n .map(methodName => methodName.replace('_get_', ''))\n .concat(this.record._tags()),\n ),\n ]\n }\n\n id() {\n return `${this.adapter.id}-${this.record.id()}`\n }\n\n get(field: string): any {\n const methodName = `_get_${field}`\n // @ts-expect-error\n if (this[methodName]) {\n // @ts-expect-error\n return this[methodName]()\n }\n return this.record.get(field)\n }\n\n _get_refName() {\n return this.adapter.refIdToName(this.record.seq_id())\n }\n\n parent() {\n return undefined\n }\n\n children() {\n return undefined\n }\n\n pairedFeature() {\n return false\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 return getMismatches(\n this.get('CIGAR'),\n this.get('MD'),\n this.get('seq'),\n this.ref,\n this.qualRaw(),\n )\n }\n\n _get_clipPos() {\n const cigar = this.get('CIGAR') || ''\n return getClip(cigar, this.get('strand'))\n }\n}\n","import { BamFile } from '@gmod/bam'\nimport {\n BaseFeatureDataAdapter,\n BaseOptions,\n} from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { Region } from '@jbrowse/core/util/types'\nimport { bytesForRegions, updateStatus, Feature } 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 BamSlightlyLazyFeature from './BamSlightlyLazyFeature'\nimport { IFilter } from '../shared'\n\ninterface Header {\n idToName: string[]\n nameToId: Record<string, number>\n}\n\nexport default class BamAdapter extends BaseFeatureDataAdapter {\n private samHeader?: Header\n\n private setupP?: Promise<Header>\n private configureP?: Promise<{\n bam: BamFile\n sequenceAdapter?: BaseFeatureDataAdapter\n }>\n\n // derived classes may not use the same configuration so a custom configure\n // method allows derived classes to override this behavior\n protected async configurePre() {\n const bamLocation = this.getConf('bamLocation')\n const location = this.getConf(['index', 'location'])\n const indexType = this.getConf(['index', 'indexType'])\n const pm = this.pluginManager\n const csi = indexType === 'CSI'\n const bam = new BamFile({\n bamFilehandle: openLocation(bamLocation, pm),\n csiFilehandle: csi ? openLocation(location, pm) : undefined,\n baiFilehandle: !csi ? openLocation(location, pm) : undefined,\n yieldThreadTime: Number.POSITIVE_INFINITY,\n })\n\n const adapterConfig = this.getConf('sequenceAdapter')\n if (adapterConfig && this.getSubAdapter) {\n const { dataAdapter } = await this.getSubAdapter(adapterConfig)\n return {\n bam,\n sequenceAdapter: dataAdapter as BaseFeatureDataAdapter,\n }\n }\n return { bam }\n }\n\n protected 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 { bam } = await this.configure()\n return bam.getHeaderText(opts)\n }\n\n private async setupPre(opts?: BaseOptions) {\n const { statusCallback = () => {} } = opts || {}\n const { bam } = await this.configure()\n this.samHeader = await updateStatus(\n 'Downloading index',\n statusCallback,\n async () => {\n const samHeader = await bam.getHeader(opts)\n\n // use the @SQ lines in the header to figure out the\n // mapping between ref 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 // this is the ref name\n const refName = SN.value\n nameToId[refName] = refId\n idToName[refId] = refName\n }\n })\n\n return { idToName, nameToId }\n },\n )\n return this.samHeader\n }\n\n 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 { idToName } = await this.setup(opts)\n return idToName\n }\n\n private async seqFetch(refName: string, start: number, end: number) {\n const { sequenceAdapter } = await this.configure()\n const refSeqStore = sequenceAdapter\n if (!refSeqStore) {\n return undefined\n }\n if (!refName) {\n return undefined\n }\n\n const features = refSeqStore.getFeatures({\n refName,\n start,\n end,\n assemblyName: '',\n })\n\n const seqChunks = await firstValueFrom(features.pipe(toArray()))\n\n let sequence = ''\n seqChunks\n .sort((a, b) => a.get('start') - b.get('start'))\n .forEach(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 sequence += chunkSeq.slice(trimStart, trimStart + trimLength)\n })\n\n if (sequence.length !== end - start) {\n throw new Error(\n `sequence fetch failed: fetching ${refName}:${(\n start - 1\n ).toLocaleString()}-${end.toLocaleString()} returned ${sequence.length.toLocaleString()} bases, but should have returned ${(\n end - start\n ).toLocaleString()}`,\n )\n }\n return sequence\n }\n\n getFeatures(\n region: Region & { originalRefName?: string },\n opts?: BaseOptions & {\n filterBy: IFilter\n },\n ) {\n const { refName, start, end, originalRefName } = region\n const { signal, filterBy, statusCallback = () => {} } = opts || {}\n return ObservableCreate<Feature>(async observer => {\n const { bam } = await this.configure()\n await this.setup(opts)\n const records = await updateStatus(\n 'Downloading alignments',\n statusCallback,\n () => bam.getRecordsForRange(refName, start, end, opts),\n )\n\n await updateStatus('Processing alignments', statusCallback, async () => {\n const {\n flagInclude = 0,\n flagExclude = 0,\n tagFilter,\n readName,\n } = filterBy || {}\n\n for (const record of records) {\n let ref: string | undefined\n if (!record.get('MD')) {\n ref = await this.seqFetch(\n originalRefName || refName,\n record.get('start'),\n record.get('end'),\n )\n }\n\n const flags = record.flags\n if ((flags & flagInclude) !== flagInclude && !(flags & flagExclude)) {\n continue\n }\n\n if (tagFilter) {\n const readVal = record.get(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.get('name') !== readName) {\n continue\n }\n\n observer.next(new BamSlightlyLazyFeature(record, this, ref))\n }\n observer.complete()\n })\n }, signal)\n }\n\n async getMultiRegionFeatureDensityStats(\n regions: Region[],\n opts?: BaseOptions,\n ) {\n const { bam } = await this.configure()\n // this is a method to avoid calling on htsget adapters\n if (bam.index) {\n const bytes = await bytesForRegions(regions, bam)\n const fetchSizeLimit = this.getConf('fetchSizeLimit')\n return { bytes, fetchSizeLimit }\n }\n return super.getMultiRegionFeatureDensityStats(regions, opts)\n }\n\n freeResources(/* { region } */): void {}\n\n // depends on setup being called before the BAM constructor\n refIdToName(refId: number) {\n return this.samHeader?.idToName[refId]\n }\n}\n"],"names":["BamSlightlyLazyFeature","constructor","record","adapter","ref","_get_name","this","get","_get_type","_get_score","_get_flags","flags","_get_strand","isReverseComplemented","_get_pair_orientation","isPaired","getPairOrientation","undefined","_get_next_ref","refIdToName","_next_refid","_get_next_pos","_next_pos","_get_next_segment_position","_get_seq","getReadBases","qualRaw","set","tags","properties","Object","getOwnPropertyNames","prototype","Set","filter","prop","startsWith","map","methodName","replace","concat","_tags","id","field","_get_refName","seq_id","parent","children","pairedFeature","toJSON","fromEntries","t","elt","uniqueId","_get_mismatches","getMismatches","_get_clipPos","cigar","getClip","BamAdapter","BaseFeatureDataAdapter","configurePre","bamLocation","getConf","location","indexType","pm","pluginManager","csi","bam","BamFile","bamFilehandle","openLocation","csiFilehandle","baiFilehandle","yieldThreadTime","Number","POSITIVE_INFINITY","adapterConfig","getSubAdapter","dataAdapter","sequenceAdapter","configure","configureP","catch","e","getHeader","opts","getHeaderText","setupPre","statusCallback","samHeader","updateStatus","async","idToName","nameToId","l","tag","forEach","sqLine","refId","SN","data","find","item","refName","value","setup","setupP","getRefNames","seqFetch","start","end","features","getFeatures","assemblyName","seqChunks","firstValueFrom","pipe","toArray","sequence","sort","a","b","chunk","chunkStart","chunkEnd","trimStart","Math","max","trimLength","min","chunkSeq","slice","length","Error","toLocaleString","region","originalRefName","signal","filterBy","ObservableCreate","records","getRecordsForRange","flagInclude","flagExclude","tagFilter","readName","readVal","filterVal","observer","next","complete","getMultiRegionFeatureDensityStats","regions","index","bytes","bytesForRegions","fetchSizeLimit","super","freeResources"],"sourceRoot":""}