Read UCSC Trix indexes in pure JavaScript
npm install @gmod/triximport Trix from '@gmod/trix'
import { RemoteFile } from 'generic-filehandle2'
// generic-filehandle2 also has LocalFile for files on disk
const trix = new Trix(
new RemoteFile('https://hgdownload.soe.ucsc.edu/gbdb/hg38/knownGene.ixx'),
new RemoteFile('https://hgdownload.soe.ucsc.edu/gbdb/hg38/knownGene.ix'),
)
const results = await trix.search('oca')
// => [[term, record], ...]ixxFile- filehandle for the.ixxfileixFile- filehandle for the.ixfilemaxResults- most results a search returns, default 20. Also settable afterwards astrix.maxResults
Prefix-searches the index and resolves to [term, record][], where term is
the indexed word that matched and record is the key it points to. Records are
deduplicated, so two terms hitting the same record yield one result.
searchString- the query; only its first whitespace-separated word is usedopts.signal- anAbortSignalto cancel the underlying reads
See the UCSC trix documentation
for the concepts, and ixixx-js for a
JavaScript implementation of the ixIxx command that builds these indexes.
See CONTRIBUTING.md for development and release steps.