Learn R Programming

rbamtools (version 2.16.17)

bamSave: bamSave: Creation of a sorted copy of a BAM file.

Description

The methods for bamSave write BAM alignment data (either single alignments as bamAlign objects or lists of alignments as bamRange objects) out to a bamWriter.

Usage

bamSave(object, value, refid, ...)

Arguments

object

bamWriter. The writer must be opened.

value

Object of type bamAlign or bamRange.

refid

(Optional) Defines sequence association (ID) in Reference sequence dictionary of output BAM file. May be given as numeric, or character. When missing, ID is determined from reference name (only for bamRange).

...

Currently unused.

Details

The different methods specialize on different methods for determining the Reference sequence ID in the output file.

Examples

Run this code
# NOT RUN {
bam<-system.file("extdata","accepted_hits.bam",package="rbamtools")
reader<-bamReader(bam, idx=TRUE)
rg <- bamRange(reader, getRefCoords(reader,"chr1"))
# }
# NOT RUN {
writer <- bamWriter(bamReader, "out.BAM")
bamSave(writer, rg)
bamClose(writer)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab