R/intervals-liftover.R
gintervals.as_chain.RdTransforms existing intervals to a chain format by validating required columns and adding chain attributes.
gintervals.as_chain(
intervals = NULL,
src_overlap_policy = "error",
tgt_overlap_policy = "auto",
min_score = NULL
)a data frame with chain columns: chrom, start, end, strand, chromsrc, startsrc, endsrc, strandsrc, chain_id, score
source overlap policy: "error", "keep", or "discard"
target overlap policy: "error", "auto", "auto_first", "auto_longer", "auto_score", "discard", "keep", or "agg"
optional minimum alignment score threshold
A data frame in chain format with chain attributes set
This function checks that the input intervals data frame has all the required columns for a chain format and adds the necessary attributes. A chain format requires both target coordinates (chrom, start, end, strand) and source coordinates (chromsrc, startsrc, endsrc, strandsrc), as well as chain_id and score columns.
gdb.init_examples()
# Create a chain from existing intervals
chain_data <- data.frame(
chrom = "chr1",
start = 1000,
end = 2000,
strand = 0,
chromsrc = "chr1",
startsrc = 5000,
endsrc = 6000,
strandsrc = 0,
chain_id = 1L,
score = 1000.0
)
chain <- gintervals.as_chain(chain_data)