| add_gc_bias {polyester} | R Documentation |
Given a matrix with rows corresponding to transcripts and sample-specific GC bias models, bias the count matrix using the bias model.
add_gc_bias(readmat, gcbias, transcripts)
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 |
transcripts |
|
Designed for internal use in simulate_experiment functions.
matrix of the same size as readmat, but with counts for each
replicate biased according to gcbias.
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)