From 79ab292cbda1671f946899796f30488eca1d310b Mon Sep 17 00:00:00 2001 From: "hpages@fhcrc.org" Date: Thu, 17 Apr 2014 22:37:33 +0000 Subject: [PATCH] resync with stuff moving from IRanges to S4Vectors git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/GenomicRanges@89154 bc3139a8-67e5-0310-9ffc-ced21a209358 --- DESCRIPTION | 8 ++++---- NAMESPACE | 1 + R/GRanges-class.R | 2 +- R/GenomicRanges-class.R | 10 +++++----- R/intra-range-methods.R | 6 +++--- R/strand-utils.R | 8 ++++---- man/constraint.Rd | 4 ++-- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9e4a688..df204d8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,14 +7,14 @@ Description: The ability to efficiently represent and manipulate genomic intervals. Specialized containers for representing and manipulating short alignments against a reference genome are defined in the GenomicAlignments package. -Version: 1.17.5 +Version: 1.17.6 Author: P. Aboyoun, H. Pages and M. Lawrence Maintainer: Bioconductor Package Maintainer biocViews: Genetics, Infrastructure, Sequencing, Annotation -Depends: R (>= 2.10), methods, BiocGenerics (>= 0.7.7), IRanges (>= 1.23.5), - GenomeInfoDb (>= 0.99.17) +Depends: R (>= 2.10), methods, BiocGenerics (>= 0.7.7), + S4Vectors, IRanges (>= 1.99.0), GenomeInfoDb (>= 0.99.17) Imports: methods, utils, stats, BiocGenerics, IRanges, XVector -LinkingTo: IRanges, XVector (>= 0.3.4) +LinkingTo: S4Vectors, IRanges, XVector (>= 0.5.2) Suggests: AnnotationDbi (>= 1.21.1), AnnotationHub, BSgenome, BSgenome.Hsapiens.UCSC.hg19, BSgenome.Scerevisiae.UCSC.sacCer2, diff --git a/NAMESPACE b/NAMESPACE index 682133d..969e2d1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,6 +4,7 @@ import(methods) import(utils) # for as.roman() importFrom(stats, setNames) import(BiocGenerics) +import(S4Vectors) import(IRanges) import(XVector) # only for the "Views" method for integer vectors, the # XIntegerViews class, and the "viewMins", "viewMaxs", and diff --git a/R/GRanges-class.R b/R/GRanges-class.R index 6ac8c78..8f0be62 100644 --- a/R/GRanges-class.R +++ b/R/GRanges-class.R @@ -72,7 +72,7 @@ newGRanges <- ## hidden constructor shared with other GRanges-like objects if (!is.factor(runValue(strand)) || !identical(levels(runValue(strand)), levels(strand()))) runValue(strand) <- strand(runValue(strand)) - if (IRanges:::anyMissing(runValue(strand))) { + if (S4Vectors:::anyMissing(runValue(strand))) { warning("missing values in strand converted to \"*\"") runValue(strand)[is.na(runValue(strand))] <- "*" } diff --git a/R/GenomicRanges-class.R b/R/GenomicRanges-class.R index 49c8e01..2b3a598 100644 --- a/R/GenomicRanges-class.R +++ b/R/GenomicRanges-class.R @@ -131,7 +131,7 @@ setMethod("fixedColumnNames", "GenomicRanges", function(x) { { if (!is.factor(runValue(seqnames(x)))) return("'seqnames' should be a 'factor' Rle") - if (IRanges:::anyMissing(runValue(seqnames(x)))) + if (S4Vectors:::anyMissing(runValue(seqnames(x)))) return("'seqnames' contains missing values") NULL } @@ -153,7 +153,7 @@ setMethod("fixedColumnNames", "GenomicRanges", function(x) { ")") return(paste(msg, collapse="")) } - if (IRanges:::anyMissing(runValue(strand(x)))) + if (S4Vectors:::anyMissing(runValue(strand(x)))) return("'strand' contains missing values") NULL } @@ -492,7 +492,7 @@ setReplaceMethod("start", "GenomicRanges", starts <- start(ranges) starts[] <- value ## TODO: Revisit this to handle circularity (maybe). - if (!IRanges:::anyMissing(seqlengths(x))) { + if (!S4Vectors:::anyMissing(seqlengths(x))) { if (IRanges:::anyMissingOrOutside(starts, 1L)) { warning("trimmed start values to be positive") starts[starts < 1L] <- 1L @@ -513,7 +513,7 @@ setReplaceMethod("end", "GenomicRanges", ends[] <- value seqlengths <- seqlengths(x) ## TODO: Revisit this to handle circularity. - if (!IRanges:::anyMissing(seqlengths)) { + if (!S4Vectors:::anyMissing(seqlengths)) { seqlengths <- seqlengths[seqlevels(x)] maxEnds <- seqlengths[as.integer(seqnames(x))] trim <- which(ends > maxEnds) @@ -532,7 +532,7 @@ setReplaceMethod("width", "GenomicRanges", { if (!is.integer(value)) value <- as.integer(value) - if (!IRanges:::anyMissing(seqlengths(x))) { + if (!S4Vectors:::anyMissing(seqlengths(x))) { end(x) <- start(x) + (value - 1L) } else { ranges <- ranges(x) diff --git a/R/intra-range-methods.R b/R/intra-range-methods.R index 07d2b4e..b251436 100644 --- a/R/intra-range-methods.R +++ b/R/intra-range-methods.R @@ -68,7 +68,7 @@ setMethod("flank", "GenomicRanges", ranges <- flank(ranges(x), width=width, start=start, both=both, use.names=use.names) - if (!IRanges:::anyMissing(seqlengths(x))) { + if (!S4Vectors:::anyMissing(seqlengths(x))) { start(x) <- start(ranges) end(x) <- end(ranges) } else { @@ -159,7 +159,7 @@ setMethod("resize", "GenomicRanges", } ranges <- resize(ranges(x), width=width, fix=fix, use.names=use.names) - if (!IRanges:::anyMissing(seqlengths(x))) { + if (!S4Vectors:::anyMissing(seqlengths(x))) { start(x) <- start(ranges) end(x) <- end(ranges) } else { @@ -265,7 +265,7 @@ setMethod("trim", "GenomicRanges", setMethod("Ops", c("GenomicRanges", "numeric"), function(e1, e2) { - if (IRanges:::anyMissing(e2)) + if (S4Vectors:::anyMissing(e2)) stop("NA not allowed as zoom factor") e2 <- recycleNumericArg(e2, "e2", length(e1)) if (.Generic == "*") { diff --git a/R/strand-utils.R b/R/strand-utils.R index 2cde8c9..c0f6ca6 100644 --- a/R/strand-utils.R +++ b/R/strand-utils.R @@ -118,10 +118,10 @@ setMethod("compatibleStrand", c("factor", "factor"), # not exported y <- as.integer(as.character(y)) ans <- x * y != -1L - if (IRanges:::anyMissing(ans)) { + if (S4Vectors:::anyMissing(ans)) { fix <- which(is.na(ans)) ans[fix] <- (x[fix] == 0L) | (y[fix] == 0L) - if (IRanges:::anyMissing(ans)) + if (S4Vectors:::anyMissing(ans)) ans[is.na(ans)] <- FALSE } ans @@ -145,11 +145,11 @@ setMethod("compatibleStrand", c("Rle", "Rle"), # not exported runValue(y) <- as.integer(as.character(runValue(y))) ans <- x * y != -1L - if (IRanges:::anyMissing(runValue(ans))) { + if (S4Vectors:::anyMissing(runValue(ans))) { fix <- which(is.na(runValue(ans))) runValue(ans)[fix] <- (runValue(x) == 0L)[fix] | (runValue(y)[fix] == 0L) - if (IRanges:::anyMissing(runValue(ans))) + if (S4Vectors:::anyMissing(runValue(ans))) runValue(ans)[is.na(runValue(ans))] <- FALSE } ans diff --git a/man/constraint.Rd b/man/constraint.Rd index fccd14a..1cdfd5f 100644 --- a/man/constraint.Rd +++ b/man/constraint.Rd @@ -172,7 +172,7 @@ setMethod("checkConstraint", c("GenomicRanges", "HasRangeTypeCol"), rangeType <- x_mcols[[idx]] .LEVELS <- c("gene", "transcript", "exon", "cds", "5utr", "3utr") if (!is(rangeType, "Rle") || - IRanges:::anyMissing(runValue(rangeType)) || + S4Vectors:::anyMissing(runValue(rangeType)) || !identical(levels(rangeType), .LEVELS)) { msg <- c("'mcols(x)$rangeType' must be a ", @@ -270,7 +270,7 @@ setMethod("checkConstraint", c("GenomicRanges", "HasGCCol"), } GC <- x_mcols[[idx]] if (!is.numeric(GC) || - IRanges:::anyMissing(GC) || + S4Vectors:::anyMissing(GC) || any(GC < 0) || any(GC > 1)) { msg <- c("'mcols(x)$GC' must be a numeric vector ",