Validates a data frame as BED format and normalizes column names and chromosome identifiers. The function expects columns in standard BED order: chr, start, end, tag/name, score, strand.
Value
A validated data frame with normalized column names (chr, start, end, tag, score, strand) and chromosome names without "chr" prefix.
Details
The function performs the following:
Requires at least 4 columns (chr, start, end, strand)
Maps columns by position to BED names
Fills missing columns with defaults (tag="peak", score=0)
Validates chromosome is character type
Verifies end >= start for all rows
Validates strand values are "+" or "-"
Removes "chr" prefix from chromosome names
Converts chromosome names to uppercase
Examples
if (FALSE) { # \dontrun{
# Standard 6-column BED
bed <- read.table("peaks.bed", header = FALSE)
bed <- checkBed(bed)
# 4-column BED (will add defaults for tag, score)
bed3 <- data.frame(chr = "chr1", start = 100, end = 200, strand = "+")
bed3 <- checkBed(bed3)
} # }