SamToBed: Convert SAM file to BED file

SamToBedR Documentation

Convert SAM file to BED file

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

atacSamToBed(
  atacProc,
  reportOutput = NULL,
  merge = c("auto", "yes", "no"),
  posOffset = +4,
  negOffset = -5,
  chrFilterList = "chrM",
  samInput = NULL,
  bedOutput = NULL,
  sortBed = TRUE,
  minFragLen = 0,
  maxFragLen = 100,
  saveExtLen = FALSE,
  uniqueBed = TRUE,
  ...
)

## S4 method for signature 'ATACProc'
atacSamToBed(
  atacProc,
  reportOutput = NULL,
  merge = c("auto", "yes", "no"),
  posOffset = +4,
  negOffset = -5,
  chrFilterList = "chrM",
  samInput = NULL,
  bedOutput = NULL,
  sortBed = TRUE,
  minFragLen = 0,
  maxFragLen = 100,
  saveExtLen = FALSE,
  uniqueBed = TRUE,
  ...
)

samToBed(
  samInput,
  reportOutput = NULL,
  merge = c("auto", "yes", "no"),
  posOffset = +4,
  negOffset = -5,
  chrFilterList = "chrM",
  bedOutput = NULL,
  sortBed = TRUE,
  minFragLen = 0,
  maxFragLen = 100,
  saveExtLen = FALSE,
  uniqueBed = TRUE,
  ...
)

Arguments

atacProc

ATACProc-class object scalar. It has to be the return value of upstream process: atacBowtie2Mapping bowtie2Mapping

reportOutput

Character scalar report file path

merge

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

samInput

Character scalar. SAM file input path.

bedOutput

Character scalar. Bed file output path.

sortBed

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

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 parameter related to input and output file path will be automatically obtained from ATACProc-class object(atacProc) or generated based on known parameters if their values are default(e.g. NULL). Otherwise, the generated values will be overwrited. If you want to use this function independently, you can use samToBed instead.

Value

An invisible ATACProc-class object scalar for downstream analysis.

Author(s)

Zheng Wei

See Also

atacBowtie2Mapping bowtie2Mapping atacFragLenDistr atacExtractCutSite atacPeakCalling atacBedUtils atacTSSQC atacBedToBigWig

Examples

library(R.utils)
library(magrittr)
td <- tempdir()
setTmpDir(td)

sambzfile <- system.file(package="esATAC", "extdata", "Example.sam.bz2")
samfile <- file.path(td,"Example.sam")
bunzip2(sambzfile,destname=samfile,overwrite=TRUE,remove=FALSE)
samToBed(samInput = samfile)

wzthu/esATAC documentation built on Aug. 12, 2022, 7:41 a.m.