GenVisR (version 1.0.4)

cnFreq: Construct copy-number frequency plot

Description

Given a data frame construct a plot to display copy number changes across the genome for a group of samples.

Usage

cnFreq(x, CN_low_cutoff = 1.5, CN_high_cutoff = 2.5, plot_title = NULL, CN_Loss_colour = "#002EB8", CN_Gain_colour = "#A30000", x_title_size = 12, y_title_size = 12, facet_lab_size = 10, plotLayer = NULL, out = "plot")

Arguments

x
Object of class data frame with rows representing the proportion of CN losses/gains across the genome (default), or actual CN values. The former option must contain columns with the following names "chromosome", "start", "end", "gain", and "loss", and the latter option must contain column names "chromosome", "start", "end", "segmean", and "sample". Windows supplied must be consistent across samples!
CN_low_cutoff
Numeric value representing the point at or below which copy number alterations are considered losses. Only used if x represents CN values.
CN_high_cutoff
Numeric value representing the point at or above which copy number alterations are considered gains. Only used if x represents CN values.
plot_title
Character string specifying the title to display on the plot.
CN_Loss_colour
Character string specifying the colour value for copy number losses.
CN_Gain_colour
Character string specifying the colour value for copy number gains.
x_title_size
Integer specifying the size of the x-axis title.
y_title_size
Integer specifying the size of the y-axis title.
facet_lab_size
Integer specifying the size of the faceted labels plotted.
plotLayer
Valid ggplot2 layer to be added to the plot.
out
Character vector specifying the the object to output, one of "data", "grob", or "plot", defaults to "plot" (see returns).

Value

One of the following, a dataframe containing data to be plotted, a grob object, or a plot.

Details

cnFreq will detect the column names present in the data frame supplied to x, and will perform one of the following actions. If "gain" and "loss" columns are detected the raw data will be plotted, if "segmean" and "sample" columns are detected the frequency of copy-number gains and losses present in the cohort will be calculated and plotted. The `plotLayer` parameter can be used to add an additional layer to the ggplot2 graphic (see vignette).

Examples

Run this code
# Create data
xstart <- seq(0,4990000,length.out=500)
xloss <- rep(runif(10,0,0.6),rep(50,10))/1.5
xloss <- xloss + jitter(xloss,amount=0.002)
x <- data.frame(chromosome=rep(paste0("chr",1:5),rep(500,5)), start=xstart,
end=xstart+10000, loss=xloss, gain=(1-xloss))

# Plot the data
cnFreq(x)

Run the code above in your browser using DataLab