Learn R Programming

kmeRtone (version 1.0)

example_genome_coor: Example genome coordinate file

Description

Below is an example code that generates random genomic coordinates.

Usage

example_genome_coor

Arguments

Format

A data frame with 1001 rows and 3 columns

seqnames

Chromosome number of the recorded biological event, e.g. DNA strand breaks

start

5' start position of the recorded biological event

width

Sequence width of the recorded biological event, e.g. 2 for a DNA strand break

Examples

Run this code
# \donttest{
library(data.table)
library(kmeRtone)

# 1. Randomly generate genomic positions and save results
temp_dir <- tempdir()

set.seed(1234)
temp_files <- character(1)
for(chr in 1){
    genomic_coor <- data.table::data.table(
        seqnames = paste0("chr", chr),
        start = sample(
            x = 10000:10000000, 
            size = 100000, 
            replace = FALSE
        ),
        width = 2
    )

    f <- file.path(temp_dir, paste0("chr", chr, ".csv"))
    fwrite(genomic_coor, f)
    temp_files[chr] <- f
}

rm_files <- file.remove(temp_files)
# }

Run the code above in your browser using DataLab