From da8875458bb65546b986c2e5358c93b7e67a75d1 Mon Sep 17 00:00:00 2001 From: Liam Flinn Spurr Date: Wed, 24 Jan 2024 18:12:37 -0600 Subject: [PATCH] fix edge case where two types of alterations affected the same length of an arm --- ascets_resources.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ascets_resources.R b/ascets_resources.R index 7165cd2..ed95d0f 100644 --- a/ascets_resources.R +++ b/ascets_resources.R @@ -85,6 +85,12 @@ make_arm_call <- function(df, thresh) { max_alt_type <- df[df$alt_frac == max_alt,]$alt # assign call based on alteration threshold + if(length(max_alt_type) > 1 & ("DEL" %in% max_alt_type & "AMP" %in% max_alt_type)) { # edge case where two types affect exactly the same fraction of an arm + return(data.frame(sample = as.character(df$sample[1]), ARM = as.character(df$arm[1]), CALL = "NC")) + } else if (length(max_alt_type) > 1) { + max_alt_type <- max_alt_type[max_alt_type != "NEUTRAL"] + } + if(max_alt_type == "NEUTRAL") { if(max_alt >= thresh) call <- max_alt_type else call <- "NC"