| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| fit_absolute_copy_nu..> | 2020-11-19 15:28 | 5.7K | ||
| copynumberscaling_0...> | 2020-11-19 17:54 | 2.6M | ||
| NEWS.md | 2020-11-19 10:38 | 3.8K | ||
The copynumberscaling R package includes an interactive web application written using the R Shiny framework and associated tools for scaling relative copy numbers to absolute copy number values by assessing goodness of fit to nearest whole numbers for a range of ploidies and cellularities.
See the following page on the CRUK CI Bioinformatics Core website for more information:
https://www.cruk.cam.ac.uk/core-facilities/bioinformatics-core/software/absolute-copy-number-scaling
Click on Tools -> Install Packages menu item
Select Install from: Package Archive File (.tgz, .tar.gz) and select the compressed tar file for the package, copynumberscaling_0.5.0.tar.gz, in the file chooser
Click Install
R CMD INSTALL copynumberscaling_0.5.0.tar.gz
You can test the installation worked by typing library(copynumberscaling) at an R command prompt, either in the RStudio Console tab pane or in a terminal.
library(copynumberscaling)
sessionInfo()
library(copynumberscaling)
start_shiny_app()
or with an initial sample data set loaded:
library(copynumberscaling)
start_shiny_app(load_sample_data = TRUE)
Click on the red stop icon in RStudio to stop the Shiny application.
Rscript -e 'copynumberscaling::start_shiny_app()'
or with an initial sample data set loaded:
Rscript -e 'copynumberscaling::start_shiny_app(load_sample_data = TRUE)'
Enter CTRL-C in the terminal window to stop the Shiny application.
The fit_absolute_copy_numbers.R script makes use of the same functions from the copynumberscaling R package as used in the Shiny application but can be used to find best fit ploidy and cellularity estimates for a batch of samples.
The following is an example of how this can be run on a QDNASeqCopyNumbers object saved as an R data object file (.rds).
Rscript fit_absolute_copy_numbers.R -i SLX-18106.copyNumberSegmented.rds -o SLX-18106.solutions.txt
Additional options are available including being able to set the range of ploidies to consider or to run just for a single sample within the copy number data file. For help on these:
Rscript fit_absolute_copy_numbers.R --help
The functions in this package for fitting absolute copy numbers and creating the plots within the Shiny application are available for use in custom R scripts. These are all documented with examples of how they can be used with a sample dataset also available in the package.
Navigate to the package documentation in RStudio from within the Packages tab pane for more details.
The following is an example of how you would create the distance heat map for the copy number for a sample.
library(copynumberscaling)
data(copy_number)
# select copy number values for sample of interest
copy_number <- copy_number[copy_number$sample == "X17222", ]
# copy number fitting requires relative copy numbers where values are relative
# to the average number of copies for the whole genome, i.e. the ploidy
# divide copy number values by the median segmented copy number
median_segmented_copy_number <- median(copy_number$segmented, na.rm = TRUE)
copy_number$copy_number <- copy_number$copy_number / median_segmented_copy_number
copy_number$segmented <- copy_number$segmented / median_segmented_copy_number
# collapse copy number bins into segments
segments <- copy_number_segments(copy_number)
absolute_copy_number_distance_heatmap(
segments$copy_number,
segments$weight,
distance_function = "MAD"
)