# Module: ext/lz-tabix-source

An adapter that fetches data from a remote Tabix-indexed datafile, instead of a RESTful API. Requires a generic user-specified parser function.

### Features provided

- module:LocusZoom_Adapters~TabixUrlSource

### Loading and usage

The page must incorporate and load all libraries before this file can be used, including:

- Vendor assets
- LocusZoom

To use in an environment without special JS build tooling, simply load the extension file as JS from a CDN (after any dependencies):

    <script src="https://cdn.jsdelivr.net/npm/locuszoom@INSERT_VERSION_HERE/dist/ext/lz-tabix-source.min.js" type="application/javascript"></script>

To use with ES6 modules, the plugin must be loaded and registered explicitly before use:

    import LocusZoom from 'locuszoom';
    import LzTabixSource from 'locuszoom/esm/ext/lz-tabix-source';
    LocusZoom.use(LzTabixSource);

Then use the Adapter made available by this extension. For example:

    data_sources.add("assoc", ["TabixUrlSource", {
        url_data: 'https://s3-bucket.example/tabix-indexed-bgzip-file.gz',
        parser_func: (line_of_text) => object_of_parsed_data_for_this_line,
        // Tabix performs region queries. If you are fetching interval data (one end outside the edge of the plot), then
        // "overfetching" can help to ensure that data partially outside the view region is retrieved
        // If you are fetching single-point data like association summary stats, then overfetching is unnecessary
        overfetch: 0.25
    }]);

Source:
  - ext/lz-tabix-source.js, line 1