diff --git a/.Rbuildignore b/.Rbuildignore index 8be8edb..872954f 100755 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -2,7 +2,7 @@ ^.*\.Rproj$ ^\.Rproj\.user$ ^\.Rhistory$ -^tmp$ +^tmp.* ^NEWS\.md$ # bash scripts diff --git a/.github/.gitignore b/.github/.gitignore old mode 100644 new mode 100755 diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml old mode 100644 new mode 100755 diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml old mode 100644 new mode 100755 diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml old mode 100644 new mode 100755 diff --git a/DESCRIPTION b/DESCRIPTION index abe7dfc..2cdd3af 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,11 @@ Package: DEploid Type: Package Title: Deconvolute Mixed Genomes with Unknown Proportions -Version: 0.5.3 +Version: 0.5.4 Authors@R: c( person("Joe", "Zhu", role=c("aut", "cre", "cph"), email="sha.joe.zhu@gmail.com"), - person('Jacob', 'Almagro-Garcia', role=c('aut', 'cph')), - person('Gil', 'McVean', role=c('aut', 'cph')), + person('Jacob', 'Almagro-Garcia', role=c('aut')), + person('Gil', 'McVean', role=c('aut')), person('University of Oxford', '', role=c('cph')), person('Yinghan', 'Liu', role=c('ctb')), person('CodeCogs', 'Zyba Ltd', role=c('com', "cph")), @@ -37,8 +37,8 @@ Imports: Suggests: knitr, testthat (>= 0.9.0) -SystemRequirements: C++11 VignetteBuilder: knitr LinkingTo: Rcpp -RoxygenNote: 7.1.0 -Date: 2020-04-21 +RoxygenNote: 7.3.2 +Encoding: UTF-8 +Date: 2024-10-8 diff --git a/NAMESPACE b/NAMESPACE index 6ed6075..39e8bb6 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,26 +1,37 @@ -importFrom("scales", "alpha") -importFrom("grDevices", "rainbow", "colorRampPalette") -importFrom("graphics", "abline", "barplot", "hist", "plot", "points", "axis", "legend") -importFrom("utils", "read.table") -importFrom(Rcpp,evalCpp) -importFrom("magrittr", "%>%") -importFrom("plotly", "plot_ly", "layout", "add_trace") -importFrom("rmarkdown", "pandoc_available") -importFrom("htmlwidgets", "saveWidget") -useDynLib(DEploid, .registration = TRUE) +# Generated by roxygen2: do not edit by hand + +export(computeObsWSAF) export(dEploid) -export(extractVcf) -export(plotProportions) -export(extractCoverageFromVcf) export(extractCoverageFromTxt) +export(extractCoverageFromVcf) +export(extractPLAF) +export(extractVcf) export(haplotypePainter) -export(plotAltVsRef) -export(computeObsWSAF) export(histWSAF) -export(extractPLAF) -export(plotWSAFvsPLAF) -export(plotObsExpWSAF) +export(plotAltVsRef) export(plotAltVsRefPlotly) export(plotHistWSAFPlotly) -export(plotWSAFVsPLAFPlotly) +export(plotObsExpWSAF) export(plotObsExpWSAFPlotly) +export(plotProportions) +export(plotWSAFVsPLAFPlotly) +export(plotWSAFvsPLAF) +importFrom(Rcpp,evalCpp) +importFrom(grDevices,colorRampPalette) +importFrom(grDevices,rainbow) +importFrom(graphics,abline) +importFrom(graphics,axis) +importFrom(graphics,barplot) +importFrom(graphics,hist) +importFrom(graphics,legend) +importFrom(graphics,plot) +importFrom(graphics,points) +importFrom(htmlwidgets,saveWidget) +importFrom(magrittr,"%>%") +importFrom(plotly,add_trace) +importFrom(plotly,layout) +importFrom(plotly,plot_ly) +importFrom(rmarkdown,pandoc_available) +importFrom(scales,alpha) +importFrom(utils,read.table) +useDynLib(DEploid, .registration = TRUE) diff --git a/R/dEploid.R b/R/dEploid.R index d287b78..7ea0cf5 100755 --- a/R/dEploid.R +++ b/R/dEploid.R @@ -1,3 +1,6 @@ +#' @keywords internal +"_PACKAGE" + #' Deconvolute Mixed Genomes with Unknown Proportions #' #' Traditional phasing programs are limited to diploid organisms. @@ -18,9 +21,16 @@ #' Maintainer: Joe Zhu \email{sha.joe.zhu@gmail.com} #' #' @name DEploid-package -#' @docType package #' #' @importFrom Rcpp evalCpp -#' @useDynLib _DEploid_dEploid -#' @useDynLib _DEploid_extractVcf +#' @importFrom scales alpha +#' @importFrom grDevices rainbow colorRampPalette +#' @importFrom graphics abline barplot hist plot points axis legend +#' @importFrom utils read.table +#' @importFrom magrittr %>% +#' @importFrom plotly plot_ly layout add_trace +#' @importFrom rmarkdown pandoc_available +#' @importFrom htmlwidgets saveWidget +#' @useDynLib DEploid, .registration = TRUE NULL + diff --git a/README.md b/README.md index 6e74d40..9453a14 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ [![License (GPL version 3)](https://img.shields.io/badge/license-GPL%20version%203-brightgreen.svg)](http://opensource.org/licenses/GPL-3.0) -[![Build Status](https://travis-ci.org/DEploid-dev/DEploid-r.svg?branch=master)](https://travis-ci.org/DEploid-dev/DEploid-r) +[![Build Status](https://travis-ci.org/DEploid-dev/DEploid-r.svg?branch=master)](https://app.travis-ci.com/DEploid-dev/DEploid-r) [![Build Status](https://ci.appveyor.com/api/projects/status/hi1nq97d5l68qs4r?svg=true)](https://ci.appveyor.com/project/shajoezhu/deploid-r) [![Coverage Status](https://coveralls.io/repos/github/DEploid-dev/DEploid-r/badge.svg?branch=master)](https://coveralls.io/github/DEploid-dev/DEploid-r?branch=master) -[![codecov](https://codecov.io/gh/DEploid-dev/DEploid-r/branch/master/graph/badge.svg)](https://codecov.io/gh/DEploid-dev/DEploid-r) +[![codecov](https://codecov.io/gh/DEploid-dev/DEploid-r/branch/master/graph/badge.svg)](https://app.codecov.io/gh/DEploid-dev/DEploid-r) [![CRAN RStudio Mirror Downloads](http://cranlogs.r-pkg.org/badges/DEploid)](https://cran.r-project.org/package=DEploid) DEploid R package -- Deconvolute Mixed Genomes with Unknown Proportions diff --git a/inst/CITATION b/inst/CITATION index 2acba60..1eb0f48 100755 --- a/inst/CITATION +++ b/inst/CITATION @@ -8,5 +8,5 @@ bibentry( journal = 'bioRxiv', doi = '10.1101/099499', publisher = 'Cold Spring Harbor Labs Journals', - url = 'http://www.biorxiv.org/content/early/2017/01/10/099499' + url = 'https://www.biorxiv.org/content/10.1101/099499v1' ) diff --git a/man/DEploid-package.Rd b/man/DEploid-package.Rd index 02fa781..dc7c63f 100755 --- a/man/DEploid-package.Rd +++ b/man/DEploid-package.Rd @@ -2,9 +2,12 @@ % Please edit documentation in R/dEploid.R \docType{package} \name{DEploid-package} +\alias{DEploid} \alias{DEploid-package} -\title{Deconvolute Mixed Genomes with Unknown Proportions} +\title{DEploid: Deconvolute Mixed Genomes with Unknown Proportions} \description{ +Traditional phasing programs are limited to diploid organisms. Our method modifies Li and Stephens algorithm with Markov chain Monte Carlo (MCMC) approaches, and builds a generic framework that allows haplotype searches in a multiple infection setting. This package is primarily developed as part of the Pf3k project, which is a global collaboration using the latest sequencing technologies to provide a high-resolution view of natural variation in the malaria parasite Plasmodium falciparum. Parasite DNA are extracted from patient blood sample, which often contains more than one parasite strain, with unknown proportions. This package is used for deconvoluting mixed haplotypes, and reporting the mixture proportions from each sample. + Traditional phasing programs are limited to diploid organisms. Our method modifies Li and Stephens algorithm with Markov chain Monte Carlo (MCMC) approaches, and builds a generic framework that allows haplotype @@ -16,9 +19,36 @@ extracted from patient blood sample, which often contains more than one parasite strain, with unknown proportions. This package is used for deconvoluting mixed haplotypes, #' and reporting the mixture proportions from each sample. +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/DEploid-dev/DEploid-r} + \item Report bugs at \url{https://github.com/DEploid-dev/DEploid-r/issues} +} + } \author{ +\strong{Maintainer}: Joe Zhu \email{sha.joe.zhu@gmail.com} [copyright holder] + +Authors: +\itemize{ + \item Jacob Almagro-Garcia + \item Gil McVean +} + +Other contributors: +\itemize{ + \item University of Oxford [copyright holder] + \item Yinghan Liu [contributor] + \item CodeCogs Zyba Ltd [compiler, copyright holder] + \item Deepak Bandyopadhyay [compiler, copyright holder] + \item Lutz Kettner [compiler, copyright holder] +} + + Zhu Sha Maintainer: Joe Zhu \email{sha.joe.zhu@gmail.com} } +\keyword{internal} diff --git a/src/DEploid/dEploidIO.cpp b/src/DEploid/dEploidIO.cpp index e1a8270..8729c0c 100755 --- a/src/DEploid/dEploidIO.cpp +++ b/src/DEploid/dEploidIO.cpp @@ -190,7 +190,7 @@ void DEploidIO::reInit() { void DEploidIO::finalize() { - if ( this->doIbdPainting() | this->doComputeLLK() | this->doIbdViterbiPainting() ) { + if ( this->doIbdPainting() || this->doComputeLLK() || this->doIbdViterbiPainting() ) { if (!initialPropWasGiven()) { throw InitialPropUngiven(""); } @@ -541,7 +541,7 @@ void DEploidIO::checkInput() { // set k strain by proportion length } } - if (this->useBestPractice() & (!this->usePanel())){ + if (this->useBestPractice() && (!this->usePanel())){ throw FlagsConflict("-best" , string("-noPanel. Reference panel is") + string("required for using best-practices.")); } @@ -764,7 +764,7 @@ void DEploidIO::readPanel() { if ( this->usePanel() == false ) { return; } - if ( this->doIbdPainting() | this->doComputeLLK() ) { + if ( this->doIbdPainting() || this->doComputeLLK() ) { return; } diff --git a/src/DEploid/exceptions.hpp b/src/DEploid/exceptions.hpp index 0b4e1d6..51033dc 100755 --- a/src/DEploid/exceptions.hpp +++ b/src/DEploid/exceptions.hpp @@ -39,7 +39,8 @@ struct ShouldNotBeCalled : std::exception{ ShouldNotBeCalled() { } virtual ~ShouldNotBeCalled() throw() {} virtual const char* what() const noexcept { - return string("Should not reach here").c_str(); + static const std::string msg = "Should not reach here"; + return msg.c_str(); } }; @@ -75,7 +76,8 @@ struct OutOfVectorSize : std::exception{ OutOfVectorSize() { } virtual ~OutOfVectorSize() throw() {} virtual const char* what() const noexcept { - return string("Out of vector size!").c_str(); + static const std::string msg = "Out of vector size!"; + return msg.c_str(); } }; diff --git a/src/DEploid/mcmc.cpp b/src/DEploid/mcmc.cpp index 1ca2771..b9776b8 100755 --- a/src/DEploid/mcmc.cpp +++ b/src/DEploid/mcmc.cpp @@ -314,7 +314,7 @@ void McmcMachinery::runMcmcChain( bool showProgress, bool useIBD, bool notInR ) this->mcmcSample_->siteOfOneMissCopyOne[atSiteI] /= (double)this->maxIteration_; } - if ( notInR & ((jobbrief == "lassoK") | (jobbrief == "ibd") | (jobbrief == "classic")) ) { // notInPython + if ( notInR & ((jobbrief == "lassoK") || (jobbrief == "ibd") || (jobbrief == "classic")) ) { // notInPython this->dEploidIO_->writeMcmcRelated(this->mcmcSample_, jobbrief, useIBD); } diff --git a/src/DEploid/random/fastfunc.hpp b/src/DEploid/random/fastfunc.hpp index faa3ace..899564f 100755 --- a/src/DEploid/random/fastfunc.hpp +++ b/src/DEploid/random/fastfunc.hpp @@ -29,6 +29,7 @@ #include #include #include +#include // Number of interpolation points. If this is changed, several constants in fastlog must also be changed. @@ -85,8 +86,8 @@ inline double FastFunc::fastexp_lo(double y) { inline double FastFunc::fastlog(double x) { const float offset = 2047; // as int64_t: 0x409ffc00000.... - double y = x; - int64_t* yint = (int64_t*)(&y); + //double y = x; int64_t* yint = reinterpret_cast(&y); + int64_t* yint = reinterpret_cast(&x); int expon = ((*yint) >> 52) - 1023; // base-2 exponent of float int index = ((*yint) >> (52-10)) & 1023; // upper 10 bits of mantissa *yint |= 0x7ffffc0000000000; // convert float into remainder of mantissa; and diff --git a/src/Makevars.win b/src/Makevars.win index 976b8e8..aee6616 100755 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -23,6 +23,5 @@ OBJECTS.dEploid = DEploid/dEploidIO.o \ OBJECTS = $(OBJECTS.dEploidr) $(OBJECTS.dEploid) -CXX_STD = CXX11 PKG_CXXFLAGS = -I/usr/share/R/include/ -IDEploid/ -IDEploid/codeCogs/ -IDEploid/random/ -IDEploid/gzstream/ -IDEploid/lasso/ -DVERSION="\"R\"" -DRBUILD -DSTRICT_R_HEADERS PKG_LIBS = -lz diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp old mode 100755 new mode 100644 index 120b92e..ecb3afa --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -5,6 +5,11 @@ using namespace Rcpp; +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + // dEploid List dEploid(std::string args); RcppExport SEXP _DEploid_dEploid(SEXP argsSEXP) { diff --git a/src/init.c b/src/init.c index 3872b4b..ff1df69 100755 --- a/src/init.c +++ b/src/init.c @@ -10,9 +10,9 @@ /* .Call calls */ extern SEXP _DEploid_dEploid(SEXP); extern SEXP _DEploid_extractVcf(SEXP); -extern SEXP _DEploid_test_RRG_sample(); +extern SEXP _DEploid_test_RRG_sample(void); extern SEXP _DEploid_test_RRG_sampleExpoExpoLimit(SEXP, SEXP, SEXP); -extern SEXP _DEploid_test_RRG_sampleUnitExpo(); +extern SEXP _DEploid_test_RRG_sampleUnitExpo(void); static const R_CallMethodDef CallEntries[] = { {"_DEploid_dEploid", (DL_FUNC) &_DEploid_dEploid, 1}, diff --git a/vignettes/dEploid-Arguments.Rmd b/vignettes/dEploid-Arguments.Rmd index 8a9e17e..0b5f149 100755 --- a/vignettes/dEploid-Arguments.Rmd +++ b/vignettes/dEploid-Arguments.Rmd @@ -198,8 +198,8 @@ Bibtex record:: year = {2018}, doi = {10.1101/387266}, publisher = {Cold Spring Harbor Laboratory}, - URL = {https://www.biorxiv.org/content/early/2018/08/09/387266}, - eprint = {https://www.biorxiv.org/content/early/2018/08/09/387266.full.pdf}, + URL = {https://www.biorxiv.org/content/10.1101/387266v1}, + eprint = {https://www.biorxiv.org/content/biorxiv/early/2018/08/09/387266.full.pdf}, journal = {bioRxiv} }