diff --git a/docs/404.html b/docs/404.html index fa4e10d..9e59b98 100644 --- a/docs/404.html +++ b/docs/404.html @@ -72,6 +72,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • diff --git a/docs/LICENSE.html b/docs/LICENSE.html index f0f7cfd..c21877a 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/articles/allele-specific.html b/docs/articles/allele-specific.html index d2f4c8c..6947249 100644 --- a/docs/articles/allele-specific.html +++ b/docs/articles/allele-specific.html @@ -50,28 +50,31 @@
  • diff --git a/docs/articles/copy_number_alt.html b/docs/articles/copy_number_alt.html index 7facdd2..53df6d8 100644 --- a/docs/articles/copy_number_alt.html +++ b/docs/articles/copy_number_alt.html @@ -50,28 +50,31 @@ diff --git a/docs/articles/deconvolution.html b/docs/articles/deconvolution.html new file mode 100644 index 0000000..22059e2 --- /dev/null +++ b/docs/articles/deconvolution.html @@ -0,0 +1,201 @@ + + + + + + + +CAMDAC Deconvolution Only • CAMDAC + + + + + + + + + + + + +
    +
    + + + + +
    +
    + + + + +
    +

    Deconvolution only +

    +

    The CAMDAC equation can be used to infer pure tumour DNA methylation rates, provided the following information is available per CpG:

    +
      +
    • Bulk tumour methylation rates
    • +
    • Tumour copy number state
    • +
    • Tumour purity
    • +
    +

    Here is an example for 5 CpGs from a single sample. Note: the normal copy number state is assumed diploid (2) in humans:

    +
    +
    +# Set parameters
    +bulk = c(0.3, 0.5, 0.2, 0.1, 0.9)
    +normal = c(0.3, 0.9, 0.1, 0.7, 0.5)
    +ploidy = c(2, 2, 1, 3, 4)
    +purity = 0.8
    +
    +# Deconvolve methylation rates
    +pure_meth = CAMDAC:::calculate_mt(bulk, normal, purity, ploidy)
    +
    +# Set clean rates based on threshold
    +pure_meth_clean = dplyr::case_when(
    +  pure_meth < 0 ~ 0,
    +  pure_meth > 1 ~ 1,
    +  TRUE ~ pure_meth
    +)
    +

    After deconvolution, it may be useful to estimate the CpG coverage in the deconvolved tumour sample. Additionally, the highest density interval (HDI) of the methylation rate may be informative for quality control. These metrics can be calculated given additional information on bulk methylated and unmethylated read counts:

    +
    +
    +# Optional: calculate effective coverage of the tumour
    +# # Requires coverage per CpG in the bulk sample
    +bulk_coverage = c(10, 20, 5, 15, 30)
    +pure_effective_coverage = CAMDAC:::calculate_mt_cov(bulk_coverage, purity, ploidy)
    +
    +# Optional: calculate the HDI of the pure tumour methylation rate
    +bulk_methylated_count = c(3, 10, 1, 2, 27)
    +bulk_unmethylated_count = c(7, 10, 4, 13, 3)
    +normal_methylated_count = c(3, 9, 1, 5, 2)
    +normal_unmethylated_count = c(7, 11, 3, 8, 3)
    +
    +# HDI function (fast)
    +CAMDAC:::hdi_norm_approx(
    +  bulk_methylated_count,
    +  bulk_unmethylated_count,
    +  normal_methylated_count,
    +  normal_unmethylated_count,
    +  purity,
    +  ploidy
    +)
    +
    +# HDI function (most accurate)
    +CAMDAC:::vec_HDIofMCMC_mt( 
    +  bulk_methylated_count,
    +  bulk_unmethylated_count,
    +  normal_methylated_count,
    +  normal_unmethylated_count,
    +  purity,
    +  ploidy,
    +  credMass=0.99
    +)
    +
    +
    + + + +
    + + + + +
    + + + + + + + + diff --git a/docs/articles/index.html b/docs/articles/index.html index 880a047..f80c80f 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog @@ -101,6 +104,8 @@

    Extra

    Allele-specific Methylation
    +
    CAMDAC Deconvolution Only
    +
    diff --git a/docs/articles/output.html b/docs/articles/output.html index 76f017b..e0add1a 100644 --- a/docs/articles/output.html +++ b/docs/articles/output.html @@ -50,28 +50,31 @@
  • diff --git a/docs/articles/panels.html b/docs/articles/panels.html index 856360e..f55b7f1 100644 --- a/docs/articles/panels.html +++ b/docs/articles/panels.html @@ -50,28 +50,31 @@ diff --git a/docs/articles/pipeline.html b/docs/articles/pipeline.html index bb6d015..6222125 100644 --- a/docs/articles/pipeline.html +++ b/docs/articles/pipeline.html @@ -50,28 +50,31 @@ diff --git a/docs/articles/questions.html b/docs/articles/questions.html index 5015bd1..a814743 100644 --- a/docs/articles/questions.html +++ b/docs/articles/questions.html @@ -50,28 +50,31 @@ diff --git a/docs/articles/setup.html b/docs/articles/setup.html index e28ffd0..0b52c62 100644 --- a/docs/articles/setup.html +++ b/docs/articles/setup.html @@ -50,28 +50,31 @@ diff --git a/docs/articles/visualisation.html b/docs/articles/visualisation.html index 120df16..51989cd 100644 --- a/docs/articles/visualisation.html +++ b/docs/articles/visualisation.html @@ -50,28 +50,31 @@ diff --git a/docs/authors.html b/docs/authors.html index 10e1030..d79b2c8 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/index.html b/docs/index.html index 7d05496..1e40543 100644 --- a/docs/index.html +++ b/docs/index.html @@ -73,6 +73,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • diff --git a/docs/news/index.html b/docs/news/index.html index acc56ba..2c63c78 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -32,28 +32,31 @@
  • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index b971501..1cb5979 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -4,12 +4,12 @@ pkgdown_sha: 956f076f661eb2de9413f64ea24a580cf444466d articles: allele-specific: allele-specific.html copy_number_alt: copy_number_alt.html - deconvolution-only: deconvolution-only.html + deconvolution: deconvolution.html output: output.html panels: panels.html pipeline: pipeline.html questions: questions.html setup: setup.html visualisation: visualisation.html -last_built: 2024-07-23T15:17Z +last_built: 2024-07-23T15:27Z diff --git a/docs/reference/CamConfig.html b/docs/reference/CamConfig.html index b41ed9c..6ab676e 100644 --- a/docs/reference/CamConfig.html +++ b/docs/reference/CamConfig.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/CamSample.html b/docs/reference/CamSample.html index 39dc2d8..4bbdd22 100644 --- a/docs/reference/CamSample.html +++ b/docs/reference/CamSample.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/HDIofICDF.html b/docs/reference/HDIofICDF.html index 75146b6..5621729 100644 --- a/docs/reference/HDIofICDF.html +++ b/docs/reference/HDIofICDF.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/HDIofMCMC_mt.html b/docs/reference/HDIofMCMC_mt.html index e496b98..4ce2e7c 100644 --- a/docs/reference/HDIofMCMC_mt.html +++ b/docs/reference/HDIofMCMC_mt.html @@ -56,6 +56,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/ascat.plotRawData.flags.html b/docs/reference/ascat.plotRawData.flags.html index 06f19e1..0b6965b 100644 --- a/docs/reference/ascat.plotRawData.flags.html +++ b/docs/reference/ascat.plotRawData.flags.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/asm_pipeline.html b/docs/reference/asm_pipeline.html index bdc3d8d..d551bff 100644 --- a/docs/reference/asm_pipeline.html +++ b/docs/reference/asm_pipeline.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/attach_output.html b/docs/reference/attach_output.html index 06d74c1..1662395 100644 --- a/docs/reference/attach_output.html +++ b/docs/reference/attach_output.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/calculate_m_t_hdi.html b/docs/reference/calculate_m_t_hdi.html index 078d6bb..7b537f8 100644 --- a/docs/reference/calculate_m_t_hdi.html +++ b/docs/reference/calculate_m_t_hdi.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/call_dmps.html b/docs/reference/call_dmps.html index 2989e6a..ac54a40 100644 --- a/docs/reference/call_dmps.html +++ b/docs/reference/call_dmps.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/call_dmr_routine.html b/docs/reference/call_dmr_routine.html index a0f77de..c14645a 100644 --- a/docs/reference/call_dmr_routine.html +++ b/docs/reference/call_dmr_routine.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/camdac_to_battenberg_prepare_wgbs.html b/docs/reference/camdac_to_battenberg_prepare_wgbs.html index 7d812e6..136710a 100644 --- a/docs/reference/camdac_to_battenberg_prepare_wgbs.html +++ b/docs/reference/camdac_to_battenberg_prepare_wgbs.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_bind_snps.html b/docs/reference/cmain_bind_snps.html index 989ad9d..758aa00 100644 --- a/docs/reference/cmain_bind_snps.html +++ b/docs/reference/cmain_bind_snps.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_call_cna.html b/docs/reference/cmain_call_cna.html index 22a2912..ac9d2ee 100644 --- a/docs/reference/cmain_call_cna.html +++ b/docs/reference/cmain_call_cna.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_call_dmps.html b/docs/reference/cmain_call_dmps.html index 148d929..e7e5498 100644 --- a/docs/reference/cmain_call_dmps.html +++ b/docs/reference/cmain_call_dmps.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_call_dmrs.html b/docs/reference/cmain_call_dmrs.html index 687f421..162cf6c 100644 --- a/docs/reference/cmain_call_dmrs.html +++ b/docs/reference/cmain_call_dmrs.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_count_alleles.html b/docs/reference/cmain_count_alleles.html index 31d1465..b17170d 100644 --- a/docs/reference/cmain_count_alleles.html +++ b/docs/reference/cmain_count_alleles.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_deconvolve_methylation.html b/docs/reference/cmain_deconvolve_methylation.html index 23cb3ec..68ef08f 100644 --- a/docs/reference/cmain_deconvolve_methylation.html +++ b/docs/reference/cmain_deconvolve_methylation.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_make_methylation_profile.html b/docs/reference/cmain_make_methylation_profile.html index 5b13afa..d36a706 100644 --- a/docs/reference/cmain_make_methylation_profile.html +++ b/docs/reference/cmain_make_methylation_profile.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_make_snps.html b/docs/reference/cmain_make_snps.html index bab4d52..de5aa7b 100644 --- a/docs/reference/cmain_make_snps.html +++ b/docs/reference/cmain_make_snps.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_run_ascat.html b/docs/reference/cmain_run_ascat.html index 0f6bab4..fdae470 100644 --- a/docs/reference/cmain_run_ascat.html +++ b/docs/reference/cmain_run_ascat.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cmain_run_battenberg.html b/docs/reference/cmain_run_battenberg.html index 8df4748..153f53b 100644 --- a/docs/reference/cmain_run_battenberg.html +++ b/docs/reference/cmain_run_battenberg.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/collapse_cpg_to_dmr.html b/docs/reference/collapse_cpg_to_dmr.html index 5898889..a04273f 100644 --- a/docs/reference/collapse_cpg_to_dmr.html +++ b/docs/reference/collapse_cpg_to_dmr.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/cwrap_asm_get_allele_counts.html b/docs/reference/cwrap_asm_get_allele_counts.html index 281d1b6..ffc4a22 100644 --- a/docs/reference/cwrap_asm_get_allele_counts.html +++ b/docs/reference/cwrap_asm_get_allele_counts.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/download_pipeline_files.html b/docs/reference/download_pipeline_files.html index 3ab623e..0ad5fdf 100644 --- a/docs/reference/download_pipeline_files.html +++ b/docs/reference/download_pipeline_files.html @@ -57,6 +57,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/get_cluster_counts.html b/docs/reference/get_cluster_counts.html index aadf078..ff9497a 100644 --- a/docs/reference/get_cluster_counts.html +++ b/docs/reference/get_cluster_counts.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/get_reference_files.html b/docs/reference/get_reference_files.html index c6d7c63..44274f9 100644 --- a/docs/reference/get_reference_files.html +++ b/docs/reference/get_reference_files.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/helper_camdac_pileup.html b/docs/reference/helper_camdac_pileup.html index bbba3b9..ca6d558 100644 --- a/docs/reference/helper_camdac_pileup.html +++ b/docs/reference/helper_camdac_pileup.html @@ -64,6 +64,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/index.html b/docs/reference/index.html index 4b92682..ec2c60f 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/load_cna_data.html b/docs/reference/load_cna_data.html index 09df160..0a770fc 100644 --- a/docs/reference/load_cna_data.html +++ b/docs/reference/load_cna_data.html @@ -61,6 +61,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/load_panel_ac_files.html b/docs/reference/load_panel_ac_files.html index 730badf..a45a78b 100644 --- a/docs/reference/load_panel_ac_files.html +++ b/docs/reference/load_panel_ac_files.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/panel_asm_from_counts.html b/docs/reference/panel_asm_from_counts.html index ab020ba..0c24d23 100644 --- a/docs/reference/panel_asm_from_counts.html +++ b/docs/reference/panel_asm_from_counts.html @@ -61,6 +61,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/panel_meth_from_beta.html b/docs/reference/panel_meth_from_beta.html index 64fa6a3..293b93b 100644 --- a/docs/reference/panel_meth_from_beta.html +++ b/docs/reference/panel_meth_from_beta.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/panel_meth_from_counts.html b/docs/reference/panel_meth_from_counts.html index 93140e7..459b8d4 100644 --- a/docs/reference/panel_meth_from_counts.html +++ b/docs/reference/panel_meth_from_counts.html @@ -58,6 +58,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/pipeline.html b/docs/reference/pipeline.html index f0f5cb9..a7fcf77 100644 --- a/docs/reference/pipeline.html +++ b/docs/reference/pipeline.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/preprocess.html b/docs/reference/preprocess.html index bbc2e4d..97a9f10 100644 --- a/docs/reference/preprocess.html +++ b/docs/reference/preprocess.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/preprocess_asm.html b/docs/reference/preprocess_asm.html index a1b46ad..0456f07 100644 --- a/docs/reference/preprocess_asm.html +++ b/docs/reference/preprocess_asm.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/reference/split_segments_gr.html b/docs/reference/split_segments_gr.html index 79569ff..55b81b3 100644 --- a/docs/reference/split_segments_gr.html +++ b/docs/reference/split_segments_gr.html @@ -55,6 +55,9 @@
  • Allele-specific Methylation
  • +
  • + CAMDAC Deconvolution Only +
  • Changelog diff --git a/docs/sitemap.xml b/docs/sitemap.xml index a261989..80312e0 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -15,6 +15,9 @@ /articles/copy_number_alt.html + + /articles/deconvolution.html + /articles/index.html diff --git a/vignettes/deconvolution.Rmd b/vignettes/deconvolution.Rmd new file mode 100644 index 0000000..9b3893a --- /dev/null +++ b/vignettes/deconvolution.Rmd @@ -0,0 +1,82 @@ +--- +title: "CAMDAC Deconvolution Only" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{deconvolution} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + eval = FALSE +) +``` + +## Deconvolution only + +The CAMDAC equation can be used to infer pure tumour DNA methylation rates, provided the following information is available per CpG: + +* Bulk tumour methylation rates +* Tumour copy number state +* Tumour purity + +Here is an example for 5 CpGs from a single sample. Note: the normal copy number state is assumed diploid (2) in humans: +```{r} + +# Set parameters +bulk = c(0.3, 0.5, 0.2, 0.1, 0.9) +normal = c(0.3, 0.9, 0.1, 0.7, 0.5) +ploidy = c(2, 2, 1, 3, 4) +purity = 0.8 + +# Deconvolve methylation rates +pure_meth = CAMDAC:::calculate_mt(bulk, normal, purity, ploidy) + +# Set clean rates based on threshold +pure_meth_clean = dplyr::case_when( + pure_meth < 0 ~ 0, + pure_meth > 1 ~ 1, + TRUE ~ pure_meth +) + +``` + +After deconvolution, it may be useful to estimate the CpG coverage in the deconvolved tumour sample. Additionally, the highest density interval (HDI) of the methylation rate may be informative for quality control. These metrics can be calculated given additional information on bulk methylated and unmethylated read counts: + +```{r} + +# Optional: calculate effective coverage of the tumour +# # Requires coverage per CpG in the bulk sample +bulk_coverage = c(10, 20, 5, 15, 30) +pure_effective_coverage = CAMDAC:::calculate_mt_cov(bulk_coverage, purity, ploidy) + +# Optional: calculate the HDI of the pure tumour methylation rate +bulk_methylated_count = c(3, 10, 1, 2, 27) +bulk_unmethylated_count = c(7, 10, 4, 13, 3) +normal_methylated_count = c(3, 9, 1, 5, 2) +normal_unmethylated_count = c(7, 11, 3, 8, 3) + +# HDI function (fast) +CAMDAC:::hdi_norm_approx( + bulk_methylated_count, + bulk_unmethylated_count, + normal_methylated_count, + normal_unmethylated_count, + purity, + ploidy +) + +# HDI function (most accurate) +CAMDAC:::vec_HDIofMCMC_mt( + bulk_methylated_count, + bulk_unmethylated_count, + normal_methylated_count, + normal_unmethylated_count, + purity, + ploidy, + credMass=0.99 +) +```