CleanBAMtoBG {nearBynding} | R Documentation

## CleanBAMtoBG

### Description

Writes a script to convert a BAM file to a clean bedGraph file.

### Usage

    CleanBAMtoBG(in_bam, out_bedGraph = NA, unwanted_chromosomes = NULL)

### Arguments

`in_bam` | Name of sorted BAM file to be converted to a bedGraph file. Required.
`out_bedGraph` | Name of bedGraph output file, including full directory path. Default in_bam prefix.
`unwanted_chromosomes` | A vector of unwanted chromosomes that are present in the BAM file.

### Value

deposits bedGraph from BAM in same directory

### Examples

    bam <- system.file("extdata/chr4and5.bam", package="nearBynding")
    #sort BAM first
    sorted_bam<-Rsamtools::sortBam(bam, "chr4and5_sorted")
    CleanBAMtoBG(in_bam = sorted_bam)

        ## If BAM has unwanted chromosome "EBV"
        ## this file is from ENCODE database
        CleanBAMtoBG(in_bam = "ENCFF288LEG.bam",
                     unwanted_chromosomes = "EBV")

[Package nearBynding version 1.2.0 Index]