Learn R Programming

qrqc (version 1.26.0)

getGC-methods: Get a Data Frame of GC Content from a SequenceSummary object

Description

An object that inherits from class SequenceSummary contains base frequency data by position gathered by readSeqFile. getGC is an accessor function that reshapes the base frequency data into a data frame and returns the GC content by position.

This accessor function is useful if you want to map variables to custom ggplot2 aesthetics. Frequencies or proportions of all bases (not just GC) can be accessed with getBase and getBaseProp respectively.

Usage

getGC(x)

Arguments

x
an S4 object that inherits from SequenceSummary from readSeqFile.

Value

getGC returns a data.frame with columns:
position
the position in the read.
gc
GC content per position in the read.

Methods

signature(x = "SequenceSummary")
getGC is an accessor function that works on any object read in with readSeqFile; that is, objects that inherit from SequenceSummary.

See Also

getSeqlen, getBase, getBaseProp, getQual, getMCQual, getKmer, gcPlot

Examples

Run this code
  ## Load a FASTQ file, with sequence hashing.
  s.fastq <- readSeqFile(system.file('extdata', 'test.fastq',
    package='qrqc'))

  # A custom GC plot
  d <- merge(getQual(s.fastq), getGC(s.fastq), by.x="position", by.y="position")
  p <- ggplot(d) + geom_linerange(aes(x=position, ymin=lower,
    ymax=upper, color=gc)) + scale_color_gradient(low="red",
    high="blue") + scale_y_continuous("GC content")
  p

Run the code above in your browser using DataLab