baf2mbaf: Calculate mBAF from BAF

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Calculate Mirrored B-Allele Frequence (mBAF) from B-Allele Frequency (BAF) as in Staaf et al., Genome Biology, 2008. BAF is converted to mBAF by folding around 0.5 so that is then between 0.5 and 1. HOM value are then made NA to leave only HET values that can be easily segmented. Values > hom.cutoff are made NA. Then, if genotypes (usually from a matched normal) are provided as the matrix 'calls' additional HOMs can be set to NA. The argument 'call.pairs' is used to match columns in 'calls' to columns in 'baf'.

Usage

1
baf2mbaf(baf, hom.cutoff = 0.95, calls = NULL, call.pairs = NULL)

Arguments

baf

numeric matrix of BAF values

hom.cutoff

numeric, values above this cutoff to be made NA (considered HOM)

calls

matrix of NA, CT, AG, etc. genotypes to select HETs (in normals). Dimnames must match baf matrix.

call.pairs

list, names represent target samples for HOMs to set to NA. Values represent columns in 'calls' matrix.

Value

numeric matix of mBAF values

Examples

1
2
3
4
5
   data(genoset,package='genoset')
   mbaf = baf2mbaf( genoset.ds[, , 'baf'], hom.cutoff=0.9 )
   calls = matrix(sample(c('AT','AA','CG','GC','AT','GG'),(nrow(genoset.ds) * 2),replace=TRUE),ncol=2,dimnames=list(rownames(genoset.ds),c('K','L')))
   mbaf = baf2mbaf( genoset.ds[, , 'baf'], hom.cutoff=0.9, calls = calls, call.pairs = list(K='L',L='L') ) # Sample L is matched normal for tumor sample K, M only uses hom.cutoff
   genoset.ds[, ,'mbaf'] = baf2mbaf( genoset.ds[, , 'baf'], hom.cutoff=0.9 ) # Put mbaf back into the BAFSet object as a new element

genoset documentation built on Nov. 8, 2020, 6:07 p.m.