rgscores: Sampling genomic gscores

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Function for randomly sampling genomic gscores from GScores objects.

Usage

1
2
3
4
5
6
7
8
## S4 method for signature 'GScores,missing'
rgscores(n, object, ...)
## S4 method for signature 'missing,GScores'
rgscores(n, object, ...)
## S4 method for signature 'numeric,GScores'
rgscores(n, object, ...)
## S4 method for signature 'integer,GScores'
rgscores(n, object, ...)

Arguments

n

Number of scores to sample.

object

A GScores object.

...

In the call to the rgscores() method one can additionally set the following arguments:

  • popCharacter string vector of length one, specifying the scores population from which we want to sample scores. By default, its value is 'defaultPopulation(object)'. Use populations() to find out the available scores populations.

  • scores.onlyFlag setting whether only the scores should be returned as a numeric vector (TRUE), instead of returning them as a metadata column in a GRanges object (FALSE, default).

  • rangesEither a GRanges object or a character string vector of sequence names. Scores will be sampled from the given genomic regions, which by default correspond to the entire genomic space of object. Currently, only entire chromosomes are considered.

Details

The method rgscores() samples scores randomly from a GScores object.

Value

A GRanges object with the sampled genomic positions and scores. When scores.only=TRUE then a numeric vector is returned with the sampled scores.

Author(s)

R. Castelo

References

Puigdevall, P. and Castelo, R. GenomicScores: seamless access to genomewide position-specific scores from R and Bioconductor. Bioinformatics, 18:3208-3210, 2018.

See Also

phastCons100way.UCSC.hg19 MafDb.1Kgenomes.phase1.hs37d5

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## accessing genomic gscores from an annotation package
if (require(phastCons100way.UCSC.hg19)) {
  library(GenomicRanges)

  phast <- phastCons100way.UCSC.hg19
  set.seed(123)
  rgscores(10L, phast, ranges=c("chr22", "chrY"))
}

if (require(MafDb.1Kgenomes.phase1.hs37d5)) {
  mafdb <- MafDb.1Kgenomes.phase1.hs37d5
  set.seed(123)
  rgscores(10L, mafdb, ranges=c("21", "22"))
}

GenomicScores documentation built on Nov. 8, 2020, 5:21 p.m.