R/getExpectedCounts.R

# Function to calculate the expected number of read counts for a gene based
# on labeled and unlabeled RNA amounts, the length of the gene, and sequencing
# depth and cross contamination rate of the sample
# 
# Author: demel
###############################################################################



#' Implementation of Equation 1 and 2 -> get alpha and beta
#' 
#' @param L length Li of genes
#' @param labeled.amount labeled amount of gene i in sample j = alpha_ij
#' @param unlabeled.amount unlabeled amount of gene i in sample j = beta_ij
#' @param N number of cells
#' @param epsilon cross contamination rate (=1 in total samples)
#' @param sigma sequencing depth in sample j (independent whether total or 
#' labeled sample)
#' @return expected counts
#' 
#' @author Carina Demel
#' @export
getExpectedCounts <- function(
		L,
		labeled.amount,
		unlabeled.amount,
		N,
		epsilon,
		sigma
){
	exp.counts = N * L * 
							t(sigma * (t(labeled.amount) + epsilon * t(unlabeled.amount)))
	
	return(exp.counts)
}
carinademel/RNAlife documentation built on May 13, 2019, 12:43 p.m.