featureAlignedExtendSignal: extract signals in given ranges from bam files

Description Usage Arguments Value Author(s) See Also Examples

View source: R/featureAlignedExtendSignal.R

Description

extract signals in the given feature ranges from bam files (DNAseq only). The reads will be extended to estimated fragement length.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
featureAlignedExtendSignal(
  bamfiles,
  index = bamfiles,
  feature.gr,
  upstream,
  downstream,
  n.tile = 100,
  fragmentLength,
  librarySize,
  pe = c("auto", "PE", "SE"),
  adjustFragmentLength,
  gal,
  ...
)

Arguments

bamfiles

The file names of the 'BAM' ('SAM' for asBam) files to be processed.

index

The names of the index file of the 'BAM' file being processed; this is given without the '.bai' extension.

feature.gr

An object of GRanges with identical width.

upstream, downstream

upstream or dwonstream from the feature.gr.

n.tile

The number of tiles to generate for each element of feature.gr, default is 100

fragmentLength

Estimated fragment length.

librarySize

Estimated library size.

pe

Pair-end or not. Default auto.

adjustFragmentLength

A numberic vector with length 1. Adjust the fragments/reads length to.

gal

A GAlignmentsList object or a list of GAlignmentPairs. If bamfiles is missing, gal is required.

...

Not used.

Value

A list of matrix. In each matrix, each row record the signals for corresponding feature.

Author(s)

Jianhong Ou

See Also

See Also as featureAlignedSignal, estLibSize, estFragmentLength

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 if(interactive() || Sys.getenv("USER")=="jianhongou"){
    path <- system.file("extdata", package="MMDiffBamSubset")
    if(file.exists(path)){
        WT.AB2 <- file.path(path, "reads", "WT_2.bam")
        Null.AB2 <- file.path(path, "reads", "Null_2.bam")
        Resc.AB2 <- file.path(path, "reads", "Resc_2.bam")
        peaks <- file.path(path, "peaks", "WT_2_Macs_peaks.xls")
        estLibSize(c(WT.AB2, Null.AB2, Resc.AB2))
        feature.gr <- toGRanges(peaks, format="MACS")
        feature.gr <- feature.gr[seqnames(feature.gr)=="chr1" & 
                             start(feature.gr)>3000000 & 
                             end(feature.gr)<75000000]
        sig <- featureAlignedExtendSignal(c(WT.AB2, Null.AB2, Resc.AB2), 
                               feature.gr=reCenterPeaks(feature.gr, width=1), 
                               upstream = 505,
                               downstream = 505,
                               n.tile=101, 
                               fragmentLength=250,
                               librarySize=1e9)
        featureAlignedHeatmap(sig, reCenterPeaks(feature.gr, width=1010), 
                          zeroAt=.5, n.tile=101)
    }
 }

ChIPpeakAnno documentation built on April 1, 2021, 6:01 p.m.