diff --git a/.Rbuildignore b/.Rbuildignore index a9dbe0c..4b7f268 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,3 +7,5 @@ ^docs$ ^pkgdown$ ^\.github$ +^doc$ +^Meta$ diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index a7276e8..5fdbb1a 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -34,6 +34,11 @@ jobs: with: extra-packages: any::pkgdown, local::. needs: website + + - name: Manually install newer version of preprocessCore + run: | + Rscript -e "pak::pkg_install('BiocManager')" + Rscript -e "BiocManager::install('preprocessCore', configure.args = c(preprocessCore = '--disable-threading'), force= TRUE, update=TRUE, type = 'source')" - name: Build site run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) diff --git a/.gitignore b/.gitignore index 389bfeb..84eb6e5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ .DS_Store .Rproj docs +/doc/ +/Meta/ diff --git a/_pkgdown.yml b/_pkgdown.yml index bb08254..1ef8acf 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -2,3 +2,30 @@ url: http://omnideconv.org/methylDeconv/ template: bootstrap: 5 +articles: + - title: "Getting Started" + contents: + - getting_started + - visualization + - title: "Contributing" + contents: + - contribute + +navbar: + structure: + left: + - home + - reference + - articles + - news + components: + articles: + text: "Articles" + menu: + - text: "Getting Started" + href: articles/getting_started.html + - text: "Visualization" + href: articles/visualization.html + - text: "Contribute" + href: articles/contribute.html + diff --git a/vignettes/.build.timestamp b/vignettes/.build.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/vignettes/contribute.R b/vignettes/contribute.R new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/vignettes/contribute.R @@ -0,0 +1 @@ + diff --git a/vignettes/contribute.Rmd b/vignettes/contribute.Rmd new file mode 100644 index 0000000..bd8b9df --- /dev/null +++ b/vignettes/contribute.Rmd @@ -0,0 +1,70 @@ +--- +title: "Contribute: Adding a New Method to methyldeconv" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Contribute: Adding a New Method to methyldeconv} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +# Contributing a New Method to methyldeconv + +Thank you for your interest in contributing to **methyldeconv**! This guide will help you add a new cell-type deconvolution method to the package. + +## 1. Fork and Clone the Repository + +- Fork the [methyldeconv GitHub repository](https://github.com/omnideconv/methyldeconv). +- Clone your fork locally and create a new branch for your feature. + +## 2. Add Your Method Implementation + +- Add a new R script for your method in the `R/` directory (e.g., `mynewmethod.R`). +- Follow the structure of existing methods (see files like `epidish.R`, `houseman.R`, etc.). +- Your function should: + - Accept a beta matrix or methylSet as input. + - Return results in a format consistent with other methods (see `run_epidish`, `run_houseman`, etc.). + - Include roxygen2 documentation. + +## 3. Register Your Method + +- If your method should be accessible via the unified interface (`deconvolute` or `deconvolute_combined`), update the relevant logic in `main.R`. +- Add your method to the list of supported methods and document any new parameters. + +## 4. Expose All Method Parameters via methyldeconv + +To ensure users can fully utilize your new method, make sure that all relevant parameters of your function are accessible through the main methyldeconv interfaces (`deconvolute` and/or `deconvolute_combined`). + +- Update the argument handling in `main.R` so that users can pass any method-specific parameters when calling these functions. +- Clearly document these parameters in your function's roxygen2 documentation and in the main interface documentation if needed. +- This approach ensures flexibility and makes your method as useful as possible for a wide range of use cases. + +## 5. Document Your Method + +- Add a roxygen2 documentation block to your function. +- Run `devtools::document()` to update the manual files in `man/`. +- Optionally, add an example to the README or a new vignette. + +## 6. Add Tests + +- Add tests for your method in `tests/testthat/` (see `test_methods.R` for examples). +- Ensure your method is covered by the test suite. + +## 7. Check and Build + +- Run `devtools::check()` to ensure your changes pass all checks. +- Build the documentation site locally with `pkgdown::build_site()` to preview your changes. + +## 8. Submit a Pull Request + +- Push your branch to your fork and open a pull request against the main repository. +- Describe your changes and reference any related issues. + +## 9. Code Review + +- Address any feedback or requested changes from the maintainers. + +--- + +For more details, see the [pkgdown documentation](https://pkgdown.r-lib.org/) and the [R packages book](https://r-pkgs.org/). + +If you have questions, feel free to open an issue or ask for help in your pull request! \ No newline at end of file diff --git a/vignettes/contribute.html b/vignettes/contribute.html new file mode 100644 index 0000000..d6fb244 --- /dev/null +++ b/vignettes/contribute.html @@ -0,0 +1,324 @@ + + + + +
+ + + + + + + + + +Thank you for your interest in contributing to methyldeconv! This guide will help you add a new cell-type deconvolution method to the package.
+R/ directory (e.g., mynewmethod.R).epidish.R, houseman.R, etc.).run_epidish, run_houseman, etc.).deconvolute or deconvolute_combined), update the relevant logic in main.R.To ensure users can fully utilize your new method, make sure that all relevant parameters of your function are accessible through the main methyldeconv interfaces (deconvolute and/or deconvolute_combined).
main.R so that users can pass any method-specific parameters when calling these functions.devtools::document() to update the manual files in man/.tests/testthat/ (see test_methods.R for examples).devtools::check() to ensure your changes pass all checks.pkgdown::build_site() to preview your changes.For more details, see the pkgdown documentation and the R packages book.
+If you have questions, feel free to open an issue or ask for help in your pull request!
+Welcome to methyldeconv! This vignette will help you get up and running with cell-type deconvolution for DNA methylation data using the package’s unified interface and included methods.
+You can install methyldeconv from GitHub using the pak package manager:
+ +methyldeconv can be applied directly to a methylSet from the minfi package, or you can apply each method separately on a beta matrix with Illumina CpG IDs.
+Both cases are demonstrated below using example data from minfi:
+ +## Loading required package: FlowSorted.Blood.450k
+## Loading required package: minfi
+## Loading required package: BiocGenerics
+##
+## Attaching package: 'BiocGenerics'
+## The following objects are masked from 'package:stats':
+##
+## IQR, mad, sd, var, xtabs
+## The following objects are masked from 'package:base':
+##
+## anyDuplicated, aperm, append, as.data.frame, basename, cbind,
+## colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
+## get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
+## match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
+## Position, rank, rbind, Reduce, rownames, sapply, saveRDS, setdiff,
+## table, tapply, union, unique, unsplit, which.max, which.min
+## Loading required package: GenomicRanges
+## Loading required package: stats4
+## Loading required package: S4Vectors
+##
+## Attaching package: 'S4Vectors'
+## The following object is masked from 'package:utils':
+##
+## findMatches
+## The following objects are masked from 'package:base':
+##
+## expand.grid, I, unname
+## Loading required package: IRanges
+## Loading required package: GenomeInfoDb
+## Loading required package: SummarizedExperiment
+## Loading required package: MatrixGenerics
+## Loading required package: matrixStats
+##
+## Attaching package: 'MatrixGenerics'
+## The following objects are masked from 'package:matrixStats':
+##
+## colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
+## colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
+## colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
+## colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
+## colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
+## colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
+## colWeightedMeans, colWeightedMedians, colWeightedSds,
+## colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
+## rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
+## rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
+## rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
+## rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
+## rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
+## rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
+## rowWeightedSds, rowWeightedVars
+## Loading required package: Biobase
+## Welcome to Bioconductor
+##
+## Vignettes contain introductory material; view with
+## 'browseVignettes()'. To cite Bioconductor, see
+## 'citation("Biobase")', and for packages 'citation("pkgname")'.
+##
+## Attaching package: 'Biobase'
+## The following object is masked from 'package:MatrixGenerics':
+##
+## rowMedians
+## The following objects are masked from 'package:matrixStats':
+##
+## anyMissing, rowMedians
+## Loading required package: Biostrings
+## Loading required package: XVector
+##
+## Attaching package: 'Biostrings'
+## The following object is masked from 'package:base':
+##
+## strsplit
+## Loading required package: bumphunter
+## Loading required package: foreach
+## Loading required package: iterators
+## Loading required package: parallel
+## Loading required package: locfit
+## locfit 1.5-9.12 2025-03-05
+## Setting options('download.file.method.GEOquery'='auto')
+## Setting options('GEOquery.inmemory.gpl'=FALSE)
+## → checking methyldeconv environment and dependencies
+
+## Loading required package: IlluminaHumanMethylation450kmanifest
+## Loading required package: IlluminaHumanMethylation450kanno.ilmn12.hg19
+# use example data from Minfi
+methyl_set <- minfiData::MsetEx
+ratio_set <- minfi::ratioConvert(methyl_set)
+beta_matrix <- minfi::getBeta(ratio_set)
+
+# run EpiDISH for deconvolution of example data
+result <- methyldeconv::deconvolute(methyl_set = methyl_set, method = 'epidish')## Warning in check_input_beta(beta_matrix): 12 NA values detected in your beta
+## matrix. Replacing them with 0.5.
+## RPC was chosen as default for "mode"
+## blood was chosen as default for "reference"
+## Starting EpiDISH deconvolution with mode RPC ...
+
+## Warning in check_input_beta(beta_matrix): 12 NA values detected in your beta
+## matrix. Replacing them with 0.5.
+## blood was chosen as default for "reference"
+## Starting EpiDISH deconvolution with mode RPC ...
+# you can also run multiple methods at the same time and get their results + aggregated results:
+result_multiple <- methyldeconv::deconvolute_combined(methyl_set = methyl_set,
+ methods = c('epidish','houseman'),
+ array = '450k')## Warning in check_input_beta(beta_matrix): 12 NA values detected in your beta
+## matrix. Replacing them with 0.5.
+## RPC was chosen as default for "mode"
+## blood was chosen as default for "reference"
+## Starting EpiDISH deconvolution with mode RPC ...
+## 450k was chosen as default for "array"
+## Blood was chosen as default for "compositeCellType"
+## IlluminaHumanMethylationEPIC was chosen as default for "referencePlatform"
+## IDOL was chosen as default for "probeSelect"
+## [estimateCellCounts2] The function will assume that no preprocessing has been performed. Using 'preprocessQuantile' in prenormalized data is experimental and it should only be run under the user responsibility
+## Loading required package: FlowSorted.Blood.EPIC
+## Loading required package: ExperimentHub
+## Loading required package: AnnotationHub
+## Loading required package: BiocFileCache
+## Loading required package: dbplyr
+##
+## Attaching package: 'AnnotationHub'
+## The following object is masked from 'package:Biobase':
+##
+## cache
+## see ?FlowSorted.Blood.EPIC and browseVignettes('FlowSorted.Blood.EPIC') for documentation
+## loading from cache
+## Loading required package: IlluminaHumanMethylationEPICmanifest
+## [convertArray] Casting as IlluminaHumanMethylationEPIC
+## [estimateCellCounts2] Combining user data with reference (flow sorted) data.
+## Warning in asMethod(object): NAs introduced by coercion
+## [estimateCellCounts2] Processing user and reference data together.
+## [preprocessQuantile] Mapping to genome.
+## Loading required package: IlluminaHumanMethylationEPICanno.ilm10b4.hg19
+##
+## Attaching package: 'IlluminaHumanMethylationEPICanno.ilm10b4.hg19'
+## The following objects are masked from 'package:IlluminaHumanMethylation450kanno.ilmn12.hg19':
+##
+## Islands.UCSC, Locations, Manifest, Other, SNPs.132CommonSingle,
+## SNPs.135CommonSingle, SNPs.137CommonSingle, SNPs.138CommonSingle,
+## SNPs.141CommonSingle, SNPs.142CommonSingle, SNPs.144CommonSingle,
+## SNPs.146CommonSingle, SNPs.147CommonSingle, SNPs.Illumina
+## [preprocessQuantile] Fixing outliers.
+## [preprocessQuantile] Quantile normalizing.
+## [estimateCellCounts2] Using IDOL L-DMR probes for composition estimation.
+## [estimateCellCounts2] Estimating proportion composition (prop), if you provide cellcounts those will be provided as counts in the composition estimation.
+With methyldeconv you can either get the original result object of each respective method (methyldeconv::run_XXX) or a table with cell-type fractions that has a unified format between methods (methyldeconv::deconvolute). The unified results can be visualized using the methyldeconv functions results_barplot() or results_boxplot().
Results from a run with more than one method (methyldeconv::deconvolute_combined) can be easily visualized as well with results_aggregated_boxplot:
For more details, see the package documentation and other vignettes!
+