# NOT RUN {
# Generating a random copy number profile
set.seed(705)
cns <- rpois(30, 3) + 1
x <- unlist(lapply(cns, function(cn) rpois(100, 25 * cn)))
annotations <- data.frame(chrom = 1, start = 1:length(x), end = 1:length(x))
# Inferring ploidy
# Annotations and penalty are optional
estimate.from.bincounts <- ploidy.inference(x, annotations$chrom, annotations$start, penalty = 25)
# Using scquantum internal functions to segment the data and estimate index
# of git@github.com:navinlabcode/scquantum.git
# dispersion
mu.est <- mean(x)
iod.est <- timeseries.iod(x)
seg <- prof2invals(x, 25, annotations, "chrom", "start", "end")
mean.est <- mean(x)
iod.est <- timeseries.iod(x)
estimate.from.segmentation <-
ploidy.inference(
seg$mean,
seg$chrom,
seg$start,
seg$end,
iod = iod.est,
mean_bincount = mean.est,
do_segmentation = FALSE
)
# }
Run the code above in your browser using DataLab