Error: Failed to install 'dartR' from GitHub:
(converted from warning) installation of package ‘C:/Users/Deo Angelo/AppData/Local/Temp/RtmpGajmhY/file27946ae43977/dartR_1.5.5.tar.gz’ had non-zero exit status
Hi Deo,
Sorry for this. The reason for this failure is that about a week or so ago vcfR (another package) that we use to import vcf files is not longer on CRAN and therefore the installation breaks. The authors of this package have submitted a new version of vcfR recently and seem to working on a fix for their package. So this should resolve itself soon.
In the interim I suggest the following. Download an older version of vcfR and compile it yourself. This unfortunately needs you to download rtools for your R version (if you use the latest R (4.0) you find it here (otherwise follow the link on the page): https://cran.r-project.org/bin/windows/Rtools/. Good news if you are on a mac and the latest R version you do not need to use Rtools (should be already on your system).
Then run the following code (please be aware you need to download the vcfR tar.gz first and provide the path to that file in the code where it says yourpath:
install.packages("devtools")
library(devtools)
install.packages("BiocManager")
BiocManager::install(c("SNPRelate", "qvalue"))
#because vcfR is no longer available on Cran
install.packages("pinfsc50")
install.packages("memuse")
#install Rtools to be able to compile the vcfR package (previous version)
#download vcfR_1.11.0.tar.gz from Cran archive: https://cran.r-project.org/src/contrib/Archive/vcfR/
install.packages("c:/yourpath/vcfR_1.11.0.tar.gz", repos = NULL, type = "source", dependencies = TRUE)
#install version 1.5.5 (dev)
install_github("green-striped-gecko/dartR",ref = "dev" ) #you can update packages when prompted, but this is not necessary AFAIK
library(dartR)
As mentioned above this should not be necessary for long (as vcfR hopefully will be available soon again on CRAN).
--
You received this message because you are subscribed to the Google Groups "dartR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
dartr+un...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dartr/a17c11a0-3df0-4c71-a58e-832ce5edd9c0o%40googlegroups.com.
Hi Deo,
Sorry you are correct, somehow the outflank function is currently not properly implemented in dartr (must have somehow dropped). I am about to work on a revision and will look into this. Until then unfortunately please use the earlier version (CranVersion 1.11 to run outflank).
Cheers, Bernd
To view this discussion on the web visit https://groups.google.com/d/msgid/dartr/feac3d32-fe1b-4c76-88ff-48ad70eae492n%40googlegroups.com.
Hi Rene,
Could you please test whether the following function solves the problem.
Please let us know whether it worked or not.
Regards,
Luis
gl2bayescan_fix <-
function (x, outfile = "bayescan.txt", outpath = tempdir(), verbose = NULL)
{
funname <- match.call()[[1]]
build <- "Jacob"
outfilespec <- file.path(outpath, outfile)
if (is.null(verbose)) {
if (!is.null(x@other$verbose)) {
verbose <- x@other$verbose
}
else {
verbose <- 2
}
}
if (verbose < 0 | verbose > 5) {
cat(paste(" Warning: Parameter 'verbose' must be an integer between 0 [silent] and 5 [full report], set to 2\n"))
verbose <- 2
}
if (verbose >= 1) {
if (verbose == 5) {
cat("Starting", funname, "[ Build =", build, "]\n")
}
else {
cat("Starting", funname, "\n")
}
}
if (class(x) != "genlight") {
cat(" Fatal Error: genlight object required!\n")
stop("Execution terminated\n")
}
if (verbose >= 2) {
if (all(x@ploidy == 1)) {
stop("Fatal Error: Detected Presence/Absence (SilicoDArT) data. Please provide a SNP dataset\n")
}
else if (all(x@ploidy == 2)) {
cat(" Processing a SNP dataset\n")
}
else {
stop("Fatal Error: Ploidy must be universally 1 (fragment P/A data) or 2 (SNP data)")
}
}
if (verbose >= 2) {
cat(paste("Extacting SNP data and creating records for each individual\n"))
}
mat <- gl.percent.freq(x, verbose = verbose)
mat <- mat[order(mat$popn), ]
#### LINE ADDITION
mat$popn <- as.character(mat$popn)
if (verbose >= 2) {
cat(paste("Writing text input file for Bayescan", outfilespec,
"\n"))
}
sink(outfilespec)
cat(paste0("[loci]=", nLoc(x)), "\n\n")
cat(paste0("[populations]=", nPop(x)), "\n\n")
#### LINE CHANGE
# for (i in 1:nPop(x)) {
for (i in as.character(unique(pop(x)))){
cat(paste0("[pop]=", i), "\n")
#### LINE CHANGE
# popi <- mat[mat$popn == mat$popn[i], ]
popi <- mat[mat$popn == i, ]
for (j in 1:length(popi$popn)) {
cat(j, (2 * popi$nobs[j]), 2, popi$sum[j], (2 * popi$nobs[j] -
popi$sum[j]), "\n")
}
cat("\n")
}
sink()
if (verbose >= 3) {
cat(paste("Records written to", outfilespec, "\n"))
}
if (verbose > 0) {
cat("Completed:", funname, "\n")
}
return(NULL)
}
Thank you very much for your feedback!
Please find attached the last version of the function now with the names of the populations converted to numbers.
Because google groups doesn't allow to send executable files, the attached file has a ".txt" extension. To use this function please save it to your working directory and change the extension of the file to ".R". Then in the command line of R type:
> source(“gl2bayescan_fix.R”)
> test <- gl2bayescan_fix(your_data)
Regards,
Luis