Learn R Programming

metagene (version 1.0.0)

removeControls: Substract controls from a single group

Description

This function will substract controls for every replicates in the same group. If there are multiple controls, their values will be averaged before substracting them from the input. Values cannot be lower than 0.

Usage

removeControls( group, data.rpm, design, controlCores=1)

Arguments

group
A group extracted from the main data structure
data.rpm
The normalized data for every bam files.
design
The line from matrix explaining the relationship between current samples.
controlCores
Number of cores for parallel processing ( require parallel package).

Value

removeControls The group extracted from the main data structure from which the controls were substracted then deleted

Examples

Run this code
  # Prepare bam files
  ## Not run: bamFileInput <- system.file("extdata/align1_rep1.bam", package="metagene")
  ## Not run: bamFileControl <- system.file("extdata/ctrl.bam", package="metagene")
  ## Not run: bamFiles <- c(bamFileInput, bamFileControl)
  ## Not run: groups <- list()
  ## Not run: groups$bamFilesDescription <- metagene:::prepareBamFiles(bamFiles)

  # Parse features and convert to RPM
  ## Not run: features <- system.file("extdata/list1.txt", package="metagene")
  ## Not run: groups$design <- data.frame(Samples=c(bamFileInput, bamFileControl), Exp1=c(1,2))
  ## Not run: groups$regionsGroups <- metagene:::prepareFeatures(features=features, specie="mouse", maxDistance=1000)
  ## Not run: groups$raw <- metagene:::parseBamFiles(groups$bamFilesDescription$bam, groups$regionsGroups)
  ## Not run: groups$rpm <- metagene:::rawCountsToRPM(groups$raw, groups$bamFilesDescription)
  ## Not run: groups$data <- metagene:::prepareGroups(names(groups$regionsGroups), bamFiles=groups$bamFilesDescription, design=groups$design)

  # Remove controls
  ## Not run: groups$data <- metagene:::applyOnGroups(groups=groups$data, cores=1, FUN=metagene:::removeControls, data.rpm=groups$rpm, design=groups$design)

Run the code above in your browser using DataLab