uniqueGRanges {MethylIT}R Documentation

Unique genomic ranges from a list of GRanges objects

Description

Build an unique GRanges object from a list of Granges objects.

Usage

uniqueGRanges(ListOfGranges, ncols = NULL, columns = NULL,
  chromosomes = NULL, maxgap = -1L, minoverlap = 1L, missing = 0,
  type = c("any", "start", "end", "within", "equal"), select = c("all",
  "first", "last", "arbitrary"), ignore.strand = FALSE,
  keep.strand = !ignore.strand, num.cores = 1, tasks = 0L,
  verbose = TRUE)

Arguments

ListOfGranges

Objects to combine. A list of GRanges object or a GRangesList object.

ncols

integer. Number of columns to use from the meta-column of each GRanges object. Default value: NULL. If NULL, all the columns (from column 1 to ncols) from each GRanges will be present in the uniqueGRanges output.

columns

interger number(s) corresponding to the specific column(s) to use from the meta-column of each GRanges. Default value: NULL. if provided, the metacolumn from the uniqueGRanges output will contain the specified columns.

chromosomes

Chromosomes used Default value: NULL

maxgap

See GenomicRanges::findOverlaps in the IRanges package for a description of these arguments Default value: -1L

minoverlap

See GenomicRanges::findOverlaps in the IRanges package for a description of these arguments Default value: 1L

missing

A numerical value (default 0) or NA to write in ranges with missing values. For example, suppose that we want to build a uniqueGRanges object from the GRanges objects X and Y. If a given range k from the GRanges object X with metacolum value x is missing in the GRanges object Y, then the metacolum of range k from uniqueGRanges(list(X,Y)) object will be the row vector (x,0) or (x,NA) if missing = NA.

type

By default, any overlap is accepted. By specifying the type parameter, one can select for specific types of overlap. The types correspond to operations in Allen's Interval Algebra (see references). If type is start or end, the intervals are required to have matching starts or ends, respectively. While this operation seems trivial, the naive implementation using outer would be much less efficient. Specifying equal as the type returns the intersection of the start and end matches. If type is within, the query interval must be wholly contained within the subject interval. Note that all matches must additionally satisfy the minoverlap constraint described above. The maxgap parameter has special meaning with the special overlap types. For start, end, and equal, it specifies the maximum difference in the starts, ends or both, respectively. For within, it is the maximum amount by which the subject may be wider than the query.

select

When select is "all" (the default), the results are returned as a Hits object. Otherwise the returned value is an integer vector parallel to query (i.e. same length) containing the first, last, or arbitrary overlapping interval in subject, with NA indicating intervals that did not overlap any intervals in subject.

ignore.strand

When set to TRUE, the strand information is ignored in the overlap calculations. Default value: TRUE

keep.strand

When set to TRUE, the strand information is preserved on the objects even if ignore.strand is set to TRUE. This makes it possible to ignore the strand during overlap calculations but to preserve the strand information and not overwrite with *. Default value is keep.strand = !ignore.strand.

num.cores

The number of cores to use, i.e. at most how many child processes will be run simultaneously (see bplapply function from BiocParallel package).

tasks

integer(1). The number of tasks per job. value must be a scalar integer >= 0L. In this documentation a job is defined as a single call to a function, such as bplapply, bpmapply etc. A task is the division of the X argument into chunks. When tasks == 0 (default), X is divided as evenly as possible over the number of workers (see MulticoreParam from BiocParallel package).

verbose

if TRUE, prints the function log to stdout

Details

The metadata of each one of these GRanges must have one or more columns to yield a unique GRanges object with metadata columns from the original GRanges objects. Otherwise, a unique GRanges object will be created without metadata columns. Additionally, all metadata must be the same class, e.g. all numeric or all characters, or all factor

Value

a GRanges object

Examples

dfChr1 <- data.frame(chr = "chr1", start = 11:15, end = 11:15,
                    strand = c("+","-","+","*","."), score = 1:5)
dfChr2 <- data.frame(chr = "chr1", start = 11:15, end = 11:15,
                    strand = c("+","-","+","*","."), score = 1:5)
dfChr3 <- data.frame(chr = "chr1", start = 11:15, end = 11:15,
                    strand = c("+","-","+","*","."), score = 1:5)

gr1 <- makeGRangesFromDataFrame(dfChr1, keep.extra.columns = TRUE)
gr2 <- makeGRangesFromDataFrame(dfChr2, keep.extra.columns = TRUE)
gr3 <- makeGRangesFromDataFrame(dfChr3, keep.extra.columns = TRUE)

grList <- GRangesList("gr1" = gr1, "gr2" = gr2, "gr3" = gr3)

uniqueGRanges(grList)


[Package MethylIT version 0.3.1 ]