SamToBam {esATAC} | R Documentation

## Convert sam format to bam format.

### Description

This function convert a sam file into a bam file.

### Usage

    atacSam2Bam(atacProc, samInput = NULL, bamOutput = NULL, ...)

    ## S4 method for signature 'ATACProc'
    atacSam2Bam(atacProc, samInput = NULL, bamOutput = NULL, ...)

    sam2bam(samInput, bamOutput = NULL, ...)

### Arguments

`atacProc` | `ATACProc-class` object scalar. It has to be the return value of upstream process: `atacBowtie2Mapping`.
`samInput` | `Character` scalar. Sam file input path.
`bamOutput` | `Character` scalar. Bam file output path. If ignored, bed file will be put in the same path as the sam file.
`...` | Additional arguments, currently unused.

### Details

The sam file wiil be automatically obtained from object(`atacProc`) or input by hand. bamOutput can be ignored.

### Value

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

### Author(s)

Wei Zhang

### See Also

`atacBowtie2Mapping` `atacBam2Bed` `atacBamSort`

### Examples

    library(R.utils)
    sam_bz <- system.file("extdata", "Example.sam.bz2", package="esATAC")
    sam_path <- as.vector(bunzip2(filename = sam_bz,
    destname = file.path(getwd(), "Example.sam"),
    ext="bz2", FUN=bzfile, remove = FALSE))
    sam2bam(samInput = sam_path)

[Package esATAC version 1.10.0 Index]