BedUtils {esATAC} | R Documentation

## process bed file with limit memory

### Description

This function is used to merge interleave paired end reads in bed, downsample bed reads, shift bed reads, filter bed reads according to chromosome, filter bed reads according to fragment size, sort bed, remove duplicates reads in bed.

### Usage

    atacBedUtils(
      atacProc,
      bedInput = NULL,
      bedOutput = NULL,
      mergePair = FALSE,
      downSample = NULL,
      posOffset = 0L,
      negOffset = 0L,
      chrFilterList = c("chrM"),
      select = FALSE,
      sortBed = FALSE,
      uniqueBed = FALSE,
      minFragLen = 0,
      maxFragLen = 2e+09,
      newStepType = "BedUtils",
      ...
    )

    ## S4 method for signature 'ATACProc'
    atacBedUtils(
      atacProc,
      bedInput = NULL,
      bedOutput = NULL,
      mergePair = FALSE,
      downSample = NULL,
      posOffset = 0L,
      negOffset = 0L,
      chrFilterList = c("chrM"),
      select = FALSE,
      sortBed = FALSE,
      uniqueBed = FALSE,
      minFragLen = 0,
      maxFragLen = 2e+09,
      newStepType = "BedUtils",
      ...
    )

    bedUtils(
      bedInput,
      bedOutput = NULL,
      mergePair = FALSE,
      downSample = NULL,
      reportOutput = NULL,
      posOffset = 0L,
      negOffset = 0L,
      chrFilterList = c("chrM"),
      select = FALSE,
      sortBed = FALSE,
      uniqueBed = FALSE,
      minFragLen = 0,
      maxFragLen = 2e+09,
      newStepType = "BedUtils",
      ...
    )

### Arguments

`atacProc` | `ATACProc-class` object scalar. It has to be the return value of upstream process: `atacBam2Bed` `bam2bed` `atacSamToBed` `samToBed`
`bedInput` | `Character` scalar. Bed file input path.
`bedOutput` | `Character` scalar. Bed file output path.
`mergePair` | `Logical` scalar Merge paired end interleave reads.
`downSample` | `Integer` scalar Down sample reads if the number is less than total number
`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 retain/discard if `select` is TRUE/FALSE
`select` | `Logical` scalar The chromatin in `chrFilterList` will be retain if TRUE. default: FALSE
`sortBed` | `Logical` scalar Sort bed file in the order of chromatin, start, end
`uniqueBed` | `Logical` scalar Remove duplicates reads in bed if TRUE. default: FALSE
`minFragLen` | `Integer` scalar The minimum fragment size will be retained.
`maxFragLen` | `Integer` scalar The maximum fragment size will be retained.
`newStepType` | `Character` scalar. New step type name for different default parameters.
`...` | Additional arguments, currently unused.
`reportOutput` | `Character` scalar. Report output file path.

### 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 `bedUtils` instead.

### Value

An invisible `ATACProc-class` object scalar for downstream analysis.

### Author(s)

Zheng Wei

### See Also

`atacBam2Bed` `bam2bed` `atacSamToBed` `samToBed` `atacFragLenDistr` `atacExtractCutSite` `atacPeakCalling` `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)
    atacproc<-samToBed(samInput = samfile) %>%
    atacBedUtils(maxFragLen = 100, chrFilterList = NULL)

[Package esATAC version 1.9.3 Index]