---
# System prepended metadata

title: Hybridization Tests .\.
tags: [HybSeq]

---

---
Title: Hybridization Tests
breaks: false
###### tags:`HybSeq` `Hybridization Analyses`
author: Dylan Cohen
---

Various software and programs that I have explored and used to uncover hybridization in *Amsonia*, Oaks, Juglans, and Magnolia

# Outline

1. HyDe - https://github.com/pblischak/HyDe (Phylogenetic invariants)
2. DSuite - https://github.com/millanek/Dsuite (ABBA-BABA and D-Statistics)
3. SNaQ - https://github.com/JuliaPhylo/PhyloNetworks.jl (Maximum pesudolikelihood estimation of **species network**)
4. PhyNest - https://github.com/sungsik-kong/PhyNEST.jl (Similar to SNaQ)
5. Pyghdet - https://github.com/rhaque62/pyghdet
6. HybPhaser -https://github.com/LarsNauheimer/HybPhaser
---
1. HyDe
-I installed HyDe into a conda env
-Run HyDe on concatenated (all genes in one file) aligned dataset
-There are a few different ways to concatenate hybseq loci - hybpiper has a python script called fasta_merge and then a program AMAS can also concatenate samples. I have used both and the hypiper script more.
AMAS github (https://github.com/marekborowiec/AMAS)
```
AMAS.py convert -d dna -f fasta -i updated_msa.fasta -u phylip
```
Really want to maxmize the data you have for hyDe

-I installed it into the same conda env as hybpiper
-HyDe needs the input file to be in phylip format and sequential, AMAS can do this
-HyDe also needs a map file

Example map:
```
Dr_Merrill4327_S36	loebner
L_chinense	tulip
MS-AA-01_S168   stellata
MS-ABG-02_S173  stellata
MS-ABG-03_S171  stellata
MS-ABG-05_S174  stellata
MS-ABG-06_S170  stellata
MS-AW-01_S175   stellata
MS-AW-02_S172   stellata
MS-AW-04_S177   stellata
```
Each sample name is associated to a species

Here is code I used to run the first part of hyde:
```
run_hyde.py -i mag_cleaned.phy -m map2.txt -o tulip  -n 231 -t 19 -s 741883
```
i -> input phylip file
-m -> map file
-o -> designate an outgroup
-n -> the number of samples
-t -> the number of taxa (species)
-s -> the number of sites in phylip (should say it in phylip header)





---
2. DSuite
---
3. SNaQ 

SNaQ is run on a computer language called julia which is available on quest. To run SNaQ you need either a) a list of **unrooted** gene trees (RAxML/IQtree/MyBayes) **OR** a table of concordance factors (CF) likley from BUCKy **AND** a starting topology (Astral Species tree/Quartet Maxcut/single gene tree)

I did not use BUCKy to create the CF - I created CF from my gene trees (see here for details using multiple tips per species: https://juliaphylo.github.io/PhyloNetworks.jl/dev/man/multiplealleles/)








