Methfile_read: Read the methylation file.

View source: R/File_read.R

Methfile_readR Documentation

Read the methylation file.

Description

This function reads all of the methylation files and generates one file with all samples including methylated read coverages (Cs) and unmethylated read coverages (Ts). It can automatically test how many samples and how many replicates in each group and the distribute them from 1_1, 1_2 to the final file by headers. The methylation files should be the standard coverage file (i.e., .bismark.cov) outputted from Bismark software. The dataset of the example is the Reduced representation bisulfite sequencing (RRBS) data of DNA methylation for mouse myeloid progenitor tissue from GEO (Accession number: GSE62392) (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE62392).

Usage

Methfile_read(
  paths = paste(system.file(package = "GeneDMRs"), "/methdata", sep = ""),
  control_paths = NULL,
  case_paths = NULL,
  suffix = ".gz",
  WGBS = FALSE
)

Arguments

paths

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

control_paths

refers to the path of control groups, with default NULL.

case_paths

refers to the path of case groups, with default NULL.

suffix

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

WGBS

refers to whether to use Whole genome bisulfite sequencing (WGBS) data, with default FALSE.

Value

Outputs a data frame contain chromosome, position, and Cs & Ts for different replicates and groups.

Examples

# test the functions with default parameters #
inputmethfile <- Methfile_read()
inputmethfile <- Methfile_read(paths = paste(system.file(package = "GeneDMRs"), "/methdata", sep=""), suffix = ".gz")
inputmethfile <- Methfile_read(paths = "C:/Users/GeneDMRs/methdata/", suffix = ".txt.gz", WGBS = TRUE)

# if only case and control group (n = 2) paths are provided #
controls <- c("C:/Users/GeneDMRs/methdata/1_1.gz", "C:/Users/GeneDMRs/methdata/1_2.gz", "C:/Users/GeneDMRs/methdata/1_3.gz")
cases <- c("C:/Users/GeneDMRs/methdata/2_1.gz", "C:/Users/GeneDMRs/methdata/2_1.gz")
inputmethfile <- Methfile_read(control_paths = controls, case_paths = cases)


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