Calculates the size (length in base pairs) of each genomic window from a vector of window identifiers in "chr_start_end" format.

calculate_window_sizes(genome_window_vector)

Arguments

genome_window_vector

A character vector of window identifiers in the format "chr_start_end" (e.g., "chr1_1000_2000")

Value

A numeric vector containing the size of each window in base pairs, calculated as (end position - start position)

Details

The function:

  1. Splits each window identifier into its components

  2. Extracts start and end positions

  3. Calculates window size as the difference between end and start

Note

Assumes window identifiers are properly formatted with underscore separators and numeric start/end positions

Examples

if (FALSE) { # \dontrun{
windows <- c("chr1_1000_2000", "chr1_2000_5000", "chr2_1000_3000")
sizes <- calculate_window_sizes(windows)
# Returns: c(1000, 3000, 2000)
} # }