From adee2e2f5f843a3a67dc65c1d4c66a2dd6ff7b9a Mon Sep 17 00:00:00 2001 From: "m.lawrence" Date: Tue, 10 Dec 2013 21:41:41 +0000 Subject: [PATCH] add tile,GenomicRanges git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/GenomicRanges@84129 bc3139a8-67e5-0310-9ffc-ced21a209358 --- DESCRIPTION | 4 ++-- NAMESPACE | 3 ++- R/tile-methods.R | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 R/tile-methods.R diff --git a/DESCRIPTION b/DESCRIPTION index f9eba99..4ac95a6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,12 +7,12 @@ Description: The ability to efficiently represent and manipulate genomic intervals. Specialized containers for representating and manipulating short alignments against a reference genome are defined in the GenomicAlignments package. -Version: 1.15.12 +Version: 1.15.13 Author: P. Aboyoun, H. Pages and M. Lawrence Maintainer: Bioconductor Package Maintainer biocViews: Genetics, Sequencing, HighThroughputSequencing, Annotation Depends: R (>= 2.10), methods, BiocGenerics (>= 0.7.7), - IRanges (>= 1.21.13), XVector (>= 0.3.2) + IRanges (>= 1.21.14), XVector (>= 0.3.2) Imports: methods, utils, stats, BiocGenerics, IRanges LinkingTo: IRanges, XVector Suggests: AnnotationDbi (>= 1.21.1), AnnotationHub, diff --git a/NAMESPACE b/NAMESPACE index e7d4508..b73c61d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -74,7 +74,8 @@ exportMethods( findOverlaps, countOverlaps, overlapsAny, subsetByOverlaps, precede, follow, nearest, distance, distanceToNearest, map, - encodeOverlaps + encodeOverlaps, + tile ) diff --git a/R/tile-methods.R b/R/tile-methods.R new file mode 100644 index 0000000..b6c10ab --- /dev/null +++ b/R/tile-methods.R @@ -0,0 +1,14 @@ +### ========================================================================= +### "tile" methods +### ------------------------------------------------------------------------- +### + +setMethod("tile", "GenomicRanges", function(x, n, width) { + sn <- seqnames(x) + strand <- strand(x) + x <- ranges(x) + tiles <- callGeneric() + gr <- GRanges(rep(sn, elementLengths(tiles)), unlist(tiles), + rep(strand, elementLengths(tiles))) + relist(gr, tiles) +})