diff --git a/NAMESPACE b/NAMESPACE
index 5e27d465..89bd2ea9 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -29,6 +29,7 @@ export(enquo)
export(enquos)
export(enrich_component_strand_bias)
export(expr)
+export(get_Aneuploidy_score)
export(get_adj_p)
export(get_bayesian_result)
export(get_cn_freq_table)
diff --git a/NEWS.md b/NEWS.md
index 15209a9d..6040afea 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,6 @@
# sigminer 2.0.4
+- Implemented Cohen-Sharir method-like Aneuploidy Score.
- Enhanced error handling in `show_sig_feature_corrplot()` (#376).
- Fixed INDEL classification.
- Fixed end position determination in `read_vcf()`.
diff --git a/R/get.R b/R/get.R
index 95867d96..b3c21681 100644
--- a/R/get.R
+++ b/R/get.R
@@ -275,80 +275,6 @@ get_LengthFraction <- function(CN_data,
segTab[, c(colnames(arm_data)[-1], "flag") := NULL]
segTab
-
- # .annot_fun <- function(chrom, start, end, p_start, p_end, p_length, q_start, q_end, q_length, total_size) {
- # if (end <= p_end & start >= p_start) {
- # ## 1L
- # location <- paste0(sub("chr", "", chrom), "p")
- # annotation <- "short arm"
- # fraction <- (end - start + 1) / (p_end - p_start + 1)
- # } else if (end <= q_end &
- # start >= q_start) {
- # ## 2L
- # location <- paste0(sub("chr", "", chrom), "q")
- # annotation <- "long arm"
- # fraction <- (end - start + 1) / (q_end - q_start + 1)
- # } else if (start >= p_start &
- # start <= p_end &
- # end >= q_start & end <= q_end) {
- # ## 3L
- # location <- paste0(sub("chr", "", chrom), "pq") # across p and q arm
- # annotation <- "across short and long arm"
- # fraction <- 2 * ((end - start + 1) / total_size)
- # } else if (start < p_end & end < q_start) {
- # ## 4L
- # location <- paste0(sub("chr", "", chrom), "p")
- # annotation <- "short arm intersect with centromere region"
- # # only calculate region does not intersect
- # fraction <- (end - start + 1 - (end - p_end)) / (p_end - p_start + 1)
- # } else if (start > p_end &
- # start < q_start & end > q_start) {
- # ## 5L
- # location <- paste0(sub("chr", "", chrom), "q")
- # annotation <- "long arm intersect with centromere region"
- # # only calculate region does not intersect
- # fraction <- (end - start + 1 - (start - q_start)) / (q_end - q_start + 1)
- # } else {
- # ## 6L
- # location <- paste0(sub("chr", "", chrom), "pq") # suppose as pq
- # annotation <- "segment locate in centromere region"
- # fraction <- 2 * ((end - start + 1) / total_size)
- # }
- #
- # dplyr::tibble(location = location, annotation = annotation, fraction = fraction)
- # }
- #
- # annot_fun <- function(chrom, start, end, p_start, p_end, p_length, q_start,
- # q_end, q_length, total_size, .pb = NULL) {
- # if (.pb$i < .pb$n) .pb$tick()$print()
- # .annot_fun(
- # chrom, start, end, p_start, p_end, p_length, q_start,
- # q_end, q_length, total_size
- # )
- # }
- #
- # pb <- progress_estimated(nrow(segTab), 0)
- #
- # annot <- purrr::pmap_df(
- # list(
- # chrom = segTab$chromosome,
- # start = segTab$start,
- # end = segTab$end,
- # p_start = segTab$p_start,
- # p_end = segTab$p_end,
- # p_length = segTab$p_length,
- # q_start = segTab$q_start,
- # q_end = segTab$q_end,
- # q_length = segTab$q_length,
- # total_size = segTab$total_size
- # ), annot_fun,
- # .pb = pb
- # )
- #
- # cbind(
- # data.table::as.data.table(segTab)[, colnames(arm_data)[-1] := NULL],
- # data.table::as.data.table(annot)
- # )
}
diff --git a/R/get_Aneuploidy_score.R b/R/get_Aneuploidy_score.R
new file mode 100644
index 00000000..b8258332
--- /dev/null
+++ b/R/get_Aneuploidy_score.R
@@ -0,0 +1,105 @@
+#' Get Aneuploidy Score from Copy Number Profile
+#'
+#' This implements a Cohen-Sharir method (see reference) like "Aneuploidy Score" computation.
+#' You can read the source code to see how it works. Basically, it follows
+#' the logic of Cohen-Sharir method but with some difference in detail implementation.
+#' Their results should be counterpart, but with no data validation for now.
+#' **Please raise an issue if you find problem/bugs in this function**.
+#'
+#' @inheritParams read_copynumber
+#' @param data a CopyNumber object or a `data.frame` containing at least
+#' 'chromosome', 'start', 'end', 'segVal', 'sample' these columns.
+#' @param ploidy_df default is `NULL`, compute ploidy by segment-size weighted copy number
+#' aross autosome, see [get_cn_ploidy]. You can also provide a `data.frame` with 'sample'
+#' and 'ploidy' columns.
+#' @references
+#' - Cohen-Sharir, Y., McFarland, J. M., Abdusamad, M., Marquis, C., Bernhard, S. V., Kazachkova, M., ... & Ben-David, U. (2021). Aneuploidy renders cancer cells vulnerable to mitotic checkpoint inhibition. Nature, 1-6.
+#' - Logic reference:
R/get_Aneuploidy_score.R
+ get_Aneuploidy_score.Rd
This implements a Cohen-Sharir method (see reference) like "Aneuploidy Score" computation. +You can read the source code to see how it works. Basically, it follows +the logic of Cohen-Sharir method but with some difference in detail implementation. +Their results should be counterpart, but with no data validation for now. +Please raise an issue if you find problem/bugs in this function.
+get_Aneuploidy_score(data, ploidy_df = NULL, genome_build = "hg19")+ +
data | +a CopyNumber object or a |
+
---|---|
ploidy_df | +default is |
+
genome_build | +genome build version, should be 'hg19', 'hg38', 'mm9' or 'mm10'. |
+
A data.frame
Cohen-Sharir, Y., McFarland, J. M., Abdusamad, M., Marquis, C., Bernhard, S. V., Kazachkova, M., ... & Ben-David, U. (2021). Aneuploidy renders cancer cells vulnerable to mitotic checkpoint inhibition. Nature, 1-6.
Logic reference: https://github.com/quevedor2/aneuploidy_score/.
# Load copy number object +load(system.file("extdata", "toy_copynumber.RData", + package = "sigminer", mustWork = TRUE +)) + +df <- get_Aneuploidy_score(cn) +df + +df2 <- get_Aneuploidy_score(cn@data) +df2 + +df3 <- get_Aneuploidy_score(cn@data, + ploidy_df = get_cn_ploidy(cn@data) +) +df3 ++
Get Ploidy from Absolute Copy Number Profile
Get Aneuploidy Score from Copy Number Profile