ranges_for_coords: Construct GRanges objects from coordinate strings

View source: R/utils.R

ranges_for_coordsR Documentation

Construct GRanges objects from coordinate strings

Description

Construct GRanges objects from coordinate strings

Usage

ranges_for_coords(coord_strings, meta_data_df = NULL, with_names = FALSE)

Arguments

coord_strings

A list of coordinate strings (in the form "chr1:500000-1000000")

meta_data_df

A data frame with any meta data columns you want included with the ranges. Must be in the same order as coord_strings.

with_names

logical - should meta data include coordinate string (field coord_string)?

Details

Coordinate strings consist of three pieces of information: chromosome, start, and stop. These pieces of information can be separated by the characters ":", "_", or "-". Commas will be removed, not used as separators (ex: "chr18:8,575,097-8,839,855" is ok).

Value

GRanges object of the input strings

See Also

GRanges-class

Examples

  ran1 <- ranges_for_coords("chr1:2039-30239", with_names = TRUE)
  ran2 <- ranges_for_coords(c("chr1:2049-203902", "chrX:489249-1389389"),
                            meta_data_df = data.frame(dat = c("1", "X")))
  ran3 <- ranges_for_coords(c("chr1:2049-203902", "chrX:489249-1389389"),
                            with_names = TRUE,
                            meta_data_df = data.frame(dat = c("1", "X"),
                                           stringsAsFactors = FALSE))


cole-trapnell-lab/cicero-release documentation built on Sept. 4, 2024, 1:49 p.m.