From 406a3fca38159ab962c983a3f7d12cbae8930966 Mon Sep 17 00:00:00 2001 From: Markus Riester Date: Fri, 25 Feb 2022 22:09:54 -0500 Subject: [PATCH] Potential fix for #225. --- DESCRIPTION | 4 ++-- NEWS | 2 ++ R/calculateMappingBiasVcf.R | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 04cbf1c..5f76898 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Package: PureCN Type: Package Title: Copy number calling and SNV classification using targeted short read sequencing -Version: 2.1.8 -Date: 2022-02-11 +Version: 2.1.9 +Date: 2022-02-25 Authors@R: c(person("Markus", "Riester", role = c("aut", "cre"), email = "markus.riester@novartis.com", diff --git a/NEWS b/NEWS index b8c6a23..43bb944 100755 --- a/NEWS +++ b/NEWS @@ -24,6 +24,8 @@ BUGFIXES o Fix for a crash when there are no off-target reads in off-target regions (#209). o Fixed parsing of base quality scores in Mutect 2.2 + o Fixed crash in GenomicsDB parsing when there were no variants in contig + (#225) Changes in version 2.0.0 diff --git a/R/calculateMappingBiasVcf.R b/R/calculateMappingBiasVcf.R index a081731..c33e5e0 100644 --- a/R/calculateMappingBiasVcf.R +++ b/R/calculateMappingBiasVcf.R @@ -188,6 +188,7 @@ calculateMappingBiasGatk4 <- function(workspace, reference.genome, genomicsdb::disconnect(db) flog.info("Collecting variant information...") # concat with minimal memory overhead + parsed_ad_list <- parsed_ad_list[!sapply(parsed_ad_list, is.null)] m_alt <- as.matrix(rbindlist(lapply(parsed_ad_list, function(x) data.frame(x$alt)), fill = TRUE)) for (i in seq_along(parsed_ad_list)) parsed_ad_list[[i]]$alt <- NULL m_ref <- as.matrix(rbindlist(lapply(parsed_ad_list, function(x) data.frame(x$ref)), fill = TRUE)) @@ -214,6 +215,7 @@ calculateMappingBiasGatk4 <- function(workspace, reference.genome, } .parseADGenomicsDb <- function(query, AF.info.field = "AF") { + if (!nrow(query)) return(NULL) ref <- dcast(query, CHROM + POS + END + REF + ALT ~ SAMPLE, value.var = "AD") af <- dcast(query, CHROM + POS + END + REF + ALT ~ SAMPLE, value.var = AF.info.field) gr <- GRanges(seqnames = ref$CHROM, IRanges(start = ref$POS, end = ref$END),