Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 2.77 KB

5.discordance_analyses.md

File metadata and controls

60 lines (44 loc) · 2.77 KB

Discordance analyses between species tree and gene trees

Majority Rule Consensus Tree (RAxML)

Using the gene trees generated for the ASTRAL analysis, I used RAxML to generate a Majority Rule Consensus Tree that will also have a Tree Certainty score and Internode Certainty (IC) and Internode Certainty All (ICA) on all nodes (these statistics are defined in Salichos et al 2014).

raxmlHPC-PTHREADS -L MRE -z gene_trees_TCs5.tree -m GTRGAMMA -n gene_trees_TCs5.tree

Robinson-Foulds normalized distances (RF)

I calculated Robinson-Foulds normalized distances (Robinson & Foulds 1981) between the species tree and autosomes and X chromosome gene trees and pairwise among all gene trees. The R package phangorn is very useful for this.

Since the gene trees have branches for each individual, I made the calculations against the ASTRAL "lineage" tree, where you don't assign species to individuals.

Here is the R code that I have used.

library(phangorn)

# Read gene trees.
trees<-read.tree("gene_trees_TCs5.tree")
# Calculate pairwise distance between the trees using RF.dist()
pairwise_RF_dist<-RF.dist(trees,normalize=T)


# Read chromosome X gene trees.
chr_x_trees<-read.tree("chr_X_bestTrees_TCs5.txt")
# Read autosome gene trees.
chr_auto_trees<-read.tree("autoss_gene_trees_TCs5.txt")
# Read the species tree.
species_tree<-read.tree("astral5.6.3_lineage_TCs5_gene_trees.tre")
# Unroot this tree.
species_tree_unrooted<-unroot(species_tree)

# Distance between chromosome X gene trees and species tree.
# 1. Create a matrix where you will write your output.
output_chr_x<-matrix(ncol=2,nrow=length(chr_x_trees))
# 2. Loop through the gene trees applying RF.dist()              
for(i in 1:length(chr_x_trees)){
  output_chr_x[i,1]<-i
  output_chr_x[i,2]<-RF.dist(chr_x_trees[i],species_tree_unrooted,normalize=T)
}
  
# Distance between autosomal gene trees and species tree.
# 1. Create a matrix where you will write your output.
output_chr_auto<-matrix(ncol=2,nrow=length(chr_auto_trees))
# 2. Loop through the gene trees applying RF.dist()  
for(i in 1:length(chr_auto_trees)){
  output_chr_auto[i,1]<-i
  output_chr_auto[i,2]<-RF.dist(chr_auto_trees[i],species_tree_unrooted,normalize=T)
}

SplitsTree

To run the splits tree analysis, I used the list of gene trees gene_trees_TCs5.tree generated for the ASTRAL analysis into SplitsTree4. Then, I selected Trees > ConsensusNetworks, and generated a Network using 0.05 threshold and distances as means.

Go back to main page