This package is very fast in reading and loading.
It will be a waste if it can only be used in drawing profile plot.
The information in the profile object can be used in other analysis such as differential analysis.
For example, the read counts of the regions under consideration can be calculated by the following function
getCounts <- function(object){
fl <- object@fragLen
rf <- resize(unlist(readsF(object)),fl)
rr <- resize(unlist(readsR(object)),fl)
reads <- c(rf,rr)
regions <- object@regions
counts <- countOverlaps(regions,reads)
object@regions$counts <- counts
return(object)
}
The regions do not have to have the same width.
This is not the best way to do it, because it uses countOverlaps.
Actually the match object in the profile object already have similar information.
The only issue is that the match object store the id of the reads overlap with each region plus the extended window region.
If match object can be modified slightly, one can get counts easily.
Also, the naming and id of the lists in match object depend on the order of the the regions under consideration. It may be better if each region is given a region ID, and use the region ID to group and name everything else, e.g., to group the reads that overlap each region. In this way, it may be easier to focus on a subset of the regions under consideration.
This is only an example showing how useful segvis package could be even when profile plot is not the primary concern.