Combine multiple data sources using data operations
developLocusZoom allows you to combine different data layers (e.g., association data and LD information) within a single data layer layout using data_operations. This is essential when a single plot element depends on information from multiple sources.
Data operations consist of two main types:
- Fetch operations: Used to retrieve data. You can specify dependencies using the syntax
some_request(dependency_name). For example,ld(assoc)tells LocusZoom to wait until theassocdata is retrieved before requestinglddata. LocusZoom automatically parallelizes requests that have no dependencies. - Joins (Data functions): Used to merge multiple sets of records into a single list. You can use built-in joins like
left_match,inner_match, andfull_outer_match, or register custom functions inLocusZoom.DataFunctions.
Note: Everything listed in data_layer.namespace automatically triggers a retrieval request. You only need to explicitly modify fetch.from if you need to define dependencies (e.g., ld(assoc)).
{
namespace: { 'assoc': 'mystudy', 'ld': 'some_ld' },
data_operations: [
{
type: 'fetch',
from: ['assoc', 'ld(assoc)'],
},
{
type: 'left_match',
name: 'assoc_plus_ld',
requires: ['assoc', 'ld'],
// Specify field names for the join
params: ['assoc:position', 'ld:position2'],
},
]
}