# Module: LocusZoom_Adapters

Define standard data adapters used to retrieve data (usually from REST APIs)

## Adapters are responsible for retrieving data

In LocusZoom, the act of fetching data (from API, JSON file, or Tabix) is separate from the act of rendering data. Adapters are used to handle retrieving from different sources, and can provide various advanced functionality such as caching, data harmonization, and annotating API responses with calculated fields. They can also be used to join two data sources, such as annotating association summary statistics with LD information.

Most of LocusZoom's builtin layouts and adapters are written for the field names and data formats of the UMich PortalDev API: if your data is in a different format, an adapter can be used to coerce or rename fields. Although it is possible to change every part of a rendering layout to expect different fields, this is often much more work than providing data in the expected format.

## Creating data adapters

The documentation in this section describes the available data types and adapters. Real LocusZoom usage almost never creates these classes directly: rather, they are defined from configuration objects that ask for a source by name.

The below example creates an object responsible for fetching two different GWAS summary statistics datasets from two different API endpoints, for any data layer that asks for fields from `trait1:fieldname` or `trait2:fieldname`.

    const data_sources = new LocusZoom.DataSources();
    data_sources.add("trait1", ["AssociationLZ", { url: "http://server.com/api/single/", source: 1 }]);
    data_sources.add("trait2", ["AssociationLZ", { url: "http://server.com/api/single/", source: 2 }]);

These data sources are then passed to the plot when data is to be rendered: `const plot = LocusZoom.populate("#lz-plot", data_sources, layout);`

Source:
  - data/adapters.js, line 1

### Classes

AssociationLZ
BaseAdapter
BaseApiAdapter
BaseLZAdapter
BaseUMAdapter
CredibleSetLZ
GeneConstraintLZ
GeneLZ
GwasCatalogLZ
IntervalLZ
LDServer
PheWASLZ
RecombLZ
StaticSource
TabixUrlSource
UserTabixLD

### Members

#### (inner) LDLZ2

Backwards-compatible alias for LDServer

Source:
  - registry/adapters.js, line 35
See:
  - module:LocusZoom_Adapters~LDServer

#### (inner) StaticJSON

Backwards-compatible alias for StaticSource

Source:
  - registry/adapters.js, line 27
See:
  - module:LocusZoom_Adapters~StaticSource