createBsseqObject {MethCP}R Documentation

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

Description

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

Usage

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

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')


[Package MethCP version 1.7.0 Index]