jbrowse-plugin-graphgenomeviewer 3.0.4 → 3.1.0
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/README.md +29 -2
- package/dist/chunks/GbzBaseSyntenyAdapter-MIOUYHOF.js +8 -0
- package/dist/chunks/GbzBaseSyntenyAdapter-MIOUYHOF.js.map +7 -0
- package/dist/chunks/GraphGenomeView-TM7WYDLH.js +14 -0
- package/dist/chunks/GraphGenomeView-TM7WYDLH.js.map +7 -0
- package/dist/chunks/MinigraphBubbleAdapter-A7SBF2XY.js +2 -0
- package/dist/chunks/MinigraphBubbleAdapter-A7SBF2XY.js.map +7 -0
- package/dist/chunks/RgfaTabixAdapter-7ZGKJJYW.js +3 -0
- package/dist/chunks/RgfaTabixAdapter-7ZGKJJYW.js.map +7 -0
- package/dist/chunks/{chunk-X3X74OGB.js → chunk-7T2HTRP3.js} +2 -2
- package/dist/chunks/{chunk-X3X74OGB.js.map → chunk-7T2HTRP3.js.map} +3 -3
- package/dist/chunks/{chunk-JCG7RLMB.js → chunk-HOM2Y6XS.js} +2 -2
- package/dist/chunks/chunk-HOM2Y6XS.js.map +7 -0
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +21 -22
- package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.test.ts +69 -0
- package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.ts +13 -10
- package/src/GetSubgraph.ts +5 -1
- package/src/GraphGenomeView/components/FollowControl.test.tsx +69 -0
- package/src/GraphGenomeView/components/FollowControl.tsx +42 -0
- package/src/GraphGenomeView/components/GraphStats.tsx +1 -0
- package/src/GraphGenomeView/components/GraphToolbar.tsx +2 -0
- package/src/GraphGenomeView/follow.test.ts +624 -0
- package/src/GraphGenomeView/follow.ts +129 -0
- package/src/GraphGenomeView/layout/sampleRowLayout.test.ts +16 -0
- package/src/GraphGenomeView/layout/sampleRowLayout.ts +13 -4
- package/src/GraphGenomeView/layoutModes.ts +3 -1
- package/src/GraphGenomeView/model.ts +361 -55
- package/src/GraphGenomeView/types.ts +4 -0
- package/src/MinigraphBubbleAdapter/MinigraphBubbleAdapter.ts +1 -1
- package/src/RgfaTabixAdapter/RgfaTabixAdapter.test.ts +73 -0
- package/src/RgfaTabixAdapter/RgfaTabixAdapter.ts +48 -16
- package/src/RgfaTabixAdapter/configSchema.ts +70 -3
- package/src/RgfaTabixAdapter/test_data/rgfa_ecoli.tier1000.links.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/rgfa_ecoli.tier1000.links.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/rgfa_ecoli.tier1000.segs.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/rgfa_ecoli.tier1000.segs.bed.gz.tbi +0 -0
- package/src/launchSubgraph/index.ts +12 -6
- package/src/launchSubgraph/launchSubgraph.test.ts +89 -3
- package/src/launchSubgraph/launchSubgraphView.ts +14 -6
- package/src/launchSubgraph/linearViewMenuItems.ts +3 -0
- package/src/launchSubgraph/subgraphMenuItems.ts +7 -0
- package/src/launchSubgraph/testEnv.ts +2 -0
- package/src/panSNTabix.ts +6 -5
- package/src/synteny/ComparativeAdapterBase.ts +13 -10
- package/src/synteny/clipFeatureToRegion.test.ts +41 -1
- package/src/synteny/clipFeatureToRegion.ts +22 -5
- package/src/version.ts +1 -1
- package/dist/chunks/GbzBaseSyntenyAdapter-6UTRY4CV.js +0 -8
- package/dist/chunks/GbzBaseSyntenyAdapter-6UTRY4CV.js.map +0 -7
- package/dist/chunks/GraphGenomeView-UD5WCV3Q.js +0 -14
- package/dist/chunks/GraphGenomeView-UD5WCV3Q.js.map +0 -7
- package/dist/chunks/MinigraphBubbleAdapter-B75VQK7T.js +0 -2
- package/dist/chunks/MinigraphBubbleAdapter-B75VQK7T.js.map +0 -7
- package/dist/chunks/RgfaTabixAdapter-IT7I5RR3.js +0 -3
- package/dist/chunks/RgfaTabixAdapter-IT7I5RR3.js.map +0 -7
- package/dist/chunks/chunk-JCG7RLMB.js.map +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/MinigraphBubbleAdapter/MinigraphBubbleAdapter.ts"],
|
|
4
|
-
"sourcesContent": ["import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { SimpleFeature, updateStatus } from '@jbrowse/core/util'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\n\nimport { PanSNRefNames, openTabixSlot } from '../panSNTabix.ts'\nimport {\n bubbleDescription,\n bubbleLabel,\n parseBubbleLine,\n} from './bubbleLine.ts'\n\nimport type { MinigraphBubbleAdapterConfig } from './configSchema.ts'\nimport type PluginManager from '@jbrowse/core/PluginManager'\nimport type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport type { Feature } from '@jbrowse/core/util'\nimport type { Region } from '@jbrowse/core/util/types'\n\nexport default class MinigraphBubbleAdapter extends BaseFeatureDataAdapter<MinigraphBubbleAdapterConfig> {\n public static capabilities = ['getFeatures', 'getRefNames']\n\n private readonly bubbles\n // `gfatools bubble` names each row after the graph's stable sequence, so a\n // Minigraph-Cactus graph produces PanSN rows (`GRCh38#0#chr6`) where a plain\n // minigraph graph produces bare ones (`chr6`). Same resolution the segment\n // adapter does, through the same `assemblyNameToPanSN` slot.\n private readonly refNames\n\n public constructor(\n config: MinigraphBubbleAdapterConfig,\n getSubAdapter?: getSubAdapterType,\n pluginManager?: PluginManager,\n ) {\n super(config, getSubAdapter, pluginManager)\n this.bubbles = openTabixSlot(this, 'bubblesLocation', 'index')\n this.refNames = new PanSNRefNames(this.bubbles, this)\n }\n\n async getRefNames(opts: BaseOptions = {}) {\n return this.refNames.assemblyRefNames(opts)\n }\n\n public async hasDataForRefName() {\n return true\n }\n\n getFeatures(query: Region, opts: BaseOptions = {}) {\n const { signal, statusCallback } = opts\n return ObservableCreate<Feature>(async observer => {\n const tabixRefName = await this.refNames.resolve(query, opts)\n if (tabixRefName !== undefined) {\n await updateStatus('Downloading bubbles', statusCallback, () =>\n this.bubbles.getLines(tabixRefName, query.start, query.end, {\n signal,\n lineCallback: (line, fileOffset) => {\n const bubble = parseBubbleLine(line)\n observer.next(\n new SimpleFeature({\n uniqueId: `bubble-${fileOffset}`,\n refName: query.refName,\n start: bubble.start,\n end: bubble.end,\n // How variable this spot is, in two words, since that is the\n // whole point of the track.\n name: bubbleLabel(bubble),\n description: bubbleDescription(bubble),\n type: 'bubble',\n score: bubble.segmentCount,\n segmentCount: bubble.segmentCount,\n pathCount: bubble.pathCount,\n inversion: bubble.inversion,\n shortestAlleleLength: bubble.shortestAlleleLength,\n longestAlleleLength: bubble.longestAlleleLength,\n segments: bubble.segments,\n shortestAllele: bubble.shortestAllele,\n longestAllele: bubble.longestAllele,\n }),\n )\n },\n }),\n )\n }\n observer.complete()\n }, signal)\n }\n}\n"],
|
|
5
|
-
"mappings": "4RAAA,IAAAA,EAAuC,SACvCC,EAA4C,SAC5CC,EAAiC,SAgBjC,IAAqBC,EAArB,cAAoD,wBAAqD,CACvG,YAAc,aAAe,CAAC,cAAe,aAAa,EASnD,YACLC,EACAC,EACAC,EACA,CACA,MAAMF,EAAQC,EAAeC,CAAa,EAC1C,KAAK,QAAUC,EAAc,KAAM,kBAAmB,OAAO,EAC7D,KAAK,SAAW,IAAIC,EAAc,KAAK,QAAS,IAAI,CACtD,CAEA,MAAM,YAAYC,EAAoB,CAAC,EAAG,CACxC,OAAO,KAAK,SAAS,iBAAiBA,CAAI,CAC5C,CAEA,MAAa,mBAAoB,CAC/B,MAAO,EACT,CAEA,YAAYC,EAAeD,EAAoB,CAAC,EAAG,CACjD,GAAM,CAAE,OAAAE,EAAQ,eAAAC,CAAe,EAAIH,EACnC,SAAO,oBAA0B,MAAMI,GAAY,CACjD,IAAMC,EAAe,MAAM,KAAK,SAAS,QAAQJ,EAAOD,CAAI,EACxDK,IAAiB,QACnB,QAAM,gBAAa,sBAAuBF,EAAgB,IACxD,KAAK,QAAQ,SAASE,EAAcJ,EAAM,MAAOA,EAAM,IAAK,CAC1D,OAAAC,EACA,aAAc,CAACI,EAAMC,IAAe,CAClC,IAAMC,EAASC,EAAgBH,CAAI,EACnCF,EAAS,KACP,IAAI,gBAAc,CAChB,SAAU,UAAUG,CAAU,GAC9B,QAASN,EAAM,QACf,MAAOO,EAAO,MACd,IAAKA,EAAO,IAGZ,KAAME,EAAYF,CAAM,EACxB,YAAaG,EAAkBH,CAAM,EACrC,KAAM,SACN,MAAOA,EAAO,aACd,aAAcA,EAAO,aACrB,UAAWA,EAAO,UAClB,UAAWA,EAAO,UAClB,qBAAsBA,EAAO,qBAC7B,oBAAqBA,EAAO,oBAC5B,SAAUA,EAAO,SACjB,eAAgBA,EAAO,eACvB,cAAeA,EAAO,aACxB,CAAC,CACH,CACF,CACF,CAAC,CACH,EAEFJ,EAAS,SAAS,CACpB,EAAGF,CAAM,CACX,CACF",
|
|
6
|
-
"names": ["import_BaseAdapter", "import_util", "import_rxjs", "MinigraphBubbleAdapter", "config", "getSubAdapter", "pluginManager", "openTabixSlot", "PanSNRefNames", "opts", "query", "signal", "statusCallback", "observer", "tabixRefName", "line", "fileOffset", "bubble", "parseBubbleLine", "bubbleLabel", "bubbleDescription"]
|
|
7
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as h,b as k}from"./chunk-JCG7RLMB.js";import{a as O,b as j}from"./chunk-TN6FK5UD.js";import"./chunk-KWAXLUPQ.js";import{a as F}from"./chunk-J4OLMLS5.js";import"./chunk-F4C3BEPV.js";import{b as S}from"./chunk-FY3BTKY4.js";var M=S(O(),1),l=S(F(),1),v=S(j(),1);function N(t){let e=t.split(" ");return{refName:e[0],start:+e[1],end:+e[2],id:e[3],rank:+e[4],tags:e[5]??""}}function w(t){let e=t.tags.split(" ").find(a=>a.startsWith("SM:Z:"));if(e===void 0)return;let n=e.slice(5).split(",").map(a=>a.trim()).filter(Boolean);return n.length>0?n:void 0}function y(t){return{id:t.slice(0,-1),strand:t.slice(-1)}}function x(t){let e=t.split(" "),n=y(e[3]),a=y(e[4]);return{source:n.id,sourceStrand:n.strand,target:a.id,targetStrand:a.strand,sourceSegment:{id:n.id,refName:e[5],start:+e[6],end:+e[7],rank:+e[8],tags:e[13]??""},targetSegment:{id:a.id,refName:e[9],start:+e[10],end:+e[11],rank:+e[12],tags:e[14]??""}}}function $(t){return`${t.source}${t.sourceStrand}${t.target}${t.targetStrand}`}var P=/^[A-Za-z][A-Za-z0-9]:[AifZJHB]:/;function T(t){let{id:e,refName:n,start:a,end:r,rank:s,tags:m}=t,o=m.split(" ").filter(g=>P.test(g)),i=o.length===0?"":` ${o.join(" ")}`;return`S ${e} * LN:i:${r-a} SN:Z:${n} SO:i:${a} SR:i:${s}${i}`}function Z(t){let{source:e,sourceStrand:n,target:a,targetStrand:r}=t;return`L ${e} ${n} ${a} ${r} 0M`}function L(t,e){return t<e?-1:t>e?1:0}function A(t,e){let n=[...t.values()].sort((r,s)=>r.refName===s.refName?r.start-s.start:L(r.refName,s.refName)),a=[...e.keys()].sort((r,s)=>L(r,s));return["H VN:Z:1.0",...n.map(r=>T(r)),...a.map(r=>Z(e.get(r)))].join(`
|
|
2
|
-
`)}function C(t){return t.filter(e=>e.rank>0)}var b=class extends M.BaseFeatureDataAdapter{static{this.capabilities=["getFeatures","getRefNames"]}constructor(e,n,a){super(e,n,a),this.segments=h(this,"segmentsLocation","segmentsIndex"),this.links=h(this,"linksLocation","linksIndex"),this.refNames=new k(this.segments,this)}async getRefNames(e={}){return this.refNames.assemblyRefNames(e)}async hasDataForRefName(){return!0}getFeatures(e,n={}){let{signal:a,statusCallback:r}=n;return(0,v.ObservableCreate)(async s=>{let m=await this.refNames.resolve(e,n);m!==void 0&&await(0,l.updateStatus)("Downloading segments",r,()=>this.segments.getLines(m,e.start,e.end,{signal:a,lineCallback:o=>{let i=N(o),g=w(i);s.next(new l.SimpleFeature({uniqueId:i.id,refName:e.refName,start:i.start,end:i.end,name:i.id,type:"segment",rank:i.rank,stableName:i.refName,...g&&{samples:g,carriers:g.length}}))}})),s.complete()},a)}async getSubgraph(e,n={}){let{hops:a=0,signal:r}=n,s=new Map,m=new Map,o=await this.refNames.resolve(e,{signal:r}),i=async(f,p,c)=>{let R=[];return await this.links.getLines(f,p,c,{signal:r,lineCallback:B=>{let d=x(B);m.set($(d),d);for(let u of[d.sourceSegment,d.targetSegment])s.has(u.id)||(s.set(u.id,u),R.push(u))}}),R};if(o===void 0)throw new Error(`${e.assemblyName} ${e.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${e.assemblyName} mapped to its prefix in assemblyNameToPanSN`);await this.segments.getLines(o,e.start,e.end,{signal:r,lineCallback:f=>{let p=N(f);s.set(p.id,p)}});let g=C(await i(o,e.start,e.end));for(let f=0;f<a;f++){let p=await Promise.all(g.map(c=>i(c.refName,c.start,c.end)));g=C(p.flat())}return A(s,m)}};export{b as default};
|
|
3
|
-
//# sourceMappingURL=RgfaTabixAdapter-IT7I5RR3.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/RgfaTabixAdapter/RgfaTabixAdapter.ts", "../../src/RgfaTabixAdapter/rgfaBed.ts"],
|
|
4
|
-
"sourcesContent": ["import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { SimpleFeature, updateStatus } from '@jbrowse/core/util'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\n\nimport { PanSNRefNames, openTabixSlot } from '../panSNTabix.ts'\nimport {\n formatSubgraph,\n linkKey,\n parseLinkLine,\n parseSegmentLine,\n segmentSamples,\n} from './rgfaBed.ts'\n\nimport type { RgfaTabixAdapterConfig } from './configSchema.ts'\nimport type { SubgraphAdapterOptions } from '../GetSubgraph.ts'\nimport type { RgfaLink, RgfaSegment } from './rgfaBed.ts'\nimport type PluginManager from '@jbrowse/core/PluginManager'\nimport type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport type { Feature } from '@jbrowse/core/util'\nimport type { Region } from '@jbrowse/core/util/types'\n\n// What a hop follows: alleles, never the backbone. A rank-0 segment reached\n// through a link is flanking backbone, usually outside the window, so querying\n// its links walks the reference away from the region, brings back more backbone,\n// and closes nothing. Every segment that closes a bubble is an allele interior,\n// and an allele interior is rank > 0 in both index formats (rGFA's SR tag, and\n// pggb's rank 0-or-1 against the anchor path). Reached backbone still becomes a\n// node and its edge still draws; it is only not walked through.\n//\n// This is gfabase's rule, arrived at from the other end. `gfabase sub` expands\n// from a seed either to the whole connected component (`--connected`, which its\n// own README calls overkill) or with `--cutpoints 1`, which takes the biconnected\n// component by *stopping at cutpoints*, the segments every end-to-end walk of\n// the chromosome must traverse. In a reference-anchored pangenome the cutpoints\n// are the backbone, and rank is what the index already states about it, so\n// `rank > 0` is that stopping rule without a connectivity index to build. The\n// third tool is the same shape again: `gfatools view -R` maps the region onto its\n// precomputed bubble decomposition and returns whole overlapping bubbles\n// (gfa_query_by_reg), which is complete for the same reason. Bandage's own\n// `--distance` is a node-step radius, but Bandage holds the entire graph in\n// memory, so its scope is a drawing filter rather than a fetch strategy.\n//\n// Measured with this rule: the E. coli paa window converges at one hop (17\n// segments at 1 and at 2), so the cut closes and stays closed. HPRC's amylase\n// window keeps growing (63 at 0, 78 at 1, 92 at 2) because its alleles have\n// alleles, and wall-clock is flat across all three, since a hop's queries go out\n// together and the remote index dominates.\n//\n// The exact version, when a graph ships a bubble index beside its segments:\n// gfatools' bubble rows carry the member segment ids of every bubble, so the\n// bubbles overlapping the region state which segments a complete cut must\n// contain. That turns the hop count into a termination condition rather than a\n// setting, and MinigraphBubbleAdapter already parses those rows.\nfunction offReference(segments: RgfaSegment[]) {\n return segments.filter(segment => segment.rank > 0)\n}\n\nexport default class RgfaTabixAdapter extends BaseFeatureDataAdapter<RgfaTabixAdapterConfig> {\n public static capabilities = ['getFeatures', 'getRefNames']\n\n private readonly segments\n private readonly links\n // Off the SEGMENT index: it is the one that names every stable sequence the\n // graph is anchored to, where the link index only names those a link touches.\n private readonly refNames\n\n public constructor(\n config: RgfaTabixAdapterConfig,\n getSubAdapter?: getSubAdapterType,\n pluginManager?: PluginManager,\n ) {\n super(config, getSubAdapter, pluginManager)\n this.segments = openTabixSlot(this, 'segmentsLocation', 'segmentsIndex')\n this.links = openTabixSlot(this, 'linksLocation', 'linksIndex')\n this.refNames = new PanSNRefNames(this.segments, this)\n }\n\n async getRefNames(opts: BaseOptions = {}) {\n return this.refNames.assemblyRefNames(opts)\n }\n\n public async hasDataForRefName() {\n return true\n }\n\n getFeatures(query: Region, opts: BaseOptions = {}) {\n const { signal, statusCallback } = opts\n return ObservableCreate<Feature>(async observer => {\n const tabixRefName = await this.refNames.resolve(query, opts)\n if (tabixRefName !== undefined) {\n await updateStatus('Downloading segments', statusCallback, () =>\n this.segments.getLines(tabixRefName, query.start, query.end, {\n signal,\n lineCallback: line => {\n const segment = parseSegmentLine(line)\n // `samples` is who, `carriers` is how many, and the second is not\n // just a convenience: a lane colored by carriage is a jexl\n // expression in a config, where counting a list means relying on\n // jexl resolving `.length` through a member access on an array.\n // The count is the axis the color reads, so the index states it.\n const samples = segmentSamples(segment)\n observer.next(\n new SimpleFeature({\n uniqueId: segment.id,\n refName: query.refName,\n start: segment.start,\n end: segment.end,\n name: segment.id,\n type: 'segment',\n rank: segment.rank,\n stableName: segment.refName,\n ...(samples && { samples, carriers: samples.length }),\n }),\n )\n },\n }),\n )\n }\n observer.complete()\n }, signal)\n }\n\n // Extract the graph around a region as GFA text, for GraphGenomeView. The\n // region's own segments come from segs.bed.gz; links.bed.gz supplies the edges\n // incident to them *and* the coordinates of the segments on the other end,\n // which typically sit on a different stable sequence (a rank>0 bubble) and so\n // are not reachable by any coordinate query on this region.\n //\n // `hops` is extra rounds of link-following past the region's own segments\n // and their immediate neighbours, each costing one tabix query per\n // off-reference segment newly reached. One round is what closes a bubble, so\n // it is the default the view asks for; see the frontier below. `signal` goes\n // to every one of those queries, so a cut the view has replaced stops.\n async getSubgraph(region: Region, opts: SubgraphAdapterOptions = {}) {\n const { hops = 0, signal } = opts\n const segments = new Map<string, RgfaSegment>()\n const links = new Map<string, RgfaLink>()\n const tabixRefName = await this.refNames.resolve(region, { signal })\n\n const addLinksOver = async (\n refName: string,\n start: number,\n end: number,\n ) => {\n const reached: RgfaSegment[] = []\n await this.links.getLines(refName, start, end, {\n signal,\n lineCallback: line => {\n const link = parseLinkLine(line)\n links.set(linkKey(link), link)\n for (const segment of [link.sourceSegment, link.targetSegment]) {\n if (!segments.has(segment.id)) {\n segments.set(segment.id, segment)\n reached.push(segment)\n }\n }\n },\n })\n return reached\n }\n\n if (tabixRefName === undefined) {\n throw new Error(\n `${region.assemblyName} ${region.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${region.assemblyName} mapped to its prefix in assemblyNameToPanSN`,\n )\n }\n await this.segments.getLines(tabixRefName, region.start, region.end, {\n signal,\n lineCallback: line => {\n const segment = parseSegmentLine(line)\n segments.set(segment.id, segment)\n },\n })\n let frontier = offReference(\n await addLinksOver(tabixRefName, region.start, region.end),\n )\n for (let hop = 0; hop < hops; hop++) {\n // One hop's queries are independent of each other, so they go out\n // together rather than one round-trip at a time. Their callbacks share\n // the segment and link maps, which is safe because only one of them runs\n // at a time, and the output is sorted at the end regardless of the order\n // they arrive in.\n const reached = await Promise.all(\n frontier.map(segment =>\n addLinksOver(segment.refName, segment.start, segment.end),\n ),\n )\n frontier = offReference(reached.flat())\n }\n\n return formatSubgraph(segments, links)\n }\n}\n", "// A segment as it appears in segs.bed.gz, and as it is repeated inside every\n// links.bed.gz row: `stableName start end segmentId rank [tags]`. The first\n// five are the SN/SO/SR tags rGFA already carries, projected to BED by\n// `gfatools gfa2bed -m`.\n//\n// `tags` is a space-separated list of GFA tags, written verbatim onto the\n// S-line formatSegment synthesizes, where the GFA parser reads them into\n// `GraphNode.tags` with no work here. It is the extension point for everything\n// the five columns cannot say: carriage on a path-derived graph (`SM:Z:`), the\n// collapse summary on a level-of-detail tier (`ct:Z:`, `cn:i:`, ...), a\n// precomputed layout position later. rGFA files have no sixth column at all,\n// so this is empty for them and nothing changes.\nexport interface RgfaSegment {\n refName: string\n start: number\n end: number\n id: string\n rank: number\n tags: string\n}\n\nexport interface RgfaLink {\n source: string\n sourceStrand: string\n target: string\n targetStrand: string\n sourceSegment: RgfaSegment\n targetSegment: RgfaSegment\n}\n\nexport function parseSegmentLine(line: string): RgfaSegment {\n const cols = line.split('\\t')\n return {\n refName: cols[0]!,\n start: +cols[1]!,\n end: +cols[2]!,\n id: cols[3]!,\n rank: +cols[4]!,\n tags: cols[5] ?? '',\n }\n}\n\n// Carriage as an ordinary feature attribute, for the linear track rather than\n// the graph. The tag column reaches the graph view through the synthesized\n// S-line (formatSegment below, then gfaConverter reads SM into\n// `GraphNode.samples`), and that route ends at the graph: `getFeatures` builds\n// its own features and had no way to say who carries a segment, so a lane\n// colored by carriage was not expressible.\n//\n// `SM:Z:` is its own grammar check here. build_pggb_tabix.sh wrote a bare\n// comma-separated list in this column before the tag column existed, and those\n// files are still hosted; a bare list has no prefix to match, so it is dropped\n// rather than read as one sample named `K12,Sakai,CFT073`.\n//\n// Undefined rather than [] when the tag is absent, matching gfaConverter: an\n// rGFA has no sixth column at all, so a segment that says nothing about\n// carriage stays distinguishable from one carried by nobody.\nexport function segmentSamples(segment: RgfaSegment) {\n const tag = segment.tags.split(' ').find(t => t.startsWith('SM:Z:'))\n if (tag === undefined) {\n return undefined\n }\n const samples = tag\n .slice('SM:Z:'.length)\n .split(',')\n .map(s => s.trim())\n .filter(Boolean)\n return samples.length > 0 ? samples : undefined\n}\n\n// `s322+` \u2014 the L-line's segment id with its orientation appended, mirroring\n// the GFA record it came from.\nfunction parseEndpoint(field: string) {\n return { id: field.slice(0, -1), strand: field.slice(-1) }\n}\n\nexport function parseLinkLine(line: string): RgfaLink {\n const cols = line.split('\\t')\n const source = parseEndpoint(cols[3]!)\n const target = parseEndpoint(cols[4]!)\n return {\n source: source.id,\n sourceStrand: source.strand,\n target: target.id,\n targetStrand: target.strand,\n sourceSegment: {\n id: source.id,\n refName: cols[5]!,\n start: +cols[6]!,\n end: +cols[7]!,\n rank: +cols[8]!,\n tags: cols[13] ?? '',\n },\n targetSegment: {\n id: target.id,\n refName: cols[9]!,\n start: +cols[10]!,\n end: +cols[11]!,\n rank: +cols[12]!,\n tags: cols[14] ?? '',\n },\n }\n}\n\nexport function linkKey(link: RgfaLink) {\n return `${link.source}${link.sourceStrand}${link.target}${link.targetStrand}`\n}\n\n// Both endpoints of a link are written into every row, so the same link is\n// indexed under each endpoint's stable sequence and arrives twice for a region\n// covering both. Callers dedupe on linkKey.\n\n// Segments carry no sequence here \u2014 the BED records only their span \u2014 so every\n// S-line is written with `*` and an LN tag, which is what the GFA spec asks for\n// and what packages/graph-core's parser reads back as the node length.\n// `NM:i:0`, `SM:Z:HG002.1,HG002.2` \u2014 the GFA tag grammar, checked rather than\n// trusted. Files built before the tag column existed put a bare comma-separated\n// sample list here, and passing that through would put a field that is not a\n// tag on an S-line, which is a malformed GFA rather than a missing annotation.\n// Dropping it degrades to the pre-tag behaviour instead.\nconst GFA_TAG = /^[A-Za-z][A-Za-z0-9]:[AifZJHB]:/\n\nfunction formatSegment(segment: RgfaSegment) {\n const { id, refName, start, end, rank, tags } = segment\n const valid = tags.split(' ').filter(t => GFA_TAG.test(t))\n const extra = valid.length === 0 ? '' : `\\t${valid.join('\\t')}`\n return `S\\t${id}\\t*\\tLN:i:${end - start}\\tSN:Z:${refName}\\tSO:i:${start}\\tSR:i:${rank}${extra}`\n}\n\nfunction formatLink(link: RgfaLink) {\n const { source, sourceStrand, target, targetStrand } = link\n return `L\\t${source}\\t${sourceStrand}\\t${target}\\t${targetStrand}\\t0M`\n}\n\n// Codepoint order, not localeCompare: the byte-identical-output guarantee below\n// has to hold across locales.\nfunction compare(a: string, b: string) {\n return a < b ? -1 : a > b ? 1 : 0\n}\n\n// Deterministic ordering: the same region always produces byte-identical GFA,\n// so a layout computed from it is reproducible.\nexport function formatSubgraph(\n segments: Map<string, RgfaSegment>,\n links: Map<string, RgfaLink>,\n) {\n const sortedSegments = [...segments.values()].sort((a, b) =>\n a.refName === b.refName ? a.start - b.start : compare(a.refName, b.refName),\n )\n const sortedLinks = [...links.keys()].sort((a, b) => compare(a, b))\n return [\n 'H\\tVN:Z:1.0',\n ...sortedSegments.map(s => formatSegment(s)),\n ...sortedLinks.map(k => formatLink(links.get(k)!)),\n ].join('\\n')\n}\n"],
|
|
5
|
-
"mappings": "sOAAA,IAAAA,EAAuC,SACvCC,EAA4C,SAC5CC,EAAiC,SC4B1B,SAASC,EAAiBC,EAA2B,CAC1D,IAAMC,EAAOD,EAAK,MAAM,GAAI,EAC5B,MAAO,CACL,QAASC,EAAK,CAAC,EACf,MAAO,CAACA,EAAK,CAAC,EACd,IAAK,CAACA,EAAK,CAAC,EACZ,GAAIA,EAAK,CAAC,EACV,KAAM,CAACA,EAAK,CAAC,EACb,KAAMA,EAAK,CAAC,GAAK,EACnB,CACF,CAiBO,SAASC,EAAeC,EAAsB,CACnD,IAAMC,EAAMD,EAAQ,KAAK,MAAM,GAAG,EAAE,KAAKE,GAAKA,EAAE,WAAW,OAAO,CAAC,EACnE,GAAID,IAAQ,OACV,OAEF,IAAME,EAAUF,EACb,MAAM,CAAc,EACpB,MAAM,GAAG,EACT,IAAIG,GAAKA,EAAE,KAAK,CAAC,EACjB,OAAO,OAAO,EACjB,OAAOD,EAAQ,OAAS,EAAIA,EAAU,MACxC,CAIA,SAASE,EAAcC,EAAe,CACpC,MAAO,CAAE,GAAIA,EAAM,MAAM,EAAG,EAAE,EAAG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AIA,CAAO,EAChCwB,EAAQ,KAAKxB,CAAO,EAG1B,CACF,CAAC,EACMwB,CACT,EAEA,GAAIZ,IAAiB,OACnB,MAAM,IAAI,MACR,GAAGK,EAAO,YAAY,IAAIA,EAAO,OAAO,iFAAiFA,EAAO,YAAY,8CAC9I,EAEF,MAAM,KAAK,SAAS,SAASL,EAAcK,EAAO,MAAOA,EAAO,IAAK,CACnE,OAAAR,EACA,aAAcI,GAAQ,CACpB,IAAMb,EAAUc,EAAiBD,CAAI,EACrCd,EAAS,IAAIC,EAAQ,GAAIA,CAAO,CAClC,CACF,CAAC,EACD,IAAI4B,EAAW9B,EACb,MAAMsB,EAAaR,EAAcK,EAAO,MAAOA,EAAO,GAAG,CAC3D,EACA,QAASY,EAAM,EAAGA,EAAMX,EAAMW,IAAO,CAMnC,IAAML,EAAU,MAAM,QAAQ,IAC5BI,EAAS,IAAI5B,GACXoB,EAAapB,EAAQ,QAASA,EAAQ,MAAOA,EAAQ,GAAG,CAC1D,CACF,EACA4B,EAAW9B,EAAa0B,EAAQ,KAAK,CAAC,CACxC,CAEA,OAAOM,EAAe/B,EAAUoB,CAAK,CACvC,CACF",
|
|
6
|
-
"names": ["import_BaseAdapter", "import_util", "import_rxjs", "parseSegmentLine", "line", "cols", "segmentSamples", "segment", "tag", "t", "samples", "s", "parseEndpoint", "field", "parseLinkLine", "source", "target", "linkKey", "link", "GFA_TAG", "formatSegment", "id", "refName", "start", "end", "rank", "tags", "valid", "extra", "formatLink", "sourceStrand", "targetStrand", "compare", "a", "b", "formatSubgraph", "segments", "links", "sortedSegments", "sortedLinks", "k", "offReference", "segments", "segment", "RgfaTabixAdapter", "config", "getSubAdapter", "pluginManager", "openTabixSlot", "PanSNRefNames", "opts", "query", "signal", "statusCallback", "observer", "tabixRefName", "line", "parseSegmentLine", "samples", "segmentSamples", "region", "hops", "links", "addLinksOver", "refName", "start", "end", "reached", "link", "parseLinkLine", "linkKey", "frontier", "hop", "formatSubgraph"]
|
|
7
|
-
}
|