Fixes CRAN build warnings and notes
Fixes bug in arSample function where c++ code was being called using Rcpp::sourceCpp
Introduces custom confidence limit calculation. User defined alpha level is now used in diffCalc.
Testing new significance testing in divMigrate-online
haploDiv had a bug which prevented it from using fastDivPart correctly. Fixed.
divMigrateOnline now returns actual estimates for Nm using Alcala et al. (2014)
gpSampler returns the original sample for any samples with < samp_size, rather than throwing an error.
Bug fix in gpSampler. Function failed when passing vector to samp_size.
Bug in snp2gen when writing genepop file from a SNP dataframe. (reported by Mark Ravinet)
Bootstrapping available in divSimCo
User defined alpha for divMigrateOnline function.
Fixes a bug, which caused an unnecessary warning message to be printed to the console when using fastDivPart without xlsx package being installed.
Introduces divSimCo for calculating Kosman and Leonard, (2005) similarity coefficients.
Deals with relative paths in snp2gen function.
Introduces bootstrapping across loci in diffCalc
Fixed a bug in diffCalc pairwise Fst calculations. This stemmed from the fix added in v1.9.9.49.
hsum <- lapply(hsum, function(x){
x[!(names(x) == "NA")]
})
hsum <- lapply(hsum, function(x){
x <- lapply(x, function(y){
y <- y[!(names(y) == "NA")]
return(y)
})
})
The corplot function as been revamped to make use of ggplot2 graphics.
diffCalc crashed when some loci had 100% missing data. The problem function was glbWCcpp. This version deals with this bug. Extensive testing of the fix is still required and will be carried out for v1.9.9.50
divBasic now returns mainTab as a list of dataframes, rather than a character matrix. The function needs a lot of work in terms of speed when calculating $F_{IS}$ and $A_{R}$.
Users can now choose whether to write the genepop object generated by snp2gen to file, or just return it to the workspace for use in other diveRsity functions (suggestion from Mark Ravinet).
New chiCalc function with new output structure and pairwise calculations. P Values are now calculated using fisher.test rather than chisq.test.
Exact tests of HWE added in divBasic function
Added updates for divMigrate-online.
Fixes a bug in pairwise in calculations in inFunc. The following line of code resulted in a vector for pairwise populations that were fixed for the same allele, when a matrix was expected by downstream code.
y <- y[rowSums(y) != 0,]
By deleting this line, the code downstream generates NAN values, which are now summed using na.rm = TRUE.
Fixes a bug in pairwise D (Jost, 2008) calculation.
Added a faster C++ version of tabMergePw for pairwise hsum calculation.
Added a faster C++ version of tabMerge function
Fixes a memory leak by managing parallel cluster in a more appropriate way.
Speed up gpSampler function by keeping data as character strings, since this is the only data structure required.
Also adds a bug fix to fastScan function. Some files (e.g. EASYPOP output .gen files) have "\r\n" file endings. when replacing "\r" with "\n" in these files, lines ended with "\n\n" meaning blank lines between each real line. The code below fixes this:
fastScan <- function(fname) {
s <- file.info(fname)$size
buf <- readChar(fname, s, useBytes = TRUE)
# replace Mac encoded line endings
if(grep("\r", buf) == 1L){
buf <- gsub("\r", "\n", buf)
buf <- gsub("\n\n", "\n", buf)
}
return(strsplit(buf, "\n", fixed = TRUE, useBytes = TRUE)[[1]])
}
Fixed a bug in the fastScan function which did not recognise "\r" as a line ending.
fastScan <- function(fname) {
s <- file.info(fname)$size
buf <- readChar(fname, s, useBytes = TRUE)
return(strsplit(buf, "\n", fixed = TRUE, useBytes = TRUE)[[1]])
}
fastScan <- function(fname) {
s <- file.info(fname)$size
buf <- readChar(fname, s, useBytes = TRUE)
# replace Mac encoded line endings
if(grep("\r", buf) == 1L){
buf <- gsub("\r", "\n", buf)
}
return(strsplit(buf, "\n", fixed = TRUE, useBytes = TRUE)[[1]])
}
This new version of the function checks to see if "\r" is a character present in the file, then replaces these with "\n" so that the downstream functions work normally.
Multilocus gst and nm values for directional migration were not behaving as expected, when dealing with 100% missing data. The below code was added to indicate loci with 100% missing data:
# fix allele frequencies
dat$af <- lapply(dat$af, function(x){
cs <- colSums(x)
x[,cs == 0] <- NA
return(x)
})
These loci can now be identified in 'pwHt' and NA returned, instead of NaN, as was previously occurring. This previous behavior resulted in NaN values derived from 100% missing data being treated in the same way as NaN values derived from two population samples not sharing any alleles, which was obviously incorrect.
Bug fixed in check function within rgp to ensure allele names were recorded correctly.
check <- function(args){
#args <- list(...)
npops <- length(args)
nchars <- mean(nchar(names(args[[1]])))
pad <- paste("%0", nchars, "g", sep = "")
rnames <- sprintf(pad,
unique(sort(as.numeric(unlist(lapply(args,
names))))))
out <- matrix(0, nrow = length(rnames), ncol = npops)
rownames(out) <- as.character(rnames)
for(i in 1:npops){
out[match(names(args[[i]]), rownames(out)),i] <- as.numeric(args[[i]])
}
return(out)
}
check <- function(args, gp){
#args <- list(...)
npops <- length(args)
pad <- paste("%0", gp, "g", sep = "")
rnames <- sprintf(pad,
unique(sort(as.numeric(unlist(lapply(args,
names))))))
out <- matrix(0, nrow = length(rnames), ncol = npops)
rownames(out) <- as.character(rnames)
for(i in 1:npops){
out[match(names(args[[i]]), rownames(out)),i] <- as.numeric(args[[i]])
}
return(out)
}
Bug fixed in 'rgp' function to correctly deal with leading whitespace in sample names.
Alcala et al, 2014 Nm estimation is added to divMigrate as a option to calculation relative migration. Gst is also added.
Meirmans & Hedrick, (2011) $G''_{ST}$ added to diffCalc. The statistic is calculated for all available levels of genetic integration.
Bug fix in internal function, rgp, allowing horizontal locus names in input file.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.