From b4fd939fc273071c13c00704fc456fab17b3b724 Mon Sep 17 00:00:00 2001 From: Zeyuan Chen Date: Wed, 10 Jan 2024 21:35:59 -0800 Subject: [PATCH] updated Readme and vignettes link --- .DS_Store | Bin 8196 -> 0 bytes .Rbuildignore | 3 + .github/workflows/pkgdown.yaml | 48 ++++++++++ .gitignore | 1 + DESCRIPTION | 1 + R/.DS_Store | Bin 6148 -> 0 bytes R/Unico.r | 10 +- README.md | 51 ++--------- Rscripts/.DS_Store | Bin 6148 -> 0 bytes man/.DS_Store | Bin 6148 -> 0 bytes man/Unico.Rd | 2 +- man/association_asymptotic.Rd | 2 +- man/association_parametric.Rd | 2 +- man/simulate_data.Rd | 2 +- man/tensor.Rd | 2 +- tests/.DS_Store | Bin 6148 -> 0 bytes tests/testthat/.DS_Store | Bin 6148 -> 0 bytes vignettes/.DS_Store | Bin 6148 -> 0 bytes vignettes/.gitignore | 2 +- vignettes/Unico-Tutorial.Rmd | 8 +- vignettes/vignetts.utils.r | 163 +++++++++++++++++++++++++++++++++ 21 files changed, 238 insertions(+), 59 deletions(-) delete mode 100644 .DS_Store create mode 100644 .github/workflows/pkgdown.yaml delete mode 100644 R/.DS_Store delete mode 100644 Rscripts/.DS_Store delete mode 100644 man/.DS_Store delete mode 100644 tests/.DS_Store delete mode 100644 tests/testthat/.DS_Store delete mode 100644 vignettes/.DS_Store create mode 100644 vignettes/vignetts.utils.r diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 190019c9556d2fd99eaff49eda141206d041acb7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMy>1gh5dJoHVJl4}nlwmPgM^g_Kr+!GKtdq-fI9xeNjTqGj%|qo>0W~Z6b11B zJOODa)A0(lR5Wyav%87zHzkT-R@(jcW@dM0zrEY@oB^2q^<)p&1<+v?+}UPRQ$#Pd zQntM0HqmfAMo-r#t0k}QBdS=dKp9X5lmTTx8Bhjp0t0+!OX)Pc_nlT-Wk4DDFBy>Y zAz&5kd(0f#ql1l20f=piZDD^$I>f+Z-(%*G8W!V*65UYaQw-yVQyzG`zQ@d=8xG@> z592)>pP?A*o%09Q9H#G3TV+5Qs4^hAdkYh!7%x_Z{QWIXu)-8`^ze%M7;E;Yl=cu} zNZpXVm%N^0X{E=sIz+;L%682DlqlAm-H%Q5X8iu1d9Z@F7!o|21Q@yD}7Pg;KyoeeNa;~e+L7yIOfhBVIg~x_tt%X zN4!;RO1^)8d}r5KV^@fz(JmiX_rp0|R()=wWfG^!j5;~`J9xo+X2m;2A|E2o$8FAD z|EjYo#eES!@o|^tnx}=h8}0IOn@z#qEG7E=HK diff --git a/.Rbuildignore b/.Rbuildignore index 4af23f6..bbdb868 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,6 @@ LICENSE ^pkgdown$ ^cran-comments\.md$ ^\.github$ +^vignettes/pbmc\.rds$ +^vignettes/liu\.rds$ +^vignettes/hannum\.rds$ diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..ed7650c --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,48 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index ce37472..becd350 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +**/.DS_Store .Rproj.user .Rhistory .RData diff --git a/DESCRIPTION b/DESCRIPTION index 72db7ae..9f8d259 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -44,3 +44,4 @@ Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true RoxygenNote: 7.2.3 +URL: https://cozygene.github.io/Unico/ diff --git a/R/.DS_Store b/R/.DS_Store deleted file mode 100644 index f7813dbf0adf8b6cb60ee8e57b86a1ff434a90a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO-sW-5Pho!3toEkxWB;QFEEsd9>hb7o^5NON=>9m4&L(9eKWI))tn{BOxb<2 z^Oebi?q&gmdG~Yy%m7R|1cN98BIZHYQ3@6eTBF7}7H{qPwrd6ojnO2%pJ0m;JN~}) z-|p$T#1ijl(9-{k3=fRhp`%{XnxVjoz7@55u1oCI`ogF!D(W@ojaIKTy5`EVE9Oas zYdllCp>?fQDy}!o%dp@W>g}#;w6`B!kC9yO$r*44oB?NGlnn697MY$J`s@ri1J1w~ z1F}Cv4#7NOZ>U=bC%pm?Cp4>2m%D`I#Dsam-jE(juvDU@hIGXUmQH(2ae2bt(9#j~ z$*hx}{CRl^`gGc(h9l&LK05=>z##+2ww%fNf5pGd;3fYs#aGUNGw{zC2$N!2%=uF3 zZ2k3ma@IzUM-CB*>qVhZKlljXLiUj}b(%kl&bT~bZzxs7uIWVo5KuyVat8i@fe%1s BG!y^; diff --git a/R/Unico.r b/R/Unico.r index 39b1d5f..75b6973 100644 --- a/R/Unico.r +++ b/R/Unico.r @@ -55,7 +55,7 @@ #' \item{sigmas_hat_list}{A list tracking, for each feature, the computed estimates of the variance-covariance matrix at each iteration of the variance-covariance optimization (activated only if \code{debug == TRUE}).} #' #' @examples -#' data = simulate_data(n = 100, m = 2, k = 3, p1 = 1, p2 = 1, taus_std = 0) +#' data = simulate_data(n = 100, m = 2, k = 3, p1 = 1, p2 = 1, taus_std = 0, log_file = NULL) #' res = list() #' res$params.hat = Unico(data$X, data$W, data$C1, data$C2, parallel=FALSE, log_file=NULL) #' @@ -256,7 +256,7 @@ Unico = function(X, W, C1, C2, fit_tau = FALSE, #' @return A \code{k} by \code{m} by \code{n} array with the estimated source-specific values. The first axis/dimension in the array corresponds to the different sources. #' #' @examples -#' data = simulate_data(n = 100, m = 2, k = 3, p1 = 1, p2 = 1, taus_std = 0) +#' data = simulate_data(n = 100, m = 2, k = 3, p1 = 1, p2 = 1, taus_std = 0, log_file = NULL) #' res = list() #' res$params.hat = Unico(data$X, data$W, data$C1, data$C2, parallel=FALSE, log_file=NULL) #' res$Z = tensor(data$X, data$W, data$C1, data$C2, res$params.hat, parallel=FALSE, log_file=NULL) @@ -370,7 +370,7 @@ tensor = function(X, W, C1, C2, Unico.mdl, parallel = TRUE, num_cores = NULL, #' \item{phi_hat_pvals}{An \code{m} by \code{k+p1*k+p2} matrix containing the p-values associated with \code{phi_hat} for each feature (activated only if \code{debug == TRUE}).} #' #' @examples -#' data = simulate_data(n = 100, m = 2, k = 3, p1 = 1, p2 = 1, taus_std = 0) +#' data = simulate_data(n = 100, m = 2, k = 3, p1 = 1, p2 = 1, taus_std = 0, log_file = NULL) #' res = list() #' res$params.hat = Unico(data$X, data$W, data$C1, data$C2, parallel=FALSE, log_file=NULL) #' res$params.hat = association_parametric(data$X, res$params.hat, parallel=FALSE, log_file=NULL) @@ -608,7 +608,7 @@ association_parametric = function(X, Unico.mdl, slot_name = "parametric", #' \item{phi_hat_pvals}{An \code{m} by \code{k+p1*k+p2} matrix containing the p-values associated with \code{phi_hat} for each feature (activated only if \code{debug == TRUE}).} #' #' @examples -#' data = simulate_data(n = 100, m = 2, k = 3, p1 = 1, p2 = 1, taus_std = 0) +#' data = simulate_data(n = 100, m = 2, k = 3, p1 = 1, p2 = 1, taus_std = 0, log_file = NULL) #' res = list() #' res$params.hat = Unico(data$X, data$W, data$C1, data$C2, parallel=FALSE, log_file=NULL) #' res$params.hat = association_asymptotic(data$X, res$params.hat, parallel=FALSE, log_file=NULL) @@ -840,7 +840,7 @@ association_asymptotic = function(X, Unico.mdl, slot_name = "asymptotic", #' #' @examples -#' sim.data = simulate_data(n = 100, m = 5, k = 5, p1 = 1, p2 = 2) +#' sim.data = simulate_data(n = 100, m = 5, k = 5, p1 = 1, p2 = 2, log_file = NULL) #' #' @export simulate_data diff --git a/README.md b/README.md index feb111a..ed59965 100644 --- a/README.md +++ b/README.md @@ -2,63 +2,26 @@ [![R-CMD-check](https://github.com/cozygene/Unico/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cozygene/Unico/actions/workflows/R-CMD-check.yaml) - + We present Unico, a unified cross-omics method designed to deconvolve standard 2-dimensional bulk matrices of samples by features into a 3-dimensional tensors representing samples by features by cell types. Unico stands out as the first principled model-based deconvolution method that is theoretically justified for any heterogeneous genomic data. All necessary scripts used for the analyses reported in the manuscript can be found under ./Rscripts Unico will be available soon on CRAN as an R package -### Installation Instructions -Please install the following packages in R, which should finish within an hour. +### Installation from github ``` -install.packages("pbapply") -install.packages("config") -install.packages("data.table") -install.packages("matrixStats") -install.packages("matrixcalc") -install.packages("mgcv") -install.packages("nloptr") -install.packages("testit") -install.packages("compositions") -install.packages("MASS") -install.packages("pracma") +if (!require("devtools", quietly = TRUE)) + install.packages("devtools") +devtools::install_github("https://github.com/cozygene/Unico") ``` + ### Version info Our algorithm is tested on both R 3.6.1 and R 4.1.0, on both Linux and MacOS based machines. The entirety of the system environment is also included at the end of the tutorial notebook. - -### Running Unico -``` -Please provide (1) Bulk matrix of normalized counts or methylation beta values as input: X (features by samples), - (2) The (estimated) sample specific cell-type proportions matrix: W (samples by cell types). - This matrix should be normalized such that proportions on each row/individual sum up to 1 - (3) Optionally, the model can also model cell-type level covariates: C1 (samples by number of cell-type-level covariates) - (4) Optionally, the model can also model tissue-level covariates: C2 (samples by number of tissue-level covariates) -We encourage users to provide all matrices with explicit and meaningful row and column names when possible to avoid confusion regarding the dimension of the output object. -``` -##### First step is always to perform parameter estimation. -``` -#Unico will learn cell-type specific means, variances and covariances along with cell-type-level and tissue-level effect sizes under a generalized method of moment (GMM) framework -unico.mdl = list() -unico.mdl$params.hat <- Unico(X, W, C1, C2, parallel = TRUE) -``` -##### Once parameters are estimated we can further estimate cell-type level profiles: cell types by features by samples (denoted as Z.hat) -``` -unico.mdl$Z.hat = tensor(X, W = W, C1, C2, unico.mdl$params.hat) -``` -##### Alternatively, we can perform association study -``` -#parametric version (under normality assumption) without explicitly deriving the underlying cell-type levels: -Unico.mdl$params.hat = add_C1_C2_pvals_parametric(X = X, Unico.mdl = Unico.mdl$params.hat, slot_name = "parametric") -``` -``` -#Non-parametric version (p-values are derived based on asymptotics): -Unico.mdl$params.hat = add_C1_C2_pvals_asymptotic(X = X, Unico.mdl = Unico.mdl$params.hat, slot_name = "asymptotic") -``` ### Tutorial -Please head to "vignettes" folder for a more involved step by step tutorial on deconvolving a simulated PBMC pseudo-bulk expression dataset and association testing on methylation data. +Please head to "vignettes" folder for a more involved step by step tutorial on deconvolving a simulated PBMC pseudo-bulk expression dataset and association testing on subsets of publicly available methylation data. ### Author diff --git a/Rscripts/.DS_Store b/Rscripts/.DS_Store deleted file mode 100644 index f03aa16d7fd06698a919b3c41eb18c3d46535384..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%Syvg5Iwi;qQy;dQ`?}zk=<}Wzm^N=BW{P>*XRV&>thKj!ny=pGe!8fS&VV!E3>+*2tl1*N zBSjyb0cXG&s2Py&LqZiy4J*a?>EIAs0OEk=D4a_#AvuX*YFH`KLkXHn)YM=tM$mNH z6N^g?D@9F5u;wG!&cQmA5O?SLNeo9w6@7FDoPjn2eSI8D{XhG;|8FPxlQZB9{3`~+ zAe(11Udd`}=Wsox({h#f+6wd_s*vdmH1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0J5S@Vttwa-vhSEJ%ZeXJ21i1i&ASklhNP&JYk}^l(7W7<$_dEmAf+Zvh z6wpj$zp>}D-nWYF5fPm~t!5%q5oyqfN~I#4u9}YAc>>gu<59Nj``O~Q?>3c0hd9Nx zpU91D@w=1y`bYMzZ`mbhvUQ*<4u=pxWrOE4xmX2-!07KmCX&_dNq z47G5~C-=*agQ10sdhwzDkFFOu~%)A;qs&bvFeq6!rgs6uzr z-Lubk{&=?H7(f`UpDuwRfB{vocTDq*NV{l9ddVXgw2yO4QQ;YnSazb_afl4a-kqXB ziJJE7{$1eiy_t{Kb+cm37!!PGOo=ySxaSVPV$HH-W+*UY{*0w5>m^p|ePPssC!!`+ zJQWMJR2scx&9W=zNe|aNHw|v+oog?fbCl6*vy-SzxnW;2V)n!QZ`1tuuJI5z#pmP< zI0MeWFEhY9TV!xz=++r<2AqK{1M+={RKYx9Yp9cf%&VV!UuNVmZVp5E_q;$7-7AJRYq&`qZB(62wrm&z_F=OQ_KBKD8AEiLd6Sju* PQ2a+gX>j8V{3!#UhA2Jz diff --git a/vignettes/.DS_Store b/vignettes/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0