CleanBEDtoBG {nearBynding} | R Documentation

## CleanBEDtoBG

### Description

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

### Usage

    CleanBEDtoBG(
        in_bed,
        out_bedGraph = NA,
        unwanted_chromosomes = NULL,
        alignment = "hg19"
    )

### Arguments

`in_bed` | Name of sorted BAM file to be converted to a bedGraph file. Required.
`out_bedGraph` | Name of bedGraph output file, including full directory path; a string. Default in_bam prefix.
`unwanted_chromosomes` | A vector of unwanted chromosomes that are present in the BAM file.
`alignment` | The human genome alignment used, either "hg19" or "hg38". Default "hg19"

### Value

deposits bedGraph from BED in same directory

### Examples

    bam <- system.file("extdata/chr4and5.bam", package="nearBynding")
    out_bed <- "bamto.bed"
    ## convert BAM to BED
    if(suppressWarnings(system2("bedtools", "--version",
    stdout = NULL, stderr = NULL)) == 0){
        system2("bedtools", paste0("bamtobed -i ", bam, " > ", out_bed))
    }
    CleanBEDtoBG(in_bed = out_bed,
        alignment = "hg38")

[Package nearBynding version 1.0.0 Index]