diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 95397d8..3dc23bf 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 2.1.10 -Date: 2023-01-25 22:44:37 UTC -SHA: 67d986732c578ff8f65884b4ca622c39f36da995 +Version: 2.1.11 +Date: 2025-02-06 21:23:37 UTC +SHA: 43a3b10c137ff05d1282f44eeab5d25418a7f841 diff --git a/ChangeLog b/ChangeLog index 46b6c7b..e87678c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,16 @@ BUG FIX - genlight objects subset without any arguments to loci no longer gain an extra byte. (reported: @maxecoulter, #363) +- internal C functions `bytesToInt()` and `bytesToDouble()` have a new + condition to prevent overflows (thanks for the suggested fix by Ivan Krylov) + +MISC + +- `spca_randtest()` has been updated with a new p argument to include a + Bonferroni correction (fixed in #368, but initially implemented by @valemon + in #247) +- `find.clust()` data frame method now sets `scale = FALSE` to align with the + other methods. (reported: @cassondranewman, #362; fixed: @tiagomaie, #366) CHANGES IN ADEGENET VERSION 2.1.10 diff --git a/DESCRIPTION b/DESCRIPTION index 8486086..048b820 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -70,6 +70,9 @@ Authors@R: comment = c(ORCID = "0000-0003-3823-0373")), person(given = "Max", family = "Coulter", + role = "ctb"), + person(given = "Ivan", + family = "Krylov", role = "ctb") ) Description: Toolset for the exploration of genetic and genomic diff --git a/NAMESPACE b/NAMESPACE index 9628ab6..3eae3c0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -47,8 +47,6 @@ S3method(gengraph,genpop) S3method(gengraph,matrix) S3method(get.likelihood,seqTrack) S3method(graphMutations,DNAbin) -S3method(is,genind) -S3method(is,genpop) S3method(labels,haploGen) S3method(loadingplot,default) S3method(loadingplot,glPca) @@ -70,7 +68,6 @@ S3method(print,haploGen) S3method(print,monmonier) S3method(print,spca) S3method(rbind,genlight) -S3method(sample,haploGen) S3method(scatter,dapc) S3method(scatter,glPca) S3method(screeplot,spca) @@ -128,6 +125,8 @@ export(genind2genpop) export(genpop) export(hier) export(hybridize) +export(is.genind) +export(is.genpop) export(loadingplot) export(makefreq) export(minorAllele) @@ -142,6 +141,7 @@ export(read.genetix) export(read.snp) export(read.structure) export(repool) +export(sample.haploGen) export(scaleGen) export(seqTrack) export(setPop) diff --git a/R/basicMethods.R b/R/basicMethods.R index f19b59f..ba05ba3 100644 --- a/R/basicMethods.R +++ b/R/basicMethods.R @@ -543,14 +543,12 @@ print.genpopSummary <- function(x, ...){ ############### # Methods "is" ############### -#' @method is genind #' @export is.genind <- function(x){ res <- ( is(x, "genind") & validObject(x)) return(res) } -#' @method is genpop #' @export is.genpop <- function(x){ res <- ( is(x, "genpop") & validObject(x)) diff --git a/R/haploGen.R b/R/haploGen.R index 2f7ee48..e5b2dbc 100644 --- a/R/haploGen.R +++ b/R/haploGen.R @@ -526,7 +526,6 @@ plotHaploGen <- function(x, annot=FALSE, date.range=NULL, col=NULL, bg="grey", a ################### ## sample.haploGen ################### -#' @method sample haploGen #' @export sample.haploGen <- function(x, n){ ##sample.haploGen <- function(x, n, rDate=.rTimeSeq, arg.rDate=NULL){ diff --git a/R/import.R b/R/import.R index 96aafde..74d9e9c 100644 --- a/R/import.R +++ b/R/import.R @@ -62,7 +62,7 @@ #' for your samples. This is especially useful if you have a hierarchical or #' factorial sampling design. #' @param hierarchy a hierarchical formula that explicitely defines hierarchical -#' levels in your strata. see \code{\link{hierarchy}} for details. +#' levels in your strata. #' @param check.ploidy a boolean indicating if the ploidy should be checked (TRUE, #' default) or not (FALSE). Not checking the ploidy makes the import much faster, #' but might result in bugs/problems if the input file is misread or the ploidy is diff --git a/R/strataMethods.R b/R/strataMethods.R index d13032a..600e410 100644 --- a/R/strataMethods.R +++ b/R/strataMethods.R @@ -216,7 +216,7 @@ #' levels of the strata. An example of a hierarchical formula would #' be:\tabular{r}{ \code{~Country/City/Neighborhood}} This convention was #' chosen as it becomes easier to type and makes intuitive sense when defining -#' a \code{\link{hierarchy}}. Note: it is important to use hiearchical +#' a hierarchy. Note: it is important to use hiearchical #' formulas when specifying hierarchies as other types of formulas (eg. #' \code{~Country*City*Neighborhood}) will give incorrect results.} #' diff --git a/cran-comments.md b/cran-comments.md index 0956d95..31e39db 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1 +1 @@ -This update fixes an error thrown by LLVM in C23 mode by removing the `typedef short bool` definition in `snpbin.h` +This fixes a buffer overflow that was negatively affecting dartR.base diff --git a/docker/testing/Dockerfile b/docker/testing/Dockerfile index 32c263c..75e584f 100644 --- a/docker/testing/Dockerfile +++ b/docker/testing/Dockerfile @@ -1,9 +1,9 @@ -FROM rocker/drd +FROM rocker/r-devel-san MAINTAINER Thibaut Jombart RUN apt-get update && apt-get upgrade -y -RUN apt-get install libssl-dev libxml2-dev pandoc pandoc-citeproc libblas-dev liblapack-dev git qpdf -y +RUN apt-get install -y libcurl4-openssl-dev libssl-dev libfontconfig1-dev libxml2-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev gdal-bin proj-bin libgdal-dev libproj-dev libgmp3-dev jags libfftw3-dev ## add guest user @@ -15,35 +15,24 @@ RUN chmod a+rw /usr/local/lib/R/site-library -R ## install CRAN packages -RUN echo 'options(download.file.method = "libcurl", repos = c(CRAN = "https://cran.ma.imperial.ac.uk"))' > ~/.Rprofile +# RUN echo 'options(download.file.method = "libcurl", repos = c(CRAN = "https://cran.ma.imperial.ac.uk"))' > ~/.Rprofile RUN r -e "install.packages('devtools')" \ - && r -e "install.packages('roxygen2')" \ - && r -e "install.packages('testthat')" \ - && r -e "install.packages('rmarkdown')" \ - && r -e "install.packages('adegenet', dependencies = c('Depends', 'Imports'))" \ - && r -e "install.packages('pegas')" \ - && r -e "install.packages('hierfstat')" \ - && r -e "install.packages('poppr')" \ - && r -e "install.packages('akima')" \ - && r -e "install.packages('maps')" \ - && r -e "install.packages('splancs')" \ - && r -e "install.packages('tripack')" + && r -e "install.packages('adegenet', dependencies = TRUE)" - - -## install devel packages (github) - -RUN r -e "devtools::install_github('thibautjombart/adegenet')" +RUN r -e 'install.packages("BiocManager")' \ + && r -e 'BiocManager::install("SNPRelate")' \ + && r -e 'install.packages("dartR.base")' ## clone repos to get sources +RUN apt-get install -y git RUN su guest RUN mkdir ~/dev WORKDIR /home/guest/dev -RUN git clone https://github.com/thibautjombart/adegenet +COPY . . WORKDIR /home/guest/ -RUN ls='ls --color=auto' +CMD Rscript -e 'library(dartR.base); gl.pcoa(testset.gl)' diff --git a/inst/CITATION b/inst/CITATION index 55baadc..31f9109 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -1,7 +1,7 @@ citHeader("To cite the adegenet package:") -citEntry( -entry="Article", +bibentry( +bibtype="Article", title = "adegenet: a R package for the multivariate analysis of genetic markers", journal= "Bioinformatics", year = "2008", @@ -13,8 +13,8 @@ textVersion = "Jombart, T. (2008) adegenet: a R package for the multivariate ana ) -citEntry( -entry="Article", +bibentry( +bibtype="Article", title = "adegenet 1.3-1: new tools for the analysis of genome-wide SNP data", journal= "Bioinformatics", year = "2011", diff --git a/man/auxil.Rd b/man/auxil.Rd index 6f043fd..f67dedb 100644 --- a/man/auxil.Rd +++ b/man/auxil.Rd @@ -5,6 +5,7 @@ \alias{.rmspaces} \alias{.genlab} \alias{.readExt} +\alias{.render.server.info} \alias{corner} \alias{num2col} \alias{fac2col} @@ -50,6 +51,7 @@ \item \code{.rmspaces}: remove peripheric spaces in a character string. \item \code{.genlab}: generate labels in a correct alphanumeric ordering. \item \code{.readExt}: read the extension of a given file. + \item \code{.render.server.info} used to display session information for the dapcServer } Color palettes include: diff --git a/man/df2genind.Rd b/man/df2genind.Rd index ef239aa..3af8558 100644 --- a/man/df2genind.Rd +++ b/man/df2genind.Rd @@ -52,7 +52,7 @@ for your samples. This is especially useful if you have a hierarchical or factorial sampling design.} \item{hierarchy}{a hierarchical formula that explicitely defines hierarchical -levels in your strata. see \code{\link{hierarchy}} for details.} +levels in your strata.} \item{check.ploidy}{a boolean indicating if the ploidy should be checked (TRUE, default) or not (FALSE). Not checking the ploidy makes the import much faster, diff --git a/man/pairDist.Rd b/man/pairDist.Rd index 1d21177..092a140 100644 --- a/man/pairDist.Rd +++ b/man/pairDist.Rd @@ -45,7 +45,7 @@ pairDistPlot(x, \dots) object. For \code{\linkS4class{genind}} objects, pairwise squared Euclidean distances are computed from the allele data. For \code{DNAbin} objects, distances are computed uing - \code{\link{dist.dna}}, and '...' is used to pass arguments to the + \code{dist.dna}, and '...' is used to pass arguments to the function. } \item{grp}{a factor defining a grouping of individuals.} diff --git a/man/strata-methods.Rd b/man/strata-methods.Rd index 11d7510..e6980fa 100644 --- a/man/strata-methods.Rd +++ b/man/strata-methods.Rd @@ -110,7 +110,7 @@ or genlight object. levels of the strata. An example of a hierarchical formula would be:\tabular{r}{ \code{~Country/City/Neighborhood}} This convention was chosen as it becomes easier to type and makes intuitive sense when defining - a \code{\link{hierarchy}}. Note: it is important to use hiearchical + a hierarchy. Note: it is important to use hiearchical formulas when specifying hierarchies as other types of formulas (eg. \code{~Country*City*Neighborhood}) will give incorrect results.} } diff --git a/src/snpbin.c b/src/snpbin.c index 4beab92..94f6707 100644 --- a/src/snpbin.c +++ b/src/snpbin.c @@ -146,11 +146,11 @@ void bytesToBinInt(unsigned char *vecbytes, int *vecsize, int *vecres){ temp = (int *) calloc(8, sizeof(int)); for(i=0;i<*vecsize;i++){ - byteToBinInt(vecbytes[i], temp); - for(j=0;j<=7;j++){ - vecres[j+idres] = temp[j]; - } - idres = idres + 8; + byteToBinInt(vecbytes[i], temp); + for(j=0;j<=7;j++){ + vecres[j+idres] = temp[j]; + } + idres = idres + 8; } free(temp); @@ -186,19 +186,20 @@ void bytesToInt(unsigned char *vecbytes, int *veclength, int *nbvec, int *vecres /* initialize result vector to 0 */ for(i=0; i < *reslength; i++){ - vecres[i]=0; + vecres[i]=0; } /* build output */ for(k=0;k<*nbvec;k++){ /* for all input vector */ - idres = 0; - for(i=0;i<*veclength;i++){ /* for one input vector */ - byteToBinInt(vecbytes[i+ k* *veclength], temp); /* byte -> 8 int (0/1)*/ - for(j=0;j<=7;j++){ /* fill in the result*/ - vecres[j+idres] += temp[j]; - } - idres = idres + 8; - } + idres = 0; + for(i=0;i<*veclength;i++){ /* for one input vector */ + byteToBinInt(vecbytes[i+ k* *veclength], temp); /* byte -> 8 int (0/1)*/ + for(j=0;j<=7;j++){ /* fill in the result*/ + if (j+idres >= *reslength) break; // do not decode padding bytes + vecres[j+idres] += temp[j]; + } + idres = idres + 8; + } } free(temp); } /* end bytesToInt */ @@ -214,18 +215,19 @@ void bytesToDouble(unsigned char *vecbytes, int *veclength, int *nbvec, double * /* initialize result vector to 0 */ for(i=0; i < *reslength; i++){ - vecres[i]=0.0; + vecres[i]=0.0; } for(k=0;k<*nbvec;k++){ /* for all input vector */ - idres = 0; - for(i=0;i<*veclength;i++){ /* for one input vector */ - byteToBinDouble(vecbytes[i+ k* *veclength], temp); /* byte -> 8 double (0/1)*/ - for(j=0;j<=7;j++){ /* fill in the result*/ - vecres[j+idres] += temp[j]; - } - idres = idres + 8; - } + idres = 0; + for(i=0;i<*veclength;i++){ /* for one input vector */ + byteToBinDouble(vecbytes[i+ k* *veclength], temp); /* byte -> 8 double (0/1)*/ + for(j=0;j<=7;j++){ /* fill in the result*/ + if (j+idres >= *reslength) break; // do not decode padding bytes + vecres[j+idres] += temp[j]; + } + idres = idres + 8; + } } free(temp); } /* end bytesToInt */