createBsseqObject: Helper function to read text files and create a bsseq object.

Description Usage Arguments Value Examples

View source: R/createBsseqObject.R

Description

Create a bsseq object when the data for each sample is stored in a separate text file.

Usage

1
2
3
createBsseqObject(
    files, sample_names, 
    chr_col, pos_col, m_col, cov_col, header = TRUE)

Arguments

files

a charactor vector of file names with full path to the file.

sample_names

a charactor vector of sample names. It should have the same length as files vector.

chr_col

name or index of the chromosome column in data files.

pos_col

name or index of the position column in data files.

m_col

name or index of the methylated counts column.

cov_col

name or index of the coverage counts column.

header

a logical value indicating whether the file contains the names of the variables as its first line. dedault TRUE.

Value

a MethCP object that is not segmented.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(bsseq)
# The dataset is consist of 6 samples. 3 samples are H2A.Z mutant 
# plants, and 3 samples are controls.
sample_names <- c(
    paste0("control", seq_len(3)), 
    paste0("treatment", seq_len(3))
)

# Get the vector of file path and names 
raw_files <- system.file(
    "extdata", paste0(sample_names, ".txt"), package = "MethCP")

# load the data
bs_object <- createBsseqObject(
    files = raw_files, sample_names = sample_names, 
    chr_col = 'Chr', pos_col = 'Pos', m_col = "M", cov_col = 'Cov')

boyinggong/MethCP documentation built on April 25, 2021, 6:27 p.m.