gAlignmentsToSppTags: Convert GAlignments object to SPP tags

Description Usage Arguments Details Value Examples

View source: R/spp.R

Description

gAlignmentsToSppTags converts a GAlignments object to spp tags, for the purpose of passing GAlignments objects to functions of the spp package.

Usage

1

Arguments

reads

GAlignments object to converted to spp tags.

Details

spp uses a custom format to represent tags (see read.bam.tags). This helper function converts GAlignments objects to this custom format. The GAlignments class is more versatile than the custom tag format of spp. If several metrics shall be calculated on the same BAM file, then it makes sense to load it only once into memory as a GAlignments object and convert it to spp tags for spp-related metrics, instead of loading the BAM file again just to have it in spp tag format. Note that the GAlignments object should contain the NM flag (number of mismatches). Otherwise, the quality attribute of spp tags cannot be populated with values. The spp function select.informative.tags simply accepts all tags, when the quality attribute is missing. Create the GAlignments object using

readGAlignments(..., param=ScanBamParam(tag="NM"))

to include the number of mismatches in the GAlignments object.

Value

spp tags which are compatible with the output of read.bam.tags

Examples

1
2
3
4
5
6
# the following three lines essentially perform the same as read.bam.tags()
# but a GAlignments object is more versatile and serves as input to many
# functions
library(GenomicAlignments)
chipSample <- readGAlignments("IP.bam", param=ScanBamParam(tag="NM"))
sppTags <- gAlignmentsToSppTags(chipSample)

imbforge/encodeChIPqc documentation built on May 18, 2019, 4:45 a.m.