Browse code

Added version to runAbsoluteCN results; fix warning in that function.

Markus Riester authored on 10/08/2021 20:52:21
Showing 5 changed files

... ...
@@ -2,8 +2,8 @@ Package: PureCN
2 2
 Type: Package
3 3
 Title: Copy number calling and SNV classification using
4 4
     targeted short read sequencing
5
-Version: 1.23.10
6
-Date: 2021-08-07
5
+Version: 1.23.11
6
+Date: 2021-08-10
7 7
 Authors@R: c(person("Markus", "Riester",
8 8
                     role = c("aut", "cre"),
9 9
                     email = "[email protected]",
... ...
@@ -33,6 +33,7 @@ Imports:
33 33
     GenomeInfoDb,
34 34
     GenomicFeatures,
35 35
     Rsamtools,
36
+    Biobase,
36 37
     Biostrings,
37 38
     BiocGenerics,
38 39
     rtracklayer,
... ...
@@ -44,6 +44,7 @@ export(setPriorVcf)
44 44
 import(DNAcopy)
45 45
 import(IRanges)
46 46
 import(VariantAnnotation)
47
+importFrom(Biobase,package.version)
47 48
 importFrom(BiocGenerics,score)
48 49
 importFrom(BiocGenerics,unstrand)
49 50
 importFrom(Biostrings,DNAStringSet)
... ...
@@ -9,6 +9,7 @@ SIGNIFICANT USER-VISIBLE CHANGES
9 9
       off-target regions in high quality samples where those minor off-sets
10 10
       sometimes exceeded the noise.
11 11
     o Added min.variants argument to runAbsoluteCN
12
+    o Added PureCN version to runAbsoluteCN results object (ret$version)
12 13
 
13 14
 BUGFIXES
14 15
 
... ...
@@ -265,6 +265,7 @@
265 265
 #' @import DNAcopy
266 266
 #' @import IRanges
267 267
 #' @import VariantAnnotation
268
+#' @importFrom Biobase package.version
268 269
 #' @importFrom GenomicRanges GRanges tile
269 270
 #' @importFrom stats complete.cases dbeta dnorm dunif runif weighted.mean
270 271
 #'             dbinom C
... ...
@@ -914,7 +915,7 @@ runAbsoluteCN <- function(normal.coverage.file = NULL,
914 915
         p <- sol$purity
915 916
         if (!is.null(vcf.file)) {
916 917
             flog.info("Fitting variants with %s model for local optimum %i/%i...",
917
-                model, sol$candidate.id, nrow(candidate.solutions$candidates), p)
918
+                model, sol$candidate.id, nrow(candidate.solutions$candidates))
918 919
         }
919 920
         if (sol$fraction.subclonal > max.non.clonal) {
920 921
             .stopRuntimeError(".fitSolution received high subclonal solution.")
... ...
@@ -1124,6 +1125,7 @@ runAbsoluteCN <- function(normal.coverage.file = NULL,
1124 1125
             args = list(
1125 1126
                 filterVcf = args.filterVcf[vapply(args.filterVcf, object.size, double(1)) < 1000],
1126 1127
                 filterIntervals = args.filterIntervals[vapply(args.filterIntervals, object.size, double(1)) < 1000])
1127
-        )
1128
+        ),
1129
+        version = package.version("PureCN")
1128 1130
     )
1129 1131
 }
... ...
@@ -27,7 +27,8 @@ test_that("VCF is not necessary to produce output", {
27 27
         test.purity = seq(0.4, 0.7, by = 0.05), min.ploidy = 1.5,
28 28
         max.ploidy = 2.4, max.candidate.solutions = 1,
29 29
         BPPARAM = BiocParallel::bpparam())
30
-
30
+    
31
+    expect_true(!is.null(ret$version))
31 32
     tmpFile <- tempfile(fileext = ".rds")
32 33
     saveRDS(ret, tmpFile)
33 34
     createCurationFile(tmpFile)
... ...
@@ -151,6 +152,7 @@ test_that("Example data with VCF produces expected output", {
151 152
         max.candidate.solutions = 1, min.ploidy = 1.5, max.ploidy = 2.1,
152 153
         vcf.field.prefix = "PureCN."
153 154
     )
155
+    expect_true(!is.null(ret$version))
154 156
     expect_equal(ret$results[[1]]$fraction.balanced, 0.2, tolerance = 0.02)
155 157
     s <- predictSomatic(ret)
156 158
     expect_equal(s$AR / s$MAPPING.BIAS, s$AR.ADJUSTED)