File: sampleRanges.Rd

package info (click to toggle)
r-bioc-tfbstools 1.28.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 940 kB
  • sloc: xml: 1,137; ansic: 590; asm: 54; sh: 13; makefile: 2
file content (55 lines) | stat: -rw-r--r-- 1,465 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
\name{sampleRanges}
\alias{sampleRanges}

\title{
  sampleRanges
}
\description{
  Sample ranges with same widths of input rannges
  from a set of subject ranges.
}
\usage{
  sampleRanges(inputGRanges, subjectGRanges, ignore.strand=TRUE)
}

\arguments{
  \item{inputGRanges}{
    The input \code{GRanges}.
    }
  \item{subjectGRanges}{
    The subject \code{GRanges}.
  }
  \item{ignore.strand}{
    When set to \code{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 \code{GRanges} object with the same length and widths of 
  \code{inputGRanges}.
}

\author{
  Ge Tan
}

\examples{
  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)

}