Computes cumulative genomic positions for coverage data and variant calls by calculating chromosome offsets.

generate_offsets(coverage_data, variant_calls)

Arguments

coverage_data

A data frame with columns seqnames, start, and end representing coverage intervals.

variant_calls

A data frame with columns seqnames, start, and end representing variant calls.

Value

A list with two elements:

coverage_data

The input coverage data augmented with a column cumulative_genomic_position.

variant_calls

The input variant calls augmented with columns cumulative_start and cumulative_end.

Details

The function filters for valid chromosomes (chr1 - chr22, X, Y), calculates the maximum end of each chromosome as a proxy for its length, and uses the cumulative sum of chromosome lengths to determine an offset for each chromosome. It then adds this offset to the start of each interval to obtain a cumulative genomic position.