Learn R Programming

metagene (version 1.0.0)

parseRegions: Parse an experiment using regions that can be of different length.

Description

This function produces the list object that contains all the information necessary to produce a metagene-like plot with the plotGraphic function.

Usage

parseRegions( regions, bamFiles, specie="human", design=NULL, paddingSize, cores=1, debug=FALSE)

Arguments

regions
A vector of bed file names corresponding to the regions to include in the analysis, a GRanges object or a GRangesList object.
bamFiles
A vector of BAM files to plot. All BAM files must exist.
specie
human: Homo sapiens (default). mouse: Mus musculus.
design
A data.frame explaining the relationship between multiple samples. One line per samples. One column per group of samples. For example, biological replicates and corresponding controls are in the same group. 1: treatment file(s). 2: control file(s).
paddingSize
The length of padding we want to add on each side of each regions. The padding size has to be a positive integer
cores
Number of cores for parallel processing. Require parallel package. The number of cores has to be a positive integer.
debug
Keep the intermediate files (can use a lot of memory). TRUE or FALSE.

Value

plotRegions returns a list that contains the data necessary to produce a plot.The data structure is a list of lists.The first level contain the following fields:
  • design: The information from the design file.
  • param: The values of the argument used with parseFeatures.
  • bamFilesDescription: A data.frame with the following columns;
    • The names of the original bam files.
    • The names of the sorted bam files
    • The number of aligned reads.
  • matrix: A list of matrix that will be used to produce the plot. One element by combination of features/design groups.

Details

This function will extract the read density from alignments files (BAM) in one or multiple list of regions.

The values are normalized as read per millions aligned (RPM).

It is possible to parse multiple groups of regions by saving each regions in a separate bed file and by listing the file names in a vector as the regions parameter.

By using the design parameter, the parseRegions function will deal with more complex experimental design such as the use of replicates and/or controls. The values of controls are substracted from every replicates.

Examples

Run this code
  # Minimally, we need a bam file name and a list of regions
  bamFileName <- system.file("extdata/align1_rep1.bam", package="metagene")
  listFileName <- system.file("extdata/list1.bed", package="metagene")
  groups <- parseRegions(listFileName, bamFileName, specie="mouse")

Run the code above in your browser using DataLab