Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 1.89 KB

README.md

File metadata and controls

61 lines (44 loc) · 1.89 KB

PlotCNV

An R package to create a pretty Copy Number Variant plot from a segments file

Disclaimer

This is early development so let me know if anyone finds this, likes it, or wants changes let me know!

Installation

PlotCNV was written on R 3.6.1 and I've no idea if it works on older versions.

Dependancies

It'll load/install ggplot2 and magrittr

Get the package

As we're on github you'll need "install_github" from devtools.

## If you don't already have devtools installed
BiocManager::install("devtools")
library(devtools)
install_github("findlaycopley/PlotCNV")

This will give you access to the wonderful world of PlotCNV ver 0.1.

Examples

You can generate a series of segments for hg19 like this:

CNV <- generateTestData()

This will generate a dataframe to use in the package. This can be used as a guide to formatting your own data for use in this package.

chr sampleID start.pos end.pos calls
chr7 Sample1 100998668 110396599 Loss
chr16 Sample2 43859840 80317946 Gain
chr12 Sample3 32271933 99088557 CN-LOH
chr16 Sample4 58412150 88854473 CN-LOH

You can then run the following steps to get the plot

## Makes sure all the columns are labelled in a way that the package understands
CNV <- prepareCNV(CNV, chr="chr", sampleID="sampleID", start.pos="start.pos", end.pos="end.pos", calls="calls")
## Orders the samples so they will plot in descending order of % variant bp
CNV <- orderCNV(CNV)
## Sets up the data values for the plot
CNV <- setPositionsCNV(CNV, genome="hg19")
## Prints out the plot
CNV <- plotCopynumber(CNV)
## You can access the plot object in the Plots slot like this:
CNV@Plot$plot

Here is the plot generated by the example data (I set the seed for the test data generator so yours should look identical.

example of plot