[med-svn] [r-bioc-variantannotation] 02/05: New upstream version 1.24.1

Andreas Tille tille at debian.org
Thu Nov 9 09:05:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-bioc-variantannotation.

commit 1e3ba2e270853bd62b4a26d6ca0a5ce1f3aa56f3
Author: Andreas Tille <tille at debian.org>
Date:   Thu Nov 9 10:00:54 2017 +0100

    New upstream version 1.24.1
---
 DESCRIPTION                      |   4 +--
 NAMESPACE                        |   2 +-
 NEWS                             |  29 ++++++++++++++++
 R/AllClasses.R                   |   4 +--
 R/methods-VCF-class.R            |  37 +++++++++++++--------
 R/methods-VCFHeader-class.R      |   6 ++--
 R/methods-VRangesList-class.R    |   3 ++
 R/methods-VcfFile.R              |   7 ++--
 R/methods-locateVariants.R       |   2 +-
 build/vignette.rds               | Bin 270 -> 271 bytes
 inst/doc/VariantAnnotation.pdf   | Bin 203450 -> 203854 bytes
 inst/doc/filterVcf.pdf           | Bin 176665 -> 176665 bytes
 inst/unitTests/test_VCF-class.R  |   2 +-
 man/VCF-class.Rd                 |  69 ++++++++++++++++++++++++---------------
 man/VRangesList-class.Rd         |  18 ++++++++++
 man/summarizeVariants-methods.Rd |   3 +-
 16 files changed, 131 insertions(+), 55 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 04cbd0a..015df7d 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -3,7 +3,7 @@ Type: Package
 Title: Annotation of Genetic Variants
 Description: Annotate variants, compute amino acid coding changes,
         predict coding outcomes.
-Version: 1.22.3
+Version: 1.24.1
 Authors at R: c(person("Valerie", "Obenchain", role=c("aut", "cre"),
         email="maintainer at bioconductor.org"),
     person("Martin", "Morgan", role="aut"),
@@ -29,7 +29,7 @@ biocViews: DataImport, Sequencing, SNP, Annotation, Genetics,
 Video:
         https://www.youtube.com/watch?v=Ro0lHQ_J--I&list=UUqaMSQd_h-2EDGsU6WDiX0Q
 NeedsCompilation: yes
-Packaged: 2017-06-23 23:00:23 UTC; biocbuild
+Packaged: 2017-11-07 23:55:06 UTC; biocbuild
 Author: Valerie Obenchain [aut, cre],
   Martin Morgan [aut],
   Michael Lawrence [aut],
diff --git a/NAMESPACE b/NAMESPACE
index 6ed189b..aa108b3 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -125,7 +125,7 @@ exportMethods(
 
     fixed, "fixed<-", ref, "ref<-", alt, "alt<-", qual, "qual<-",
     filt, "filt<-", info, "info<-", geno, "geno<-", strand, 
-    "strand<-", "[", "[<-", cbind, rbind, "mcols<-", indexVcf,
+    "strand<-", "[", "[<-", cbind, rbind, "mcols<-", indexVcf, subset,
 
     genome, seqlevels, seqinfo,
 
diff --git a/NEWS b/NEWS
index 868893e..bf0172f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,32 @@
+CHANGES IN VERSION 1.24.0
+------------------------
+
+NEW FEATURES
+
+    o Add subset,VCF-method that knows about info()
+
+    o Add alt,ref accessors for VRangesList 
+
+MODIFICATIONS
+
+    o More efficient show,VCF-method
+
+    o 'rowRanges<-' and 'mcols<-' on VCF class behave as they do
+      on RangedSummarizedExperiment
+
+    o info,VCFHeader() and geno,VCFHeader() return a DataFrame with
+      the correct columns in the case of empty
+
+BUG FIXES
+
+    o Fix "ref<-" recycling on VRanges 
+
+    o Fix bug in locateVariants(); code to fetch IntronVariants() was
+      incorrectly fetching IntergenicVariants()
+
+    o Fix bug in rbind,VCF,VCF-method
+
+
 CHANGES IN VERSION 1.22.0
 ------------------------
 
diff --git a/R/AllClasses.R b/R/AllClasses.R
index 69bf54d..ef1b44b 100644
--- a/R/AllClasses.R
+++ b/R/AllClasses.R
@@ -22,8 +22,8 @@ setClass("VCF",
 
     if (nrow(ffld) != 0) {
         if (nrow(ffld) != xlen)
-            return(paste("'fixed(object)' and 'rowRanges(object) must have the same ",
-                   "number of rows", sep=""))
+            return(paste0("'fixed(object)' and 'rowRanges(object) ",
+                          "must have the same number of rows", sep=""))
         if (!all(nms %in% c("REF", "ALT", "QUAL", "FILTER")))
             return(paste("'fixed(object)' colnames must be ",
                    "'REF', 'ALT', 'QUAL' and 'FILTER'", sep=""))
diff --git a/R/methods-VCF-class.R b/R/methods-VCF-class.R
index 46ee71b..58a703d 100644
--- a/R/methods-VCF-class.R
+++ b/R/methods-VCF-class.R
@@ -148,23 +148,21 @@ setMethod("rowRanges", "VCF",
 setReplaceMethod("rowRanges", c("VCF", "GRanges"),
     function(x, value)
 {
-    fixed_idx <- names(mcols(value)) %in% c("REF", "ALT", "QUAL", "FILTER")
-    slot(x, "fixed") <- mcols(value)[fixed_idx] 
-    slot(x, "rowRanges") <- value[,!fixed_idx]
-    validObject(x)
+    ## This method does not manage the 'fixed' fields REF, ALT, QUAL, FILTER
+    ## Use "fixed<-" instead.
+    sub <- value[,!names(mcols(value)) %in% c("REF", "ALT", "QUAL", "FILTER")]
+    slot(x, "rowRanges") <- sub 
     x
 })
 
-### Must define VCF methods for 'mcols<-' and 'dimnames<-' instead of 
-### inheriting from RangedSummarizedExperiment. 'fixed' fields are stored in 
-### a separate slot and not as metadata columns of 'rowRanges'.
-
-setReplaceMethod("mcols", c("VCF", "DataFrame"),
+setReplaceMethod("mcols", c("VCF", "ANY"),
     function(x, ..., value)
 {
-    idx <- names(value) %in% "paramRangeID"
-    fixed(x) <- value[!idx] 
-    slot(x, "rowRanges") <- value[,idx]
+    ## This method does not manage the 'fixed' fields REF, ALT, QUAL, FILTER
+    ## Use "fixed<-" instead.
+    sub <- value[,!names(value) %in% c("REF", "ALT", "QUAL", "FILTER")]
+    mcols(slot(x, "rowRanges")) <- sub 
+    validObject(x)
     x
 })
 
@@ -311,6 +309,16 @@ setMethod("[", c("VCF", "ANY", "ANY"),
     }
 })
 
+setMethod("subset", "VCF",
+          function(x, subset, select, ...)
+{
+    rowData <- rowRanges(x)
+    mcols(rowData) <- cbind(mcols(rowRanges(x)), info(x))
+    i <- S4Vectors:::evalqForSubset(subset, rowData, ...)
+    j <- S4Vectors:::evalqForSubset(select, colData(x), ...)
+    x[i, j]
+})
+
 setReplaceMethod("[",
     c("VCF", "ANY", "ANY", "VCF"),
     function(x, i, j, ..., value)
@@ -543,8 +551,9 @@ setMethod(show, "VCF",
     printSimpleList(geno, margin=margin) 
     if (length(header(object))) {
         if (length(hdr <- geno(header(object)))) {
-            nms <- intersect(names(geno(object)), rownames(hdr))
-            diff <- setdiff(names(geno(object)), rownames(hdr))
+            gnames <- names(geno(object, withDimnames = FALSE))
+            nms <- intersect(gnames, rownames(hdr))
+            diff <- setdiff(gnames, rownames(hdr))
             if (length(nms)) {
                 cat("geno(header(vcf)):\n")
                 headerrec(as.data.frame(hdr[nms,]))
diff --git a/R/methods-VCFHeader-class.R b/R/methods-VCFHeader-class.R
index ed2cdbb..0b8e6df 100644
--- a/R/methods-VCFHeader-class.R
+++ b/R/methods-VCFHeader-class.R
@@ -83,7 +83,8 @@ setMethod("info", "VCFHeader",
 {
     info <- slot(x, "header")$INFO
     if (is.null(info))
-        info <- DataFrame()
+        info <- DataFrame(Number=integer(), Type=character(),
+                          Description=character())
     info
 })
 
@@ -101,7 +102,8 @@ setMethod("geno", "VCFHeader",
 {
     geno <- slot(x, "header")$FORMAT
     if (is.null(geno))
-        geno <- DataFrame()
+        geno <- DataFrame(Number=integer(), Type=character(),
+                          Description=character())
     geno 
 })
 
diff --git a/R/methods-VRangesList-class.R b/R/methods-VRangesList-class.R
index 6bb0264..00425f1 100644
--- a/R/methods-VRangesList-class.R
+++ b/R/methods-VRangesList-class.R
@@ -13,3 +13,6 @@ setMethod("stackSamples", "VRangesList", function(x) {
     sampleNames(stacked) <- Rle(names(x), elementNROWS(x))
   stacked
 })
+
+setMethod("ref", "VRangesList", function(x) List(lapply(x, ref)))
+setMethod("alt", "VRangesList", function(x) List(lapply(x, alt)))
diff --git a/R/methods-VcfFile.R b/R/methods-VcfFile.R
index 6357dc0..75d4cbd 100644
--- a/R/methods-VcfFile.R
+++ b/R/methods-VcfFile.R
@@ -17,10 +17,11 @@ VcfFile <-
     }, error=function(err) {
         stop(sprintf("VcfFile: %s", conditionMessage(err)), call.=FALSE)
     })
-    if (missing(index))
+    if (missing(index)){
         index=paste(file, "tbi", sep=".")
-    if (!file.exists(index))
-         index = NA
+        if (!file.exists(index))
+            index = NA
+    }
     Rsamtools:::.RsamtoolsFile(.VcfFile, file, index, yieldSize=yieldSize, ...)
 }
 
diff --git a/R/methods-locateVariants.R b/R/methods-locateVariants.R
index 968b357..c74ed45 100644
--- a/R/methods-locateVariants.R
+++ b/R/methods-locateVariants.R
@@ -343,7 +343,7 @@ setMethod("locateVariants", c("GRanges", "TxDb", "AllVariants"),
                            ignore.strand=ignore.strand)
         intron <- 
             locateVariants(query, subject, IntronVariants(), cache=cache,
-                ignore.strand=ignore.strand)
+                           ignore.strand=ignore.strand)
         splice <- 
             locateVariants(query, subject, SpliceSiteVariants(), 
                            cache=cache, ignore.strand=ignore.strand)
diff --git a/build/vignette.rds b/build/vignette.rds
index c0f302e..c65bd33 100644
Binary files a/build/vignette.rds and b/build/vignette.rds differ
diff --git a/inst/doc/VariantAnnotation.pdf b/inst/doc/VariantAnnotation.pdf
index 4a8d8fb..c17ebe3 100644
Binary files a/inst/doc/VariantAnnotation.pdf and b/inst/doc/VariantAnnotation.pdf differ
diff --git a/inst/doc/filterVcf.pdf b/inst/doc/filterVcf.pdf
index c42064b..e453e35 100644
Binary files a/inst/doc/filterVcf.pdf and b/inst/doc/filterVcf.pdf differ
diff --git a/inst/unitTests/test_VCF-class.R b/inst/unitTests/test_VCF-class.R
index 8055284..02435c3 100644
--- a/inst/unitTests/test_VCF-class.R
+++ b/inst/unitTests/test_VCF-class.R
@@ -76,7 +76,7 @@ test_VCF_rowRanges_info_geno <- function() {
     vcf <- readVcf(fl, genome="hg19")
     ## rowRanges
     v1 <- vcf
-    rowRanges(v1) <- rowRanges(v1)[5:1]
+    rowRanges(v1) <- rowRanges(v1, fixed=FALSE)[5:1]
     checkIdentical(rownames(vcf), rev(rownames(v1)))
 
     ## info
diff --git a/man/VCF-class.Rd b/man/VCF-class.Rd
index 9ed1202..e12c259 100644
--- a/man/VCF-class.Rd
+++ b/man/VCF-class.Rd
@@ -46,8 +46,8 @@
 \alias{info<-}
 \alias{info<-,VCF,DataFrame-method}
 \alias{rowRanges,VCF-method}
-\alias{rowRanges<-,VCF-method}
-\alias{mcols<-,VCF,DataFrame-method}
+\alias{rowRanges<-,VCF,GRanges-method}
+\alias{mcols<-,VCF,ANY-method}
 \alias{dimnames<-,VCF,list-method}
 \alias{geno}
 \alias{geno,VCF-method}
@@ -70,6 +70,7 @@
 \alias{[,VCF-method}
 \alias{[,VCF,ANY,ANY-method}
 \alias{[,VCF,ANY,ANY,ANY-method}
+\alias{subset,VCF-method}
 \alias{[<-,VCF,ANY,ANY,VCF-method}
 
 % Combine methods
@@ -125,24 +126,24 @@
   \describe{
     \item{}{
       \code{rowRanges(x, ..., fixed = TRUE)}, \code{rowRanges(x) <- value}:
-      Gets or sets the rowRanges. The CHROM, POS, ID and REF fields are used to
-      create a \code{GRanges} object.  Ranges are created using POS as the start
-      value and width of the reference allele (REF). The IDs become the
-      rownames. If they are missing (i.e., \sQuote{.}) a string of
-      CHROM:POS_REF/ALT is used instead.  The \code{genome} argument is stored
-      in the seqinfo of the \code{GRanges} and can be accessed with
-      \code{genome(<VCF>)}.
-      
-      When \code{fixed = TRUE}, REF, ALT, QUAL and FILT metadata columns are 
-      included. 
-      
+      Gets or sets the rowRanges. The CHROM, POS, ID, POS and REF fields are
+      used to create a \code{GRanges} object. The start of the ranges are
+      defined by POS and the width is equal to the width of the reference
+      allele REF.  The IDs become the rownames. If they are missing (i.e.,
+      \sQuote{.}) a string of CHROM:POS_REF/ALT is used instead.  The
+      \code{genome} argument is stored in the seqinfo of the \code{GRanges} and
+      can be accessed with \code{genome(<VCF>)}.
+ 
+      When \code{fixed = TRUE}, REF, ALT, QUAL and FILTER metadata columns are 
+      displayed as metadata columns. To modify the \code{fixed} fields, use
+      the \code{fixed<-} setter. 
+
       One metadata column, \code{paramRangeID}, is included with the
       \code{rowRanges}. This ID is meaningful when multiple ranges are
       specified in the \code{ScanVcfParam} and distinguishes which records
       match each range.
 
-      The metadata columns can be accessed with \code{mcols(x)$<variable>} or 
-      the following accessors:
+      The metadata columns can be accessed with the following:
       \itemize{
         \item{\code{ref(x)}, \code{ref(x) <- value}:
           Gets or sets the reference allele (REF). \code{value} must 
@@ -159,17 +160,24 @@
           be an \code{numeric(1L)}.
         }
         \item{\code{filt(x)}, \code{filt(x) <- value}:
-          Returns or sets the filter data (FILT). \code{value} must 
-          be a \code{character(1L)}.
+          Returns or sets the filter data. \code{value} must 
+          be a \code{character(1L)}. Names must be one of 'REF', 'ALT',
+          'QUAL' or 'FILTER'.
         }
       }
     }
     \item{}{
+      \code{mcols(x)}, \code{mcols(x) <- value}:
+       These methods behave the same as \code{mcols(rowRanges(x))} and 
+       \code{mcols(rowRanges(x)) <- value}. This method does not manage the
+       fixed fields, 'REF', 'ALT', 'QUAL' or 'FILTER'. To modify those
+       columns use \code{fixed<-}.
+    }
+    \item{}{
       \code{fixed(x)}, \code{fixed(x) <- value}:
        Gets or sets a DataFrame of REF, ALT, QUAL and FILTER only. 
-       Note these fields are displayed as metadata columns when
-       \code{rowRanges(VCF)} is invoked. The fields can be replaced using 
-       \code{rowRanges<-} but it is more efficient to do so with \code{fixed<-}. 
+       Note these fields are displayed as metadata columns with
+       the rowRanges() data (set to fixed = FALSE to suppress).
     }
     \item{}{
       \code{info(x, ..., row.names = TRUE)}, \code{info(x) <- value}:
@@ -241,6 +249,14 @@
       replacement \code{VCF} object.
     }
     \item{}{
+      \code{subset(x, subset, select, ...)}: Restricts \code{x} by
+      evaluating the \code{subset} argument in the scope of
+      \code{rowData(x)} and \code{info(x)}, and \code{select} in the
+      context of \code{colData(x)}. The \code{subset} argument restricts
+      by rows, while the \code{select} argument restricts by column. The
+      \code{\dots} are passed to the underlying \code{subset()} calls.
+    }
+    \item{}{
       \code{cbind(...)}, \code{rbind(...)}: \code{cbind} combines objects with
       identical ranges (\code{rowRanges}) but different samples (columns in
       \code{assays}). The colnames in \code{colData} must match or an error is
@@ -406,17 +422,16 @@ vcf <- readVcf(fl, genome="hg19")
 ## the rowRanges() accessor.
 rowRanges(vcf)
 
-## Individual fields can be extracted with ref(), alt(), qual() 
-## and filt().
+## Suppress fixed fields:
+rowRanges(vcf, fixed=FALSE)
+
+## Individual fields can be extracted with ref(), alt(), qual(), filt() etc.
 qual(vcf)
 ref(vcf)
-
-## All 'info' fields can be extracted together along
-## with the GRanges of locations.
 head(info(vcf))
 
-## All genotype fields can be seen with geno(). Individual
-## fields are accessed with '$' or '[['.
+## Extract genotype fields with geno(). Access specific fields with 
+## '$' or '[['.
 geno(vcf)
 identical(geno(vcf)$GQ, geno(vcf)[[2]])
 
diff --git a/man/VRangesList-class.Rd b/man/VRangesList-class.Rd
index 5548a60..f3633ac 100644
--- a/man/VRangesList-class.Rd
+++ b/man/VRangesList-class.Rd
@@ -12,6 +12,10 @@
 % Constructors:
 \alias{VRangesList}
 
+% Accessors:
+\alias{alt,VRangesList-method}
+\alias{ref,VRangesList-method}
+
 % Aggregation:
 \alias{stackSamples}
 \alias{stackSamples,VRangesList-method}
@@ -35,6 +39,20 @@
   }
 }
 
+\section{Accessors}{
+  \describe{
+    \item{}{
+      \code{alt(x)}: Returns a CharacterList or RleList, effectively by
+      calling \code{alt(x[[i]])} on each element of \code{x}.
+    }
+    \item{}{
+      \code{ref(x)}:
+      Returns a CharacterList, effectively by calling \code{ref(x[[i]])}
+      on each element of \code{x}.
+    }
+  }
+}
+
 \section{Utilities}{
   \describe{
     \item{}{
diff --git a/man/summarizeVariants-methods.Rd b/man/summarizeVariants-methods.Rd
index b8d5b3d..2654019 100644
--- a/man/summarizeVariants-methods.Rd
+++ b/man/summarizeVariants-methods.Rd
@@ -115,9 +115,8 @@
 
 \seealso{
   \code{\link{readVcf}},
-  \code{\link{predictCoding}}
+  \code{\link{predictCoding}},
   \code{\link{locateVariants}}
-  \code{\link{summarizeVariants}},
 }
 
 \examples{

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-bioc-variantannotation.git



More information about the debian-med-commit mailing list