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. > library("PSCBS") PSCBS v0.67.0 successfully loaded. See ?PSCBS for help. > > # Simulating copy-number data > set.seed(0xBEEF) > > # Simulate CN data > J <- 1000 > mu <- double(J) > mu[200:300] <- mu[200:300] + 1 > mu[350:400] <- NA # centromere > mu[650:800] <- mu[650:800] - 1 > eps <- rnorm(J, sd=1/2) > y <- mu + eps > x <- seq(from=1, to=100e6, length.out=J) > > data <- data.frame(chromosome=0L, x=x) > > gaps <- findLargeGaps(x=x, minLength=1e6) > print(gaps) [1] start end length <0 rows> (or 0-length row.names) > stopifnot(is.data.frame(gaps)) > stopifnot(nrow(gaps) == 0L) > segs <- gapsToSegments(gaps) > print(segs) chromosome start end 1 0 -Inf Inf > stopifnot(is.data.frame(segs)) > stopifnot(nrow(segs) == 1L) > > > gaps <- findLargeGaps(data, minLength=1e6) > print(gaps) [1] chromosome start end <0 rows> (or 0-length row.names) > stopifnot(is.data.frame(gaps)) > stopifnot(nrow(gaps) == 0L) > segs <- gapsToSegments(gaps) > print(segs) chromosome start end 1 0 -Inf Inf > stopifnot(is.data.frame(segs)) > stopifnot(nrow(segs) == 1L) > > > ## Add missing values > data2 <- data > data$x[30e6 < x & x < 50e6] <- NA > gaps <- findLargeGaps(data, minLength=1e6) > print(gaps) chromosome start end length 1 0 29929932 50050050 20120118 > stopifnot(is.data.frame(gaps)) > stopifnot(nrow(gaps) == 1L) > segs <- gapsToSegments(gaps) > print(segs) chromosome start end length 1 0 -Inf 29929931 Inf 2 0 29929932 50050050 20120118 3 0 50050051 Inf Inf > stopifnot(is.data.frame(segs)) > stopifnot(nrow(segs) == 3L) > > > > # BUG FIX: Issue #6 > gaps <- findLargeGaps(chromosome=rep(1,10), x=1:10, minLength=2) > print(gaps) [1] chromosome start end <0 rows> (or 0-length row.names) > stopifnot(is.data.frame(gaps)) > stopifnot(nrow(gaps) == 0L) > # BUG FIX: Issue #9 > segs <- gapsToSegments(gaps) > print(segs) chromosome start end 1 0 -Inf Inf > stopifnot(is.data.frame(segs)) > stopifnot(nrow(segs) == 1L) > > > # BUG FIX: PSCBS GitHub Issue #8 > gaps <- try({ + findLargeGaps(chromosome=rep(1,3), x=as.numeric(1:3), minLength=1) + }) Error in findLargeGaps.default(chromosome = rep(1, 3), x = as.numeric(1:3), : Cannot identify large gaps. Argument 'resolution' (=1) is not strictly smaller than 'minLength' (=1). > stopifnot(inherits(gaps, "try-error")) > > proc.time() user system elapsed 0.34 0.09 0.56