Learn R Programming

humarray (version 1.0.0)

makeGRanges: Wrapper to construct GRanges object from chr,pos or chr,start,end

Description

Slightly simplifies the creation of a GRanges object, allowing flexible input of chr, pos, or chr,start,end, and specification of rownames and the 'genome' parameter for specifying the build/coordinate type, e.g, hg18, build 37, etc. Designed for a simplified GRanges object without metadata, and where the 'strand' data is of no interest, so if strand/metadata is to be used, use the original GRanges() constructor.

Usage

makeGRanges(chr, pos = NULL, start = NULL, end = NULL, row.names = NULL, build = NULL, ...)

Arguments

chr
character, an optional vector of chromosomes to combine with 'pos' or 'start'+'end' (enter in ...) to describe positions for the GRanges object
pos
integer/numeric, for SNPs, can enter positions just once in 'pos' instead of entering the same value for start and end
start
integer/numeric, specify the start position of ranges to encode in the new GRanges object, alongside 'end' (do not use 'pos' if using start+end)
end
integer/numeric, specify the end position of ranges to encode in the new GRanges object, alongside 'start' (do not use 'pos' if using start+end)
row.names
character, rownames for the output object, e.g, unique IDs describing the ranges
build
character, "hg18" or "hg19" (or 36/37) to show which reference to retrieve. The default when build is NULL is to use the build from the current ChipInfo annotation
...
further arguments to df.to.GRanges, such as 'fill.missing'

Value

Returns a GRanges object with the ranges, build and rownames specified. Rownames will be 1:nrow if the 'row.names' parameter is empty. The strand information will default to '+' for all entries, and the metadata will be empty (this function is only for creation of a very basic GRanges object).

See Also

Chr, Pos, Pos.gene, Band, Band.gene, Band.pos, Gene.pos, zlink{df.to.GRanges}

Examples

Run this code
g1 <- makeGRanges(chr=c(1,4,"X"),pos=c(132432,434342,232222))
g2 <- makeGRanges(chr=c(22,21,21),start=c(1,1,1),end=c(1000,10000,100000),
                                              row.names=c("1K","10K","100K"))
g1 ; g2

Run the code above in your browser using DataLab