BamToBed: Convert bam format to bed format.

BamToBedR Documentation

Convert bam format to bed format.

Description

This function is used to convert SAM file to BED file and merge interleave paired end reads, shift reads, filter reads according to chromosome, filter reads according to fragment size, sort, remove duplicates reads before generating BED file.

Usage

atacBam2Bed(
  atacProc,
  bamInput = NULL,
  bedOutput = NULL,
  reportOutput = NULL,
  bsgenome = NULL,
  mergePairIntoFrag = c("auto", "yes", "no"),
  posOffset = +4,
  negOffset = -5,
  chrFilterList = "chrM|_",
  sortBed = TRUE,
  rmMultiMap = TRUE,
  minFragLen = 0,
  maxFragLen = 2000,
  saveExtLen = FALSE,
  uniqueBed = c("auto", "yes", "no"),
  ...
)

## S4 method for signature 'ATACProc'
atacBam2Bed(
  atacProc,
  bamInput = NULL,
  bedOutput = NULL,
  reportOutput = NULL,
  bsgenome = NULL,
  mergePairIntoFrag = c("auto", "yes", "no"),
  posOffset = +4,
  negOffset = -5,
  chrFilterList = "chrM|_",
  sortBed = TRUE,
  rmMultiMap = TRUE,
  minFragLen = 0,
  maxFragLen = 2000,
  saveExtLen = FALSE,
  uniqueBed = c("auto", "yes", "no"),
  ...
)

bam2bed(
  bamInput,
  bedOutput = NULL,
  reportOutput = NULL,
  bsgenome = NULL,
  mergePairIntoFrag = c("auto", "yes", "no"),
  posOffset = +4,
  negOffset = -5,
  chrFilterList = "chrM|_",
  sortBed = TRUE,
  rmMultiMap = TRUE,
  minFragLen = 0,
  maxFragLen = 2000,
  saveExtLen = FALSE,
  uniqueBed = c("auto", "yes", "no"),
  ...
)

Arguments

atacProc

ATACProc-class object scalar. It has to be the return value of upstream process: atacBamSort, atacSam2Bam.

bamInput

Character scalar. Bam file input path.

bedOutput

Character scalar. Bed file output path. If ignored, bed file will be put in the same path as the bam file.

reportOutput

Character scalar. Report file path.

bsgenome

BSgenome object. This object from bioconductor

mergePairIntoFrag

Logical scalar Merge paired end reads.

posOffset

Integer scalar The offset that positive strand reads will shift.

negOffset

Integer scalar The offset that negative strand reads will shift.

chrFilterList

Character vector The chromatin(or regex of chromatin) will be discard

sortBed

Logical scalar Sort bed file in the order of chromatin, start, end

rmMultiMap

Logical scalar. Remove multi-map reads.

minFragLen

Integer scalar The minimum fragment size will be retained.

maxFragLen

Integer scalar The maximum fragment size will be retained.

saveExtLen

Logical scaler. Save the fragment that are not in the range of minFragLen and maxFragLen

uniqueBed

Logical scalar Remove duplicates reads in bed if TRUE. default: FALSE

...

Additional arguments, currently unused.

Details

The bam file wiil be automatically obtained from object(atacProc) or input by hand. Output can be ignored.

Value

An invisible ATACProc-class object scalar for downstream analysis.

Author(s)

Zheng Wei, Wei Zhang

See Also

atacBamSort atacSam2Bam

Examples


library(Rsamtools)
# change dataset !!
# ex1_file <- system.file("extdata", "ex1.bam", package="Rsamtools")
# bam2bed(bamInput = ex1_file)


wzthu/ATACpipe documentation built on Aug. 12, 2022, 7:38 a.m.