add_gc_bias {polyester} | R Documentation

## add GC bias to a count matrix

### Description

Given a matrix with rows corresponding to transcripts and sample-specific GC bias models, bias the count matrix using the bias model.

### Usage

    add_gc_bias(readmat, gcbias, transcripts)

### Arguments

`readmat` | matrix of counts, with rows corresponding to features (transcripts) and columns corresponding to replicates
`gcbias` | List of GC bias models to add to readmat. Must have length equal to the number of columns of `readmat`. List elements must either be integers 0 through 7, where 0 means no bias and 1-7 correspond to built-in GC bias models, or objects of class `loess` which can predict a deviation from overall mean count (on the log scale) given a GC percentage between 0 and 1.
`transcripts` | `DNAStringSet` object containing the sequences of the features (transcripts) corresponding to the rows of `readmat`. Length must be equal to the number of rows in `readmat`.

### Details

Designed for internal use in `simulate_experiment` functions.

### Value

matrix of the same size as `readmat`, but with counts for each replicate biased according to `gcbias`.

### Examples

      library(Biostrings)
      fastapath = system.file("extdata", "chr22.fa", package="polyester")
      numtx = count_transcripts(fastapath)
      transcripts = readDNAStringSet(fastapath)

      # create a count matrix:
      readmat = matrix(20, ncol=10, nrow=numtx)
      readmat[1:30, 1:5] = 40

      # add biases randomly: use built-in bias models
      set.seed(137)
      biases = sample(0:7, 10, replace=TRUE)
      readmat_biased = add_gc_bias(readmat, as.list(biases), transcripts)

[Package polyester version 1.28.0 Index]