R Under development (unstable) (2024-02-16 r85931 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # This test script calls a report generator which requires > # the 'ggplot2' package, which in turn will require packages > # 'colorspace', 'dichromat', 'munsell', 'reshape2' and 'scales'. > > # Only run this test in full testing mode > if (Sys.getenv("_R_CHECK_FULL_") != "") { + library("PSCBS") + stext <- R.utils::stext + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # Load SNP microarray data + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + data <- PSCBS::exampleData("paired.chr01") + str(data) + + data <- data.frame(chromosome=data$chromosome, x=data$x, y=data$CT) + + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # CBS segmentation + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # Drop single-locus outliers + dataS <- dropSegmentationOutliers(data) + + # Speed up example by segmenting fewer loci + dataS <- dataS[seq(from=1, to=nrow(data), by=5),] + + str(dataS) + + gaps <- findLargeGaps(dataS, minLength=2e6) + knownSegments <- gapsToSegments(gaps) + + # CBS segmentation + fit <- segmentByCBS(dataS, knownSegments=knownSegments, + seed=0xBEEF, verbose=-10) + signalType(fit) <- "ratio" + plotTracks(fit) + + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # Call using the UCSF MAD caller (not recommended) + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + fitC <- callGainsAndLosses(fit) + plotTracks(fitC) + pars <- fitC$params$callGainsAndLosses + stext(side=3, pos=1/2, line=-1, substitute(sigma==x, list(x=sprintf("%.2f", pars$sigmaMAD)))) + mu <- pars$muR + tau <- unlist(pars[c("tauLoss", "tauGain")], use.names=FALSE) + abline(h=mu, lty=2, lwd=2) + abline(h=tau, lwd=2) + mtext(side=4, at=tau[1], expression(Delta[LOSS]), adj=-0.2, cex=0.7, las=2, xpd=TRUE) + mtext(side=4, at=tau[2], expression(Delta[GAIN]), adj=-0.2, cex=0.7, las=2, xpd=TRUE) + title(main="CN caller: \"ucsf-mad\"") + + + # Caller to be implemented + deltaCN <- estimateDeltaCN(fit) + tau <- mu + 1/2*c(-1,+1)*deltaCN + abline(h=tau, lty=2, lwd=1, col="red") + + + + } # if (Sys.getenv("_R_CHECK_FULL_")) > > proc.time() user system elapsed 0.15 0.00 0.15