R/bayescan.R

Defines functions bayescan

Documented in bayescan

bayescan <-
function (mat, filename, nbp = 20, pilot = 5000, burn = 50000, exec=NULL) 
{
    sim2bayescan(mat, filename)
    prefix <- c("-nbp", "-pilot", "-burn")
    suffix <- c(nbp, pilot, burn)
    opts <- paste(prefix, suffix, sep = " ", collapse = " ")
       os <- Sys.info()[1]
    if (is.null(exec)) {
        if (os == "Linux") 
            exec= "bayescan_2.1"
        if (os == "Darwin") 
            exec= "bayescan_2.1"
        if (os == "Windows") 
            shortPathName("C:/Program Files/BayeScan2.1/binaries/BayeScan2.1_win32bits_cmd_line.exe")
    }
    
    system(paste(exec, opts, filename))
    out <- paste(filename, "_fst.txt", sep = "")
    if (file.exists(out)==FALSE){
      print("Bayescan_2.1 not found")
      return(NULL)
    } 
    else {
    resultfst <- read.table(out, header = T, row.names = 1)
    result <- resultfst
    result}
}

Try the AFLPsim package in your browser

Any scripts or data that you put into this service are public.

AFLPsim documentation built on May 29, 2017, 11:31 a.m.