slice1 {TransView} | R Documentation |
slice1 returns read densities of a genomic interval. sliceN takes a GRanges object or a data.frame with genomic coordinates and returns a list of read densities.
## S4 method for signature 'DensityContainer,character,numeric,numeric' slice1(dc, chrom, start, end, control=FALSE, input_method="-",treads_norm=TRUE, nbins=0, bin_method="mean") ## S4 method for signature 'DensityContainer' sliceN(dc, ranges, toRle=FALSE, control=FALSE, input_method="-",treads_norm=TRUE, nbins=0, bin_method="mean")
dc |
Source DensityContainer object |
chrom |
A case sensitive string of the chromosome |
start,end |
Genomic start and end of the slice |
ranges |
A GRanges object or a data.frame. |
toRle |
The return values will be converted to a |
control |
An optional DensityContainer which will used as control and by default subtracted from |
input_method |
Defines the handling of the optional control DensityContainer. ‘-’ will subtract the control from the actual data and ‘/’ will return log2 fold change ratios with an added pseudo count of 1 read. |
treads_norm |
If |
nbins |
If all input regions have equal length and nbins greater than 0, all densities will be summarized using the method specified by bin_method into nbins windows of approximately equal size. |
bin_method |
Character string that specifies the function used to summarize or expand the bins specified by nbins. Valid methods are ‘max’, ‘mean’ or ‘median’. |
slice1 is a fast method to slice a vector of read densities from a DensityContainer object. The vector can be optionally background subtracted. If the query region exceeds chromosome boundaries or if an non matching chromosome name will be passed, a warning will be issued and a NULL vector will be returned.
sliceN
returns a list with N regions corresponding to N rows in the GRanges object or the data.frame. A list with the
corresponding read densities will be returned and row names will be conserved. Optionally
the return values can be converted to a RleList
for seamless integration into the
IRanges package.
slice1 returns a numeric vector of read densities
sliceN returns a list of read densities and optionally an RleList
Julius Muller ju-mu@alumni.ethz.ch
exbam<-dir(system.file("extdata", package="TransView"),full=TRUE,patt="bam$") exls<-dir(system.file("extdata", package="TransView"),full=TRUE,patt="xls$") #store density maps of the whole sam/bam file in test_data exden.ctrl<-parseReads(exbam[1],verbose=0) exden.chip<-parseReads(exbam[2],verbose=0) peaks<-macs2gr(exls,psize=500) #returns vector of read counts per base pair slice1(exden.chip,"chr2",30663080,30663580)[300:310] slice1(exden.ctrl,"chr2",30663080,30663580)[300:310] slice1(exden.chip,"chr2",30663080,30663580,control=exden.ctrl,treads_norm=FALSE)[300:310] xout<-sliceN(exden.chip,ranges=peaks) lapply(xout,function(x)sum(x)/length(x)) xout<-sliceN(exden.ctrl,ranges=peaks) lapply(xout,function(x)sum(x)/length(x)) xout<-sliceN(exden.chip,ranges=peaks,control=exden.ctrl,treads_norm=FALSE) lapply(xout,function(x)sum(x)/length(x))