Generate randomly placed intervals on a genome.

bed_random(genome, length = 1000, n = 1e+06, sort_by = c("chrom",
  "start"), seed = 0)

Arguments

genome

tbl_genome()

length

length of intervals

n

number of intervals to generate

sort_by

sorting variables

seed

seed RNG for reproducible intervals

Value

tbl_interval()

Details

Sorting can be suppressed with sort_by = NULL.

See also

Examples

genome <- trbl_genome( ~chrom, ~size, "chr1", 10000000, "chr2", 50000000, "chr3", 60000000, "chrX", 5000000 ) bed_random(genome, seed = 10104)
#> # A tibble: 1,000,000 x 3 #> chrom start end #> <chr> <int> <int> #> 1 chr1 108 1108 #> 2 chr1 222 1222 #> 3 chr1 316 1316 #> 4 chr1 636 1636 #> 5 chr1 762 1762 #> 6 chr1 994 1994 #> 7 chr1 1044 2044 #> 8 chr1 1115 2115 #> 9 chr1 1236 2236 #> 10 chr1 1247 2247 #> # ... with 999,990 more rows
# sorting can be suppressed bed_random(genome, sort_by = NULL, seed = 10104)
#> # A tibble: 1,000,000 x 3 #> chrom start end #> <chr> <int> <int> #> 1 chr3 2703523 2704523 #> 2 chr3 25572641 25573641 #> 3 chr2 43591664 43592664 #> 4 chr2 36729533 36730533 #> 5 chr3 39340630 39341630 #> 6 chr3 5444257 5445257 #> 7 chr3 25169413 25170413 #> 8 chrX 2348141 2349141 #> 9 chr3 21266015 21267015 #> 10 chr2 19119330 19120330 #> # ... with 999,990 more rows
# 500 random intervals of length 500 bed_random(genome, length = 500, n = 500, seed = 10104)
#> # A tibble: 500 x 3 #> chrom start end #> <chr> <int> <int> #> 1 chr1 143339 143839 #> 2 chr1 395247 395747 #> 3 chr1 1340905 1341405 #> 4 chr1 1662968 1663468 #> 5 chr1 2145462 2145962 #> 6 chr1 2159360 2159860 #> 7 chr1 2224349 2224849 #> 8 chr1 2226142 2226642 #> 9 chr1 2255856 2256356 #> 10 chr1 2578266 2578766 #> # ... with 490 more rows