Last data update: 2014.03.03

R: Convert BAM files into BED files containing the reads...
bam_to_readsR Documentation

Convert BAM files into BED files containing the reads overlaping the specified annotations.

Description

Convert BAM files into BED files containing the reads overlaping the specified annotations.

Usage

bam_to_reads(bamfile, annotations, paired_end = TRUE, as_fragments = TRUE,
  outfile = NULL, flanking_region = 0)

Arguments

bamfile

a character vector indicating the BAM file name. Note: The bamfile must be sorted by coordinates.

annotations

an object of type annotationsSet containing information on one genes.

paired_end

logical indicating whether the bamfile contains paired-end data.

as_fragments

logical indicating if paired-end data must be paired and merged to form fragments.

outfile

a character vector indicating the output file name. If not provided, the result will be internalized in R.

flanking_region

Number of bases before and after the gene ORF should be included.

Value

An object of type data.table with 9 columns.

chromosome Read chromosome.
start Read starting position.
end Read ending position.
name Query template name .
score Mapping quality.
ChromosomeNext Gene strand.
startNext Position of the mate/next read.
tlen observed read length.
flag bitwise flag.

Examples

bamfile <- system.file("extdata", "wt_rep1.bam", package = "yCrypticRNAs")
data(annotations)
bam_to_reads(bamfile, annotations)

Results