#' Segment Varbin
#'
#' @param dat
#'
#' @return
#' @export
#'
#' @examples
segment_varbin <- function(dat) {
dat$loess.ratio[which(dat$loess.ratio == 0)] <- 1e-3
dat$chrom <- as.numeric(dat$chrom)
# creating a CNA object
CNA.object <- DNAcopy::CNA(log(dat$loess.ratio, base=2), dat$chrom, dat$chrompos, data.type="logratio",
sampleid="dat")
# smoothing outliers
smoothed.CNA.object <- DNAcopy::smooth.CNA(CNA.object)
# segmenting with CBS
segment.smoothed.CNA.object <- DNAcopy::segment(smoothed.CNA.object,
alpha=0.01,
min.width=5,
undo.splits="prune",
undo.prune=0.05)
dat$seg.mean.loess <- rep(2^segment.smoothed.CNA.object$output$seg.mean,
segment.smoothed.CNA.object$output$num.mark)
return(dat)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.