Skip to contents

This function extracts genomic signal data for a specified region from either a data frame or a file. It filters the data to only include features within the specified region and optionally adds a track name.

Usage

get_single_signal(input, region, name = NULL)

Arguments

input

Either a data frame with genomic coordinates or a character string specifying the path to a genomic data file (BED, bigWig, GFF, etc.)

region

A genomic region string in the format "chr:start-end" or a GRanges object

name

Optional name to assign to the track (default: NULL)

Value

A data frame containing the filtered genomic data with an optional name column

Examples

if (FALSE) { # \dontrun{
# Extract data from a data frame
df <- data.frame(
  seqnames = c("chr1", "chr1", "chr2"),
  start = c(1, 100, 200),
  end = c(50, 150, 250),
  score = c(0.1, 0.5, 0.9)
)
region_data <- get_single_signal(df, "chr1:50-150", name = "track1")

# Extract data from a file
file_data <- get_single_signal("peaks.bed", "chr1:1000000-2000000", name = "peaks")
} # }