colByCopyNumber: colByCopyNumber

Description Usage Arguments Details Value See Also Examples

View source: R/colByCopyNumber.R

Description

Assign a color to each data element according to the copy number status of the its genomic location

Usage

1
colByCopyNumber(data, cn.calls, cn.column="cn", cn.colors=NULL)

Arguments

data

The data elements. Can be a GRanges or anything accepted by toGRanges

cn.calls

The CN calls to use to select the color for the data elements

cn.column

The name of the column with the copy number information. (defaults to "cn")

cn.colors

The specification of the colors. Internally, it used to call the function getCopyNumberColors. Detailed documentation on color specification can be found there. (defaults to NULL)

Details

Given a set of data elements positioned on the genome (either a GRanges or any other format accepted by regioneR's toGRanges) and a set of copy number calls, assign a color to each element depending on the copy number status of the genomic region where it's located. The colors can be customized using the cn.colors parameter as documented in getCopyNumberColors.

Value

Return a vector of colors with the same length as the number of elements in data

See Also

toGRanges, getCopyNumberColors, plotBAF

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
pos <- sort(floor(runif(1000, 1, 10000)))
baf.data <- toGRanges("chr1", pos, pos)
baf.data$baf <- rnorm(1000, mean = 0.5, sd = 0.05)
baf.data$baf[1:400] <- baf.data$baf[1:400] + c(0.2, -0.2)

breakpoint <- start(baf.data)[400]
cn.calls <- toGRanges(data.frame(chr=c("chr1", "chr1"), start=c(1, breakpoint+1), end=c(breakpoint, 10000), cn=c(3,2)))

kp <- plotKaryotype(zoom=toGRanges("chr1", 1, 10000))
plotBAF(kp, baf.data, points.col = colByCopyNumber(baf.data, cn.calls))

CopyNumberPlots documentation built on Nov. 8, 2020, 6:51 p.m.