Skip to content

Commit

Permalink
add .listCumsumShifted() helper back
Browse files Browse the repository at this point in the history
  • Loading branch information
v.obenchain committed Nov 20, 2014
1 parent ce2c973 commit 584c39a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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.19.12
Version: 1.19.13
Author: P. Aboyoun, H. Pages and M. Lawrence
Maintainer: Bioconductor Package Maintainer <[email protected]>
biocViews: Genetics, Infrastructure, Sequencing, Annotation, Coverage,
Expand Down
11 changes: 8 additions & 3 deletions R/mapCoords-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
res
}

.listCumsumShifted <- function(x) {
cs <- unlist(cumsum(x), use.names=FALSE)
shifted <- c(0L, head(cs, -1))
shifted[start(PartitioningByWidth(elementLengths(x)))] <- 0L
shifted
}

.mapCoords <- function(from, to, ..., ignore.strand, elt.hits, p=FALSE) {
if (ignore.strand)
strand(to) <- "*"
Expand Down Expand Up @@ -57,9 +64,7 @@
width=width(eltPosition)[neg])
}
## location wrt start of combined list elements (e.g., transcript-level)
cs <- unlist(cumsum(width(to)), use.names=FALSE)
shifted <- c(0L, head(cs, -1))
shifted[start(PartitioningByWidth(elementLengths(to)))] <- 0L
shifted <- .listCumsumShifted(width(to))
cumPosition <- shift(eltPosition, 1L + shifted[sHits])

toInd <- togroup(to)[sHits]
Expand Down

0 comments on commit 584c39a

Please sign in to comment.