---
title: "Installing Species Delimitation Softwares"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Installing Species Delimitation Softwares}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

The main purpose of `delimtools` is to provide helper functions for analyzing single locus species delimitation outputs. To generate this type of data, it is necessary to install third-party software and use the appropriate `*_tbl()` functions to parse these results in a tabular format.

<br>

```{r, echo= FALSE}

tbls <- tibble::tibble(Function= paste0(c("abgd", "asap", "bgmyc", "gmyc", "locmin", "mptp"), "_tbl()"),
                       Software= c("ABGD", "ASAP", "bGMYC", "splits", "spider", "mptp"),
                       Language= c("C", "C", "R", "R" , "R", "C"),
                       Source= c("https://bioinfo.mnhn.fr/abi/public/abgd/abgdweb.html",
                                 "https://bioinfo.mnhn.fr/abi/public/asap/",
                                 "https://nreid.github.io/software/",
                                 "https://splits.r-forge.r-project.org/",
                                 "https://github.com/boopsboops/spider",
                                 "https://github.com/Pas-Kapli/mptp"))
knitr::kable(tbls, align = "llcl")

```

## Install R packages 

### spider

Although some of the listed software above are written using R language, only the `spider` package is available on CRAN, and its installation is straightforward:

```{r, eval= FALSE}
install.packages("spider")

```

### splits

The `splits` package can be installed using R-Forge repository. Set `dependencies = TRUE` to install `paran` 
package. 

```{r, eval= FALSE}
install.packages("splits", repos = "http://R-Forge.R-project.org", dependencies = TRUE)

```

### bGMYC

Although the `bGMYC` package can be installed from Noah Reid's GitHub page, we recommend installing it from 
our [drat repository](https://github.com/pedrosenna/drat) since our version is stable when using `R >= 4.x.x`. When running the "older" `bGMYC` version using `R >= 4.x.x`, all tips of the ultrametric tree are classified as distinct lineages. Thus, install the "stable" version by using `devtools` or by downloading the tarball and installing it manually:

```{r, eval= FALSE}
install.packages("bGMYC", repos = "https://pedrosenna.github.io/drat/")

```

## Install C softwares

The instructions below are to compile `ABGD`, `ASAP`, and `mPTP` in Unix systems. If you are a Windows user, 
you can try to use a C compiler to create executable files for these software but we do not guarantee it will
work as intended. Alternativelly, you may use the currently available Web servers of these software to generate 
results and import them using its respective `*_tbl()` functions.

## ABGD

To install `ABGD`, download latest release, decompress and compile. Optionally, you may add the
folder to your PATH environment variable or move it to `/usr/local/bin`.
```{bash, eval= FALSE, engine= "sh"}
wget https://bioinfo.mnhn.fr/abi/public/abgd/last.tgz -O abgd.tgz
tar -xzvf abgd.tgz
cd Abgd
make
mkdir bin
mv abgd bin/abgd
cd ..

```

## ASAP
To install `ASAP`, download latest release, decompress and compile. Optionally, you may add the
folder to your PATH environment variable or move it to `/usr/local/bin`.
```{bash, eval= FALSE, engine= "sh"}
wget https://bioinfo.mnhn.fr/abi/public/asap/last.tgz
tar -xzvf last.tgz
cd ASAP
make
mkdir bin
mv asap bin/asap
cd ..

```

## mPTP
To install `mPTP`, you can check [mPTP repository](https://github.com/Pas-Kapli/mptp) and follow their
instructions.