Description Usage Arguments Author(s) Examples

View source: R/randomInterval.R

Given a set of regions, generate genomic intervals uniformly at random from those regions. These can be strand specific or not.

1 2 | ```
randomInterval(I, n = 1, ms = 10000, strand.specific = FALSE,
randomize.strand = FALSE)
``` |

`I` |
A GRanges object giving intervals from which to sample from. |

`n` |
Number of intervals to generate. |

`ms` |
Length of intervals to generate. It can be a vector but
recycling rules will be used if |

`strand.specific` |
Whether the random intervals should have be strand specific or not. |

`randomize.strand` |
When |

Leonardo Collado-Torres

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
## Create some input ranges
library('GenomicRanges')
gr <- GRanges(c('chr1', 'chrX'), IRanges(c(1e6, 3e6), width = 1e5), strand =
c('+', '-'))
gr
## Set the seed if you want to reproduce the random results
set.seed(20140728)
## Obtain 4 randomg intervals
randomInterval(gr, 4)
## Strand specific without randomizing the strand
randomInterval(gr, 4, strand.specific = TRUE)
## This function is a modified version of seqbias::random.intervals
## Check the original code below:
library('seqbias')
random.intervals
## Some key differences are that randomInterval works with repeated
## seqnames and starts at the beginning of the input ranges, not at base 1.
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.