Learn R Programming

rbamtools (version 2.16.17)

bamHeader-class: Class "bamHeader": Representation of data contained in the header section of BAM files.

Description

bamHeader represents data contained in the header Section of BAM-files.

Arguments

Objects from the Class

Objects can be created by calls of the form header<-new("bamHeader").

Slots

header:

Object of class "externalptr". Points to samtools bam_header_t struct.

Methods

getHeaderText

signature(x = "bamHeader"): Returns textual representation of data stored in this class as desrcribed in SAM Format Specification.

References

The SAM Format Specification (v1.4-r985). The SAM Format Specification Working Group. September 7, 2011.

Examples

Run this code
# NOT RUN {
bam<-system.file("extdata","accepted_hits.bam",package="rbamtools")
# Open bam file
reader<-bamReader(bam)
# Extract binary header structure
header<-getHeader(reader)
header
# Extract textual representation
htxt<-getHeaderText(header)
# Extract header line segment
hl<-headerLine(htxt)
# Get header program
hp<-headerProgram(htxt)
hp
# Re-create binary header structure
header2<-bamHeader(htxt)
# Use created structure for new BAM-file
# }
# NOT RUN {
writer<-bamWriter(header2,"test.bam")
bamClose(reader)
bamClose(writer)
# }

Run the code above in your browser using DataLab