sampleRanges: sampleRanges

Description Usage Arguments Value Author(s) Examples

View source: R/util-methods.r

Description

Sample ranges with same widths of input rannges from a set of subject ranges.

Usage

1
  sampleRanges(inputGRanges, subjectGRanges, ignore.strand=TRUE)

Arguments

inputGRanges

The input GRanges.

subjectGRanges

The subject GRanges.

ignore.strand

When set to TRUE, the strand information is ignoreed during the sampling. Otherwise, the input ranges on positvie strand will only sample from subject ranges on positvie strand.

Value

A GRanges object with the same length and widths of inputGRanges.

Author(s)

Ge Tan

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  library(GenomicRanges)
  inputGRanges <- GRanges(seqnames=c("chr1", "chr2"), 
                         range=IRanges(start=c(2L, 10L), end=c(6L, 15L)),
                          strand=c("+", "-"))

  subjectGRanges <- GRanges(
                            seqnames=c("chr1", "chr1", "chr1", "chr1", 
                                       "chr2", "chr2"),
                            ranges=IRanges(start=c(20L, 20L, 30L, 30L, 7L, 25L),
                                           end=c(50L, 50L, 32L, 32L,9L, 55L)),
                            strand=c("+","-", "+", "-", "+","-"))
  set.seed(16)
  sampleRanges(inputGRanges, subjectGRanges, ignore.strand=TRUE)
  sampleRanges(inputGRanges, subjectGRanges, ignore.strand=FALSE)

ge11232002/TFBSTools documentation built on Sept. 12, 2021, 12:07 p.m.