bamtobed: From BAM files to BED files.

bamtobedR Documentation

From BAM files to BED files.

Description

This function reads one or multiple BAM files converting them into BED files that contain, for each read: i) the name of the corresponding reference sequence (i.e. of the transcript on which it aligns); ii) its leftmost and rightmost position with respect to the 1st nucleotide of the reference sequence; iii) its length (intended as the width of the reference sequence region covered by the RNA fragment. For further information about this choice please refer to section Details of function bamtolist); iv) the strand on which it aligns. Please note: this function relies on the bamtobed utility of the BEDTools suite and can be only run on UNIX, LINUX and Apple OS X operating systems. Moreover, to generate R data structures containing reads information, the function bedtolist must be run on the resulting BED files. For these reasons the authors suggest the use of bamtolist.

Usage

bamtobed(bamfolder, bedfolder = NULL)

Arguments

bamfolder

Character string specifying the path to the folder storing BAM files. Please note: the function looks for BAM files recursively starting from the specified folder.

bedfolder

Character string specifying the path to the directory where BED files shuold be stored. If the specified folder doesn't exist, it is automatically created. If NULL (the default), BED files are stored in a new subfolder of the working directory, called bed.

Examples

## path_bam <- "path/to/BAM/files"
## path_bed <- "path/to/output/directory"
## bamtobed(bamfolder = path_bam, bedfolder = path_bed)

LabTranslationalArchitectomics/riboWaltz documentation built on Jan. 17, 2024, 12:18 p.m.