

### AMAS (alignment satistics and filtering for most informative loci)

# input: alignment in nexus format
python3 /path/to/AMAS.py summary -o summary.txt -c 24 -i infile.nexus -f nexus -d dna



### PartitionFinder2 (alignment partitioning scheme)

# input: alignment in phylip format (in in_out_dir), config file (in in_out_dir)
python2 /path/to/PartitionFinder.py --raxml --rcluster-percent=5  --rcluster-max=100 --quick /in_out_dir



### ExaBayes (Bayesian phylogeny)

# input: alignment in phylip format, partition file (optional), config file
exabayes -m DNA -f infile.phylip -M 2 -s 12345 -q partitions.txt -n perUCE_noOut -c exabayes.conf



#### RAxML (Maximum Likelihood phylogeny)

# input: alignment in phylip format, partition file (optional)
raxmlHPC-MPI-AVX -f a -m GTRGAMMA -q partitions.txt -p 12345 -x 12345 -N 200 -s infile.phylip -n UCE_noOut



### ASTRAL (species tree from individual genetrees) 

# step 1: genetrees with IQTREE, input: phylip alignment files (1 for each UCE locus) in current directory 
for i in *.phylip; do /path/to/iqtree2 -s $i -B 1000 -alrt 1000 -T AUTO --threads-max 16 -mem 16G; done

# step 2: ASTRAL, input: concatenated trees from IQTREE
java -Xmx8000M -jar /path/to/astral.5.7.3.jar -i iqtrees.tre -o ASTRAL_output.tre 2> ASTRAL.log



### SVDQuartets (species tree from species quartets)

# step 1: run PAUP, input: alignment in nexus format
		begin paup;
		exe infile.nexus;
		log file=PAUP.log start;
		svdq seed=12345 bootstrap nreps=100 treeFile=SVDQ_bs_trees.nexus nthreads=24;
		savetrees file=SVDQ_unpartitioned_noOut.nexus;
		log stop;
		end;
		q;

# step 2: summarize trees with ASTRAL, input SVDQuartets trees in newick format
java -jar /path/to/astral.5.7.3.jar -i SVDq_bstrees.newick -o SVDQ_ASTRAL_summary.newick 2> ASTRAL.log



### RootDigger (root positions estimation)

# input: alignment in phylip format, tree file in newick format
rd --msa infile.phylip --tree intree.tre --threads 24 --exhaustive

### IQTREE (Topology Tests)

# input: alignment in phylip format, concatenated file of tree topologies in newick format
/path/to/iqtree2 -s infile.phylip -z treefiles.newick -n 0 -zb 10000 -zw -au -T 8 -mem 16G



### SortaDate (Filtering for most clock-like loci)

# step 1: get root-to-tip variance, input: individual genetrees (file extension ".iqtree.tre.rr")
python /path/to/SortaDate/src/get_var_length.py --flend .iqtree.tre.rr --outf var.txt in_dir/

# step 2: get bipartition support, input: individual genetrees (file extension ".iqtree.tre.rr"), ultrametric species tree
python /path/to/SortaDate/src/get_bp_genetrees.py --flend .iqtree.tre.rr --outf bp.txt in_dir/ infile.tre 

# step 3: combine results, input: var.txt and bp.txt from steps 1 & 2 
python /path/to/SortaDate/src/combine_results.py --outf comb.txt var.txt bp.txt 

# step 4: sort + get list of good genes, input: combined results from step 3 
python /path/to/SortaDate/src/get_good_genes.py --max 10 --outf gg.txt comb_no_NA.txt



### BEAST2 (Divergence time estimation) 

# step 1: run BEAST2, input: xml file created with BEAUti (run several runs, also without data = sampling from prior) 
beast -threads 16 -beagle_SSE -overwrite infile.xml

# step 2: combine and subsample trees from different runs with LogCombiner, input: tree files in nexus format
logcombiner -b 10 -resample 50000 -log infile1.trees -log infile2.trees -log infile3.trees -log infile4.trees -o outfile_20p.trees

# step 3:  summarize trees with TreeAnnotator, input: subsampled trees in nexus format
treeannotator -heights mean -lowMem outfile_20p.trees out_MCC.nex

# step 4: combine all MCC trees from different analyses (most informative, most clock-like, and random loci) in R, input: MCC trees in nexus format
rscript beast_summary.r

# step 5: plot combined tree with geological time scale in R, input: mean age consensus tree in nexus format
rscript add_geological_scale_to_tree.r



### BioGeoBEARS (ancestral area reconstruction)

# step 1: run BioGeoBEARS in R, input: ultrametric tree in newick format, distribution data per tip/region (optional for M1 model: timeperiods and dispersal multipliers)
rscript BioGEOBEARS_script_HymData_M1.R

# step 2: calculate and export likelihood for each model in R, input: Rdata file for each model, ultrametric tree in newick format, distribution data per tip/region
rscript BioGEOBEARS_script_HymData_stats.R

# step 3: calculate and export probability of occupancy per area for each tip/node in R in R, input: Rdata file for each model, ultrametric tree in newick format, distribution data per tip/region
rscript BioGEOBEARS_script_HymData_plots.R

# step 4: plot per area probability on tree (pie chart on nodes, bar chart on tips) in R, input: ultrametric tree in newick format, per area probability per node/tip as csv
rscript plot_charts_on_tree.r
