installation of latest version

531 views
Skip to first unread message

Deo Angelo Macahig

unread,
Jul 15, 2020, 12:56:17 PM7/15/20
to dartR
Hello all,

I'm a fairly new user of the package and I was trying to install the latest version; however I keep on getting this error:

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


I'm not sure if I'm missing a step or something. What should I do? Thank you very much.


Deo

Bernd.Gruber

unread,
Jul 16, 2020, 10:56:31 PM7/16/20
to da...@googlegroups.com

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.

Deo Angelo Macahig

unread,
Jul 17, 2020, 7:56:29 AM7/17/20
to dartR
Hi Bernd,

My sincere gratitude for these very helpful instructions. However, I'm having problems. I've been able to troubleshoot until the installing the vcfR package; however, when I run:
install_github("green-striped-gecko/dartR",ref = "dev" )

I then get this error:
> install_github("green-striped-gecko/dartR", ref = "dev" ) #you can update packages when prompted, but this is not necessary AFAIK Error: Failed to install 'unknown package' from GitHub: Timeout was reached: [api.github.com] Connection timed out after 10001 milliseconds

Any suggestions on how I can troubleshoot this? Thanks.

Deo

Deo Angelo Macahig

unread,
Jul 17, 2020, 11:20:29 AM7/17/20
to dartR
I finally got it to work, I think it was just my internet connection. Thank you!

Deo

Deo Angelo Macahig

unread,
Jul 17, 2020, 4:12:06 PM7/17/20
to dartR
Does gl.outflank not work anymore on the latest version?

Bernd.Gruber

unread,
Jul 19, 2020, 8:10:05 PM7/19/20
to da...@googlegroups.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

Deo Angelo Macahig

unread,
Jul 20, 2020, 3:08:53 AM7/20/20
to dartR
I see, okay :) I just downloaded it straight from Github and run the package as it is in R. I do have another question though; apart from OutFLANK, I'm also doing outlier loci detection via Bayescan and I used the gl2bayescan function to generate the input file. Is it common to get 0 outliers? I've ran it twice already (both taking overnight haha) and I still get the same result = 0 outliers. Is this common or am I doing something wrong? Thanks.

Deo

Deo Angelo Macahig

unread,
Aug 5, 2020, 3:20:33 AM8/5/20
to dartR
Hello, updates on this:

Since I keep on getting 0 outliers from using the bayescan file generated by the gl2bayescan function, I tried to go another route: convert first to structure using gl2structure and then edit the structure file to insert a pop column. I ran this on Bayescan, and I got 67 outliers. Would anybody know why this is the case? Note: I'm not really forcing to get outliers but I was just worried about not getting a single outlier locus. Thank you.

Deo

Deo Angelo Macahig

unread,
Aug 5, 2020, 4:25:38 AM8/5/20
to dartR
Sorry, forgot to mention that I converted the edited Structure file to Bayescan format using PGDSpider.

Deo

René Campbell

unread,
Feb 3, 2021, 8:13:48 PM2/3/21
to dartR
Good morning Deo and Bernd, 

I have come into this conversation late but just wanted to confirm that I also experienced a similar issue with the "gl2bayescan" function in dartR. Like Deo, my gl2baysecan output file ended up generating zero outlier loci after running it with default parameters in BayeScan v2.0 compared to OutFLANK, which generated three outliers. My thesis examiner claimed that it would be unusual for BayeScan to detect zero outliers if OutFlank did detect outliers (FDR = 0.1 in both cases) so I decided to check my analysis again and came across this conversation. 

The dartR version I am using is 1.3.5

My gl2bayescan output file (3512 SNPs, 156 genotypes, 9 populations) appeared to have the same values for all nine populations when generated with the "gl2bayescan" function and generated zero outlier loci. I have attached the gl2bayescan output txt file here under "Carcbayescan_REDO.txt"

Meanwhile I tried what Deo suggested by converting my dataset using the "gl2structure" function in dartR, adding in my population column as usual (1 - 9), then converting my structure file to the GESTE/BayeScan file in PGDSpider 2.1.1.5. Using this method the text output shows that there indeed different values across the nine populations. I have attached that txt file here under "CarcBayescanTest.txt"

When I ran the PGDSpider converted file through BayeScan, I ended up generating 69 outlier loci using the same default parameters.

Is there a possibility the gl2bayescan function is not converting correctly?

Thank you and kind regards, 

Rene

Carcbayescan_REDO.txt
CarcBayescanTest.txt

Jose Luis Mijangos

unread,
Feb 3, 2021, 9:24:56 PM2/3/21
to dartR

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)
}

René Campbell

unread,
Feb 3, 2021, 9:52:07 PM2/3/21
to dartR
Good afternoon Luis, 

Thank you for the prompt response. I installed the function and then generated a bayescan txt output file using bayescan_fix(). I have attached the output file under "Carcbayescan_fix.txt" for your reference.

The output file now appears to match the loci values for each population generated using the PGDSpider method, except that the populations are a different order. I did notice that your bayescan_fix output has population names (i.e. Sweden, SouthAustralia etc.) instead of numbers generated by the PGDSpider method (1 - 9).

When I run your output file in BayeScan the following error appears
"Access violation at address 00418F0F in module 'BayeScan2.1_win32bits_GUI.exe'. Write of address 034EDA08."

I then edited the bayescan_fix output text file to have numbers for the populations instead of popnames (edited file attached under "Carcbayescan_fix_popnumber.txt"). This then worked in BayeScan, so it appears as though it won't run if population names end up in the output.

I will run BayeScan through to confirm that your fix also generates outlier loci.

Thanks for your assistance!

Rene
Carcbayescan_fix_popnumber.txt
Carcbayescan_fix.txt

René Campbell

unread,
Feb 4, 2021, 4:11:09 AM2/4/21
to dartR
Good evening Luis, 

As an update, BayeScan finished running with the bayescan_fix input file (with the population names converted to numbers). It worked! Like the PGDSpider file, it produced the same 69 outlier loci.

I think if the bayescan_fix function converts the population names to numbers it should sort out the issues.

Thanks!

Rene

On Thursday, February 4, 2021 at 12:54:56 PM UTC+10:30 luis.m...@gmail.com wrote:

Jose Luis Mijangos

unread,
Feb 4, 2021, 5:55:55 PM2/4/21
to dartR

Hi Rene,

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

gl2bayescan_fix.txt

René Campbell

unread,
Feb 4, 2021, 8:54:34 PM2/4/21
to dartR
Dear Luis, 

You have been a fantastic help. I have loaded the latest version of the function and can confirm this fixes the issue with populations converted to numbers, and also runs properly in Bayescan. I think the issue is now resolved completely!

Kind regards, 

Rene

Reply all
Reply to author
Forward
0 new messages