random_intervals: Generating random genomic intervals

Description Usage Arguments Details Value Author(s) Examples

Description

Given a vector of sequence lengths, generate genomic intervals uniformly at random

Usage

1
random.intervals(I, n=1, ms=10000)

Arguments

I

a GRanges object giving intervals from which to sample from

n

number of intervals to generate

ms

length of the intervals to generate (may be a vector)

Details

The function is used to place intervals of fixed sizes at random (possibly overlapping) positions across one or more sequences. The input should be a GRanges objects giving the sequence intervals in which the random intervals sholud be placed. If they are to be placed anywhere within a reference sequence, use the scanFaIndex function from Rsamtools, to obtain a set of intervals.

Value

Returns a GRanges object giving the generated intervals.

Author(s)

Daniel Jones dcjones@cs.washington.edu

Examples

1
2
3
4
5
6
7
8
  library(Rsamtools)
  ref_fn <- system.file( "extra/example.fa", package = "seqbias" )
  ref_f <- FaFile( ref_fn )
  open.FaFile( ref_f )

  ref_seqs <- scanFaIndex( ref_f )

  I <- random.intervals( ref_seqs, n = 100, ms = 1000 )

Example output

Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

Loading required package: S4Vectors

Attaching package:S4VectorsThe following object is masked frompackage:base:

    expand.grid

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: Biostrings
Loading required package: XVector

Attaching package:BiostringsThe following object is masked frompackage:base:

    strsplit

seqbias documentation built on Nov. 8, 2020, 5:55 p.m.