ParseReadCounts: parse readCounts matrix

View source: R/ChIPseqSpikeInFree.R

ParseReadCountsR Documentation

parse readCounts matrix

Description

This function allows you to parse rawCount table (generated by CountRawReads() function) to a parsedMatrix of (cutoff, and percent of reads accumulatively passed the cutoff in each sample).

Usage

ParseReadCounts(
  data,
  metaFile = "sample_meta.txt",
  by = 0.05,
  prefix = "test",
  binSize = 1000,
  ncores = 2
)

Arguments

data

a data.frame returned by readRawCounts() or a file name of rawCount table

metaFile

a data.frame of metadata by ReadMeta(); or a filename of metadata file.

by

step used to define cutoffs; ParseReadCounts will cumulatively calculate the percent of reads that pass the every cutoff.

prefix

prefix of output filename to save the parsedMatrix of (cutoff, and percent of reads accumulatively passed the cutoff in each sample).

binSize

size of bins (bp). Recommend a value bwteen 200 and 10000

ncores

number of cores for parallel computing.

Value

A data.frame of parsed data.

Examples


## prerequisite step 1. count raw reads
## (if your bam files were aligned to mm9 genome with chr in reference chromosomes).
# bams <- c("your/path/ChIPseq1.bam","your/path/ChIPseq2.bam")
# rawCountDF <- CountRawReads(bamFiles=bams,chromFile="mm9",prefix="your/path/test")
## output file will be "your/path/test_rawCount.txt"
# head(rawCountDF,n=2)

# bin   ChIPseq1.bam    ChIPseq2.bam
# chr1:1-1000  0   0
# chr1:1001-2000   0   0

## prerequisite step 2: generate your sample_meta.txt.
##  A tab-delimited txt file has three required columns
# ID    ANTIBODY    GROUP
# ChIPseq1.bam  H3K27me3    WT
# ChIPseq2.bam  H3K27me3    K27M

## 1.parse readCount table using this function.
# metaFile <- "your/path/sample_meta.txt"
# dat <- ParseReadCounts(data="your/path/test_rawCount.txt",
# metaFile=metaFile, prefix="your/path/test")
## output file will be "your/path/test_parsedMatrix.txt"

stjude/ChIPseqSpikeInFree documentation built on March 28, 2022, 5:36 a.m.