shiftAndAttenuateProportions {MBASED} | R Documentation |
Helper function to adjust proportions for pre-existing allelic bias and also to obtain estimate of proportion variance based on attenuated read counts (adding pseudocount of 0.5 to each allele in each sample).
shiftAndAttenuateProportions(countsMat, totalsMat, probsMat, rhosMat, checkArgs = FALSE)
countsMat |
matrix of observed major allele counts. Each row represents a specific genomic locus, while each column represents a set of observed major allele counts across loci (in practice, multiple columns represent different outcomes of count simulations). |
totalsMat |
matrix of total read counts across both alleles. The interpretation of rows and columns is the same as for countsMat. |
probsMat |
matrix of underlying probabilites of observing the major allele. The interpretation of rows and columns is the same as for countsMat. |
rhosMat |
matrix of dispersion parameters of beta distributions for each locus. The interpretation of rows and columns is the same as for countsMat. |
checkArgs |
single boolean specifying whether arguments should be checked for adherence to specifications. DEFAULT: FALSE |
a list with 2 elements:
propsShifted |
a 1-row marix of shifted major allele frequencies |
propsShiftedVars |
a 1-row matrix of estimated variances of obtained MAF estimates |
SNVCoverageTumor=sample(10:100,10) ## 2 genes with 5 loci each SNVAllele1CountsTumor=rbinom(length(SNVCoverageTumor), SNVCoverageTumor, 0.5) MBASED:::shiftAndAttenuateProportions(countsMat=matrix(SNVAllele1CountsTumor, ncol=2), totalsMat=matrix(SNVCoverageTumor, ncol=2), probsMat=matrix(rep(0.5, length(SNVCoverageTumor)), ncol=2), rhosMat=matrix(rep(0, length(SNVCoverageTumor)), ncol=2))