Remove or retain matrix rows that intersect given genomic regions
IntersectMatrix( matrix, regions, invert = FALSE, sep = c("-", "-"), verbose = TRUE, ... )
matrix | A matrix with genomic regions in the rows |
---|---|
regions | A set of genomic regions to intersect with regions in the matrix. Either a vector of strings encoding the genomic coordinates, or a GRanges object. |
invert | Discard rows intersecting the genomic regions supplied, rather than retain. |
sep | A length-2 character vector containing the separators to be used for extracting genomic coordinates from a string. The first element will be used to separate the chromosome name from coordinates, and the second element used to separate start and end coordinates. |
verbose | Display messages |
... | Additional arguments passed to |
Returns a sparse matrix
counts <- matrix(data = rep(0, 12), ncol = 2) rownames(counts) <- c("chr1-565107-565550","chr1-569174-569639", "chr1-713460-714823","chr1-752422-753038", "chr1-762106-763359","chr1-779589-780271") IntersectMatrix(matrix = counts, regions = blacklist_hg19)#>#>#> [,1] [,2] #> chr1-565107-565550 0 0 #> chr1-569174-569639 0 0 #> chr1-713460-714823 0 0