Bedfile_read: Read the standard bedfile of refseq or cpgi downloaded from...

View source: R/File_read.R

Bedfile_readR Documentation

Read the standard bedfile of refseq or cpgi downloaded from UCSC.

Description

This function reads the bed file of refseq or cpgi and sorts them by chromosome and position. The dataset of the example are the mouse reference genes and CpG island information that are downloaded from UCSC website (http://genome.ucsc.edu/cgi-bin/hgTables). The R package genomation used here can divide the refseq.bed file into several gene body features, e.g., promoter, exon, intron regions and the cpgi.bed file into CpG island features, e.g., CpG island and CpG island shore.

Usage

Bedfile_read(
  paths = paste(system.file(package = "GeneDMRs"), "/methdata", sep = ""),
  bedfile = "refseq",
  suffix = ".txt",
  feature = FALSE,
  featurewrite = TRUE
)

Arguments

paths

refers to the path of bed file, with default the package path.

bedfile

refers to the file name of bed file like "refseq" or "cpgi". This file is downloaded from UCSC website, with default "refseq".

suffix

refers to the suffix of bed file, e.g., ".gz", ".zip" and so on (some files are in text .txt format, then ".txt" or ".txt.gz"), with default ".txt".

feature

refers to whether to read the bed with the features, with default FALSE. If feature = TRUE, the output of this function will contain the features e.g., promoter, exon, intron or CpG island, CpG island shore based on R package genomation.

featurewrite

refers to whether to write out the feature file to the given path, with default FALSE.

Value

Outputs a data frame contains four columns of chromosome, start position, end position. If feature = TRUE, the data frame is five columns with the added feature such as genebody or cpgfeature.

References

Akalin A, Franke V, Vlahovicek K, Mason C, Schubeler D (2014). "genomation: a toolkit to summarize, annotate and visualize genomic intervals." Bioinformatics. doi: 10.1093/bioinformatics/btu775, http://bioinformatics.oxfordjournals.org/content/early/2014/12/04/bioinformatics.btu775.long.

Examples

inputrefseqfile <- Bedfile_read()
inputrefseqfile <- Bedfile_read(paths = paste(system.file(package = "GeneDMRs"), "/methdata", sep=""), bedfile = "refseq", suffix = ".txt", feature = FALSE)
inputcpgifile <- Bedfile_read(paths = paste(system.file(package = "GeneDMRs"), "/methdata", sep=""), bedfile = "cpgi", suffix = ".txt", feature = FALSE)
head(inputrefseqfile)
head(inputcpgifile)

inputgenebodyfile <- Bedfile_read(bedfile = "refseq", feature = TRUE, featurewrite = TRUE)
inputcpgifeaturefile <- Bedfile_read(bedfile = "cpgi", feature = TRUE, featurewrite = FALSE)
head(inputgenebodyfile)
head(inputcpgifeaturefile)


xiaowangCN/GeneDMRs documentation built on Nov. 22, 2023, 11:19 p.m.