view x/static/js/6834.bc9e9f2b.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/6834.bc9e9f2b.chunk.js","mappings":"sOA0Be,MAAMA,UAAsBC,EAAAA,uBAOzC,kBAAaC,CAAaC,GACxB,MAAMC,EAAKC,KAAKC,cACVC,EAAS,IAAIC,EAAAA,EAAO,CACxBC,YAAYC,EAAAA,EAAAA,cAAaL,KAAKM,QAAQ,kBAAmBP,KAErDQ,QAAeL,EAAOM,UAAUV,GAEtC,MAAO,CAAEI,SAAQK,SAAQE,OADV,IAAIC,EAAAA,EAAI,CAAEC,QAASJ,EAAOI,UAE3C,CAEA,eAAaC,CAAUd,GAOrB,OANKE,KAAKa,SACRb,KAAKa,OAASb,KAAKH,aAAaC,GAAMgB,OAAOC,IAE3C,MADAf,KAAKa,YAASG,EACRD,CAAC,KAGJf,KAAKa,MACd,CAEA,iBAAaI,CAAYnB,GACvB,MAAM,OAAES,SAAiBP,KAAKY,UAAUd,GACxC,OAAOoB,OAAOC,KAAKZ,EAAOa,WAC5B,CAEA,eAAMZ,CAAUV,GACd,MAAM,OAAEW,EAAM,OAAEF,SAAiBP,KAAKY,UAAUd,IAC1C,QAAEuB,EAAO,SAAEC,GAAaf,GACxB,OAAEgB,KAAWC,GAASf,EAAOE,QACnC,MAAO,CACLU,UACAC,WACAX,QAAS,IAAKa,GACdD,OAAQL,OAAOO,YACbF,EAAOG,KAAI,EAAGC,OAAMC,aAAc,CAACD,EAAMC,MAG/C,CAEA,uBAAaC,CACXC,EACAhC,EACAiC,EACAC,EACAC,EAAgBH,GAEhB,MAAM,OAAEI,GAAWpC,EACbqC,EAAcnC,KAAKM,QAAQ,eAC3B8B,EAAiBpC,KAAKM,QAAQ,mBAC9B,OAAEG,EAAM,O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ed/src/util.ts"],"sourcesContent":["import { BigBed } from '@gmod/bbi'\nimport BED from '@gmod/bed'\nimport {\n  BaseFeatureDataAdapter,\n  BaseOptions,\n} from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { Region } from '@jbrowse/core/util/types'\nimport { openLocation } from '@jbrowse/core/util/io'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\nimport {\n  doesIntersect2,\n  max,\n  min,\n  Feature,\n  SimpleFeature,\n} from '@jbrowse/core/util'\nimport { Observer } from 'rxjs'\nimport { SimpleFeatureSerializedNoId } from '@jbrowse/core/util/simpleFeature'\n\n// locals\nimport {\n  isUcscProcessedTranscript,\n  makeBlocks,\n  ucscProcessedTranscript,\n} from '../util'\n\nexport default class BigBedAdapter extends BaseFeatureDataAdapter {\n  private cached?: Promise<{\n    bigbed: BigBed\n    header: Awaited<ReturnType<BigBed['getHeader']>>\n    parser: BED\n  }>\n\n  public async configurePre(opts?: BaseOptions) {\n    const pm = this.pluginManager\n    const bigbed = new BigBed({\n      filehandle: openLocation(this.getConf('bigBedLocation'), pm),\n    })\n    const header = await bigbed.getHeader(opts)\n    const parser = new BED({ autoSql: header.autoSql })\n    return { bigbed, header, parser }\n  }\n\n  public async configure(opts?: BaseOptions) {\n    if (!this.cached) {\n      this.cached = this.configurePre(opts).catch((e: unknown) => {\n        this.cached = undefined\n        throw e\n      })\n    }\n    return this.cached\n  }\n\n  public async getRefNames(opts?: BaseOptions) {\n    const { header } = await this.configure(opts)\n    return Object.keys(header.refsByName)\n  }\n\n  async getHeader(opts?: BaseOptions) {\n    const { parser, header } = await this.configure(opts)\n    const { version, fileType } = header\n    const { fields, ...rest } = parser.autoSql\n    return {\n      version,\n      fileType,\n      autoSql: { ...rest },\n      fields: Object.fromEntries(\n        fields.map(({ name, comment }) => [name, comment]),\n      ),\n    }\n  }\n\n  public async getFeaturesHelper(\n    query: Region,\n    opts: BaseOptions,\n    observer: Observer<Feature>,\n    allowRedispatch: boolean,\n    originalQuery = query,\n  ) {\n    const { signal } = opts\n    const scoreColumn = this.getConf('scoreColumn')\n    const aggregateField = this.getConf('aggregateField')\n    const { parser, bigbed } = await this.configure(opts)\n    const feats = await bigbed.getFeatures(\n      query.refName,\n      query.start,\n      query.end,\n      {\n        signal,\n        basesPerSpan: query.end - query.start,\n      },\n    )\n    if (allowRedispatch && feats.length) {\n      let minStart = Number.POSITIVE_INFINITY\n      let maxEnd = Number.NEGATIVE_INFINITY\n      for (const feat of feats) {\n        if (feat.start < minStart) {\n          minStart = feat.start\n        }\n        if (feat.end > maxEnd) {\n          maxEnd = feat.end\n        }\n      }\n      if (maxEnd > query.end || minStart < query.start) {\n        await this.getFeaturesHelper(\n          { ...query, start: minStart, end: maxEnd },\n          opts,\n          observer,\n          false,\n          query,\n        )\n        return\n      }\n    }\n\n    const parentAggregation = {} as Record<\n      string,\n      SimpleFeatureSerializedNoId[]\n    >\n\n    if (feats.some(f => f.uniqueId === undefined)) {\n      throw new Error('found uniqueId undefined')\n    }\n    for (const feat of feats) {\n      const data = parser.parseLine(\n        `${query.refName}\\t${feat.start}\\t${feat.end}\\t${feat.rest}`,\n        { uniqueId: feat.uniqueId! },\n      )\n\n      const aggr = data[aggregateField]\n      if (!parentAggregation[aggr]) {\n        parentAggregation[aggr] = []\n      }\n      const {\n        uniqueId,\n        type,\n        chromStart,\n        chromStarts,\n        blockStarts,\n        blockCount,\n        blockSizes,\n        chromEnd,\n        thickStart,\n        thickEnd,\n        chrom,\n        score,\n        ...rest\n      } = data\n\n      const subfeatures = blockCount\n        ? makeBlocks({\n            chromStarts,\n            blockStarts,\n            blockCount,\n            blockSizes,\n            uniqueId,\n            refName: query.refName,\n            start: feat.start,\n          })\n        : []\n\n      if (isUcscProcessedTranscript(data)) {\n        const f = ucscProcessedTranscript({\n          ...rest,\n          uniqueId,\n          type,\n          start: feat.start,\n          end: feat.end,\n          refName: query.refName,\n          score: scoreColumn ? +data[scoreColumn] : score,\n          chromStarts,\n          blockCount,\n          blockSizes,\n          thickStart,\n          thickEnd,\n          subfeatures,\n        })\n        if (aggr) {\n          parentAggregation[aggr].push(f)\n        } else {\n          if (\n            doesIntersect2(\n              f.start,\n              f.end,\n              originalQuery.start,\n              originalQuery.end,\n            )\n          ) {\n            observer.next(\n              new SimpleFeature({ id: `${this.id}-${uniqueId}`, data: f }),\n            )\n          }\n        }\n      } else {\n        if (\n          doesIntersect2(\n            feat.start,\n            feat.end,\n            originalQuery.start,\n            originalQuery.end,\n          )\n        ) {\n          observer.next(\n            new SimpleFeature({\n              id: `${this.id}-${uniqueId}`,\n              data: {\n                ...rest,\n                uniqueId,\n                type,\n                start: feat.start,\n                score: scoreColumn ? +data[scoreColumn] : score,\n                end: feat.end,\n                refName: query.refName,\n                subfeatures,\n              },\n            }),\n          )\n        }\n      }\n    }\n\n    Object.entries(parentAggregation).map(([name, subfeatures]) => {\n      const s = min(subfeatures.map(f => f.start))\n      const e = max(subfeatures.map(f => f.end))\n      if (doesIntersect2(s, e, originalQuery.start, originalQuery.end)) {\n        const { uniqueId, strand } = subfeatures[0]!\n        observer.next(\n          new SimpleFeature({\n            id: `${this.id}-${uniqueId}-parent`,\n            data: {\n              type: 'gene',\n              subfeatures,\n              strand,\n              name,\n              start: s,\n              end: e,\n              refName: query.refName,\n            },\n          }),\n        )\n      }\n    })\n    observer.complete()\n  }\n  public getFeatures(query: Region, opts: BaseOptions = {}) {\n    return ObservableCreate<Feature>(async observer => {\n      try {\n        await this.getFeaturesHelper(query, opts, observer, true)\n      } catch (e) {\n        observer.error(e)\n      }\n    }, opts.signal)\n  }\n\n  public freeResources(): void {}\n}\n","import BED from '@gmod/bed'\nimport { SimpleFeature } from '@jbrowse/core/util'\n\nexport interface MinimalFeature {\n  type: string\n  start: number\n  end: number\n  refName: string\n  [key: string]: unknown\n}\nexport interface TranscriptFeat extends MinimalFeature {\n  thickStart: number\n  thickEnd: number\n  blockCount: number\n  blockSizes: number[]\n  chromStarts: number[]\n  refName: string\n  strand?: number\n  subfeatures: MinimalFeature[]\n}\n\nexport function ucscProcessedTranscript(feature: TranscriptFeat) {\n  const {\n    subfeatures: oldSubfeatures,\n    thickStart,\n    thickEnd,\n    blockCount,\n    blockSizes,\n    chromStarts,\n    refName,\n    strand = 0,\n    ...rest\n  } = feature\n\n  if (!thickStart || !thickEnd || !strand) {\n    return feature\n  }\n\n  const subfeatures: MinimalFeature[] = []\n  oldSubfeatures\n    .filter(child => child.type === 'block')\n    .sort((a, b) => a.start - b.start)\n    .forEach(block => {\n      const start = block.start\n      const end = block.end\n      if (thickStart >= end) {\n        // left-side UTR\n        const prime = strand > 0 ? 'five' : 'three'\n        subfeatures.push({\n          type: `${prime}_prime_UTR`,\n          start,\n          end,\n          refName,\n        })\n      } else if (thickStart > start && thickStart < end && thickEnd >= end) {\n        // UTR | CDS\n        const prime = strand > 0 ? 'five' : 'three'\n        subfeatures.push(\n          {\n            type: `${prime}_prime_UTR`,\n            start,\n            end: thickStart,\n            refName,\n          },\n          {\n            type: 'CDS',\n            start: thickStart,\n            end,\n            refName,\n          },\n        )\n      } else if (thickStart <= start && thickEnd >= end) {\n        // CDS\n        subfeatures.push({\n          type: 'CDS',\n          start,\n          end,\n          refName,\n        })\n      } else if (thickStart > start && thickStart < end && thickEnd < end) {\n        // UTR | CDS | UTR\n        const leftPrime = strand > 0 ? 'five' : 'three'\n        const rightPrime = strand > 0 ? 'three' : 'five'\n        subfeatures.push(\n          {\n            type: `${leftPrime}_prime_UTR`,\n            start,\n            end: thickStart,\n            refName,\n          },\n          {\n            type: 'CDS',\n            start: thickStart,\n            end: thickEnd,\n            refName,\n          },\n          {\n            type: `${rightPrime}_prime_UTR`,\n            start: thickEnd,\n            end,\n            refName,\n          },\n        )\n      } else if (thickStart <= start && thickEnd > start && thickEnd < end) {\n        // CDS | UTR\n        const prime = strand > 0 ? 'three' : 'five'\n        subfeatures.push(\n          {\n            type: 'CDS',\n            start,\n            end: thickEnd,\n            refName,\n          },\n          {\n            type: `${prime}_prime_UTR`,\n            start: thickEnd,\n            end,\n            refName,\n          },\n        )\n      } else if (thickEnd <= start) {\n        // right-side UTR\n        const prime = strand > 0 ? 'three' : 'five'\n        subfeatures.push({\n          type: `${prime}_prime_UTR`,\n          start,\n          end,\n          refName,\n        })\n      }\n    })\n\n  return { ...rest, strand, type: 'mRNA', refName, subfeatures }\n}\n\nfunction defaultParser(fields: string[], line: string) {\n  const obj = Object.fromEntries(\n    line.split('\\t').map((f, i) => [fields[i]!, f] as const),\n  )\n  const {\n    blockStarts,\n    blockCount,\n    chromStarts,\n    thickEnd,\n    thickStart,\n    blockSizes,\n    ...rest\n  } = obj\n\n  return {\n    ...rest,\n    blockStarts: blockStarts?.split(',').map(r => +r),\n    chromStarts: chromStarts?.split(',').map(r => +r),\n    blockSizes: blockSizes?.split(',').map(r => +r),\n    thickStart: thickStart ? +thickStart : undefined,\n    thickEnd: thickEnd ? +thickEnd : undefined,\n    blockCount: blockCount ? +blockCount : undefined,\n  } as Record<string, unknown>\n}\n\nexport function makeBlocks({\n  start,\n  uniqueId,\n  refName,\n  chromStarts,\n  blockCount,\n  blockSizes,\n  blockStarts,\n}: {\n  blockCount: number\n  start: number\n  uniqueId: string\n  refName: string\n  chromStarts?: number[]\n  blockSizes: number[]\n  blockStarts?: number[]\n}) {\n  const subfeatures = []\n  const starts = chromStarts || blockStarts || []\n  for (let b = 0; b < blockCount; b++) {\n    const bmin = (starts[b] || 0) + start\n    const bmax = bmin + (blockSizes[b] || 0)\n    subfeatures.push({\n      uniqueId: `${uniqueId}-${b}`,\n      start: bmin,\n      end: bmax,\n      refName,\n      type: 'block',\n    })\n  }\n  return subfeatures\n}\nexport function featureData(\n  line: string,\n  colRef: number,\n  colStart: number,\n  colEnd: number,\n  scoreColumn: string,\n  parser: BED,\n  uniqueId: string,\n  names?: string[],\n) {\n  const l = line.split('\\t')\n  const refName = l[colRef]!\n  const start = +l[colStart]!\n  const colSame = colStart === colEnd ? 1 : 0\n  const end = +l[colEnd]! + colSame\n  const data = names\n    ? defaultParser(names, line)\n    : parser.parseLine(line, { uniqueId })\n\n  const {\n    blockCount,\n    blockSizes,\n    blockStarts,\n    chromStarts,\n    thickStart,\n    thickEnd,\n    type,\n    score,\n    chrom: _1,\n    chromStart: _2,\n    chromEnd: _3,\n    ...rest\n  } = data\n  const subfeatures = blockCount\n    ? makeBlocks({\n        start,\n        uniqueId,\n        refName,\n        chromStarts,\n        blockCount,\n        blockSizes,\n        blockStarts,\n      })\n    : []\n  const f = {\n    ...rest,\n    type,\n    score: scoreColumn ? +data[scoreColumn] : score,\n    start,\n    end,\n    refName,\n    uniqueId,\n    subfeatures,\n  }\n  return new SimpleFeature({\n    id: uniqueId,\n    data: isUcscProcessedTranscript(data)\n      ? ucscProcessedTranscript({\n          thickStart: thickStart!,\n          thickEnd: thickEnd!,\n          blockCount: blockCount!,\n          blockSizes: blockSizes!,\n          chromStarts: chromStarts,\n          ...f,\n        })\n      : f,\n  })\n}\n\nexport function isUcscProcessedTranscript(f: {\n  thickStart?: number\n  blockCount?: number\n  strand?: number\n}) {\n  return f.thickStart && f.blockCount && f.strand !== 0\n}\n"],"names":["BigBedAdapter","BaseFeatureDataAdapter","configurePre","opts","pm","this","pluginManager","bigbed","BigBed","filehandle","openLocation","getConf","header","getHeader","parser","BED","autoSql","configure","cached","catch","e","undefined","getRefNames","Object","keys","refsByName","version","fileType","fields","rest","fromEntries","map","name","comment","getFeaturesHelper","query","observer","allowRedispatch","originalQuery","signal","scoreColumn","aggregateField","feats","getFeatures","refName","start","end","basesPerSpan","length","minStart","Number","POSITIVE_INFINITY","maxEnd","NEGATIVE_INFINITY","feat","parentAggregation","some","f","uniqueId","Error","data","parseLine","aggr","type","chromStart","chromStarts","blockStarts","blockCount","blockSizes","chromEnd","thickStart","thickEnd","chrom","score","subfeatures","makeBlocks","isUcscProcessedTranscript","ucscProcessedTranscript","push","doesIntersect2","next","SimpleFeature","id","entries","s","min","max","strand","complete","ObservableCreate","async","error","freeResources","feature","oldSubfeatures","filter","child","sort","a","b","forEach","block","prime","leftPrime","rightPrime","starts","bmin","bmax","featureData","line","colRef","colStart","colEnd","names","l","split","colSame","obj","i","r","defaultParser","_1","_2","_3"],"sourceRoot":""}