IntersectMatrix function

Intersect genomic coordinates with matrix rows

Intersect genomic coordinates with matrix rows

Remove or retain matrix rows that intersect given genomic regions

IntersectMatrix( matrix, regions, invert = FALSE, sep = c("-", "-"), verbose = TRUE, ... )

Arguments

  • 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 findOverlaps

Returns

Returns a sparse matrix

Examples

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)