countReads {Rcade} | R Documentation

## Count Reads

### Description

Most Rcade users will not need to call this function directly. Given targets information linking to bam files, count the reads that lie in defined bins.

### Usage

    countReads(annoZone, targets, fileDir=NULL, dontCheckTargets=FALSE)

### Arguments

`annoZone` | `GRanges` - The bins to be used when counting reads.
`targets` | `data.frame` - Targets file (see vignette)
`fileDir` | `character` - The directory in which the raw ChIP-seq data files are kept.
`dontCheckTargets` | `logical` - If `TRUE`, the targets file is not checked for consistency/appropriate field names. This should not be changed for Rcade purposes, but may be useful if you wish to obtain bin counts for some other purpose. Make sure relevant column names are lower case. Use at your own risk!

### Value

Matrix of read counts, with columns corresponding to samples and rows corresponding to bins.

### Author(s)

Jonathan Cairns

### See Also

`RcadeAnalysis`

### Examples

    	dir <- file.path(system.file("extdata", package="Rcade"), "STAT1")

    	targets <- read.csv(file.path(dir, "targets.csv"), as.is = TRUE)

    	anno <- read.csv(file.path(dir, "anno.csv"))
    	anno <- anno[order(anno$chromosome_name),]
    	colnames(anno) <- c("ENSG","chr","start","end","str")
    	ChIPannoZones <- defineBins(anno, zone=c(-1500, 1500), geneID="ENSG")

    	x <- countReads(ChIPannoZones, targets, fileDir = dir)

[Package Rcade version 1.24.0 Index]