findPeaksByStrand: Perform peak calling on a BAM file with single strand

View source: R/scAPAtrap_funlib.R

findPeaksByStrandR Documentation

Perform peak calling on a BAM file with single strand

Description

findPeaksByStrand calls peaks on a BAM file with single strand. This function combines two functions in previous scAPAtrap, loadBpCoverages and findPeaks.

Usage

findPeaksByStrand(
  bamFile,
  chrs = NULL,
  strand,
  L,
  maxwidth,
  cutoff = 10,
  ofile = NULL,
  ...
)

Arguments

bamFile

a BAM file with index (.bai)

chrs

Chromosome information. If not provided, then will try get chrs from the bamFile.

strand

strand.

L

Read length, used to filter peaks wider than L.

maxwidth

Maximum peak width, used to filter peaks narrower than maxwidth. Wider peaks will be splitted to smaller ones.

cutoff

The base level coverage cutoff to filter valid peaks with enough coverages, default is 10.

ofile

output file with each line is one peak

...

Arguments passed to other methods and/or advanced arguments. Advanced arguments:

verbose

If 'TRUE' basic status updates will be printed along the way.

logf

If not NULL, then it should be a character string denoting a file name. Then message will be written to 'logf'.

Value

If ofile=NULL, return a data frame with many columns but four fixed columns chr/strand/start/end/value, with each row being a peak. Otherwise, output to file and return ofile name.

Examples

## Not run: 
forwardPeaks <-findPeaksByStrand(bamFile, chrs=NULL, strand='+', L=98, maxwidth=1000, cutoff=10)
reversePeaks <-findPeaksByStrand(bamFile, chrs=NULL, strand='-', L=98, maxwidth=1000, cutoff=10)

## End(Not run)

BMILAB/scAPAtrap documentation built on Oct. 13, 2023, 2:36 a.m.