Skip to content

Commit

Permalink
Add getContigs util
Browse files Browse the repository at this point in the history
  • Loading branch information
haxiomic committed Apr 20, 2019
1 parent 6809811 commit 6d7e951
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/formats/UCSCBig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ export class UCSCBig {
return dataPromise;
}

static getContigs(header: HeaderData) {
let contigs = [];
let availableChromosomes = header.chromTree.idToChrom;
availableChromosomes.sort((a, b) => {
return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' });
});

for (let contigId of availableChromosomes) {
contigs.push({
id: contigId,
startIndex: 0,
span: header.chromTree.chromSize[contigId]
});
}
return contigs;
}

/**
* Convert a BigWig zoom levels header into maps so we can lookup the zoom level for any given lod
*/
Expand Down

0 comments on commit 6d7e951

Please sign in to comment.