## Warning: package 'phytools' was built under R version 3.3.3
## Warning: package 'ape' was built under R version 3.3.3
## Warning: package 'maps' was built under R version 3.3.3
## Warning: package 'phangorn' was built under R version 3.3.3

Molecular tree (week 9)

outgroup <- "S.paradoxus"

#read in the dna alignment from your skull data from last week
  #you'll have to remake it if you didn't save it
aln <- read.phyDat("rodents_alignment.fasta", format="fasta", type="DNA")


#Calculate pairwise distances between sequences.
dm <- dist.ml(aln)

#construct and root tree on the outgroup
treeUPGMA2 <- upgma(dm)
DNAtree <- root(treeUPGMA2, resolve.root = T, outgroup = outgroup)

set.seed(218)

#add tiny random branch lengths to resolve polytomies
DNAtree$edge.length <- DNAtree$edge.length + rexp(length(DNAtree$edge.length), 1/1e-4)
plot(DNAtree, use.edge.length = F)
Figure 1: This is a phylogenetic tree based on DNA sequence information  for cytochrome-B for the five species: S.paradoxus, S.floridanus, S.carolinensis, M.monax, and C.ludovicianus. This tree is rooted by the outgroup S. paradoxus. S. paradoxus was selected as the outgroup in previous work because it resulted in the most parsimonious tree.

Figure 1: This is a phylogenetic tree based on DNA sequence information for cytochrome-B for the five species: S.paradoxus, S.floridanus, S.carolinensis, M.monax, and C.ludovicianus. This tree is rooted by the outgroup S. paradoxus. S. paradoxus was selected as the outgroup in previous work because it resulted in the most parsimonious tree.

#Print the DNAtree object so you can see how the species names are 
  #stored in the .tre file. You will need this info for the next step.
DNAtree
## 
## Phylogenetic tree with 5 tips and 4 internal nodes.
## 
## Tip labels:
## [1] "S.paradoxus"    "S.floridanus"   "S.carolinensis" "M.monax"       
## [5] "C.ludovicianus"
## 
## Rooted; includes branch lengths.

Morphological data (Week 8)

#Enter the morphological character data for the 5 skull 
  #species (change the 0s and 1s to reflect your data). 
  #Edit the 'dimnames'  so the species names exactly match 
  #those in the DNAtree object.

charmat <- matrix(
  c(0, 0, 0, 1, 0,  #S.paradoxus
    1, 1, 1, 0, 0,  #S.floridanus
    1, 1, 0, 0, 1,  #S.carlinensis
    1, 0, 0, 1, 1,  #M.monax
    1, 1, 0, 1, 1), #C.ludovicianus
  nrow = 5, ncol = 5,
  byrow = TRUE,
  
  #Enter species names here, separated by an underscore
  dimnames = list(c('Solenodon_paradoxus', 'Sylvatius_floridanus',
                    'Sciurus_carolinensis','Marmota_monax',
                    'Cynomys_ludovicianus'),
              
              #Enter short character names here
              c('Diastema', 'Auditory Bullae', 'Fenestarted Maxillary',
                'Sagittal Crest', 'Number of Coronoid Processes'))
  ) #<-- don't delete, is corresponds to the first "(" after the word "matrix above"
                              
#Look at the character matrix.
charmat
##                      Diastema Auditory Bullae Fenestarted Maxillary
## Solenodon_paradoxus         0               0                     0
## Sylvatius_floridanus        1               1                     1
## Sciurus_carolinensis        1               1                     0
## Marmota_monax               1               0                     0
## Cynomys_ludovicianus        1               1                     0
##                      Sagittal Crest Number of Coronoid Processes
## Solenodon_paradoxus               1                            0
## Sylvatius_floridanus              0                            0
## Sciurus_carolinensis              0                            1
## Marmota_monax                     1                            1
## Cynomys_ludovicianus              1                            1
#Convert the character matrix to a phyDat object 
  #in order to infer a tree. By assigning the matrix 
  #type as 'user' we can specify the components of the 
  #matrix (in this case, binary 1s and 0s).
skullchars <- as.phyDat(charmat, type="USER", levels = c(0,1))

#Calculate a distance matrix from the character data.
char.dm <- dist.ml(skullchars)

#Use the pratchet function (parsimony ratchet) to find the most
  #parsimonious tree. Specifying k=25 means the algorithm will search   
  #through 25 possible trees to find the most parsimonious solution.
tree <- pratchet(skullchars, k=25, trace = 0)

#print number of changes for best solution under parsimony
parsimony(tree, skullchars)
## [1] 6
#Calculate branch lengths using the distance matrix.
tree <- nnls.phylo(tree, char.dm)

#Plot the tree.
plot.phylo(tree, use.edge.length = F, type = "unrooted")
Figure 2: This is a phylogenetic tree based off of the morphological data for the five species. It is rooted with the same outgroup as before (S. paradoxus). The chracteristics used are: presence of a diastema, inflation/deflation of aurditory bullae, presence of a fenestrated maxillary, presence of a sagittal crest, and the number of coronoid processes (1 or 2). This is the most parsimonious tree when taking into account all the traits.

Figure 2: This is a phylogenetic tree based off of the morphological data for the five species. It is rooted with the same outgroup as before (S. paradoxus). The chracteristics used are: presence of a diastema, inflation/deflation of aurditory bullae, presence of a fenestrated maxillary, presence of a sagittal crest, and the number of coronoid processes (1 or 2). This is the most parsimonious tree when taking into account all the traits.

#Root the tree by the designated outgroup 
  #(write the species name as it appears in the tree, 
  #but add an underscore to fill the space).
chartree <- tree
chartree <- root(tree,outgroup = "Solenodon_paradoxus", resolve.root = T)

#Plot the rooted tree.
plot(chartree, use.edge.length = F)
Figure 2: This is a phylogenetic tree based off of the morphological data for the five species. It is rooted with the same outgroup as before (S. paradoxus). The chracteristics used are: presence of a diastema, inflation/deflation of aurditory bullae, presence of a fenestrated maxillary, presence of a sagittal crest, and the number of coronoid processes (1 or 2). This is the most parsimonious tree when taking into account all the traits.

Figure 2: This is a phylogenetic tree based off of the morphological data for the five species. It is rooted with the same outgroup as before (S. paradoxus). The chracteristics used are: presence of a diastema, inflation/deflation of aurditory bullae, presence of a fenestrated maxillary, presence of a sagittal crest, and the number of coronoid processes (1 or 2). This is the most parsimonious tree when taking into account all the traits.

Plot Molecular and morphological trees

plot(chartree,main='Rooted parsimony character tree', use.edge.length = F)
Figure 3: For the rooted parsimony DNA tree reference figure caption 1 and for the rooted parsimony character tree reference figure caption 2.

Figure 3: For the rooted parsimony DNA tree reference figure caption 1 and for the rooted parsimony character tree reference figure caption 2.

plot(DNAtree,main='Rooted parsimony DNA tree', use.edge.length = F)
Figure 3: For the rooted parsimony DNA tree reference figure caption 1 and for the rooted parsimony character tree reference figure caption 2.

Figure 3: For the rooted parsimony DNA tree reference figure caption 1 and for the rooted parsimony character tree reference figure caption 2.

Map the morphological characters onto the DNA tree to trace their inferred evolutionary histories.

Branch lengths are scaled by genetic differences in these trees - they are still rooted by the outgroup, even if the outgroup appears to share a branch with the closest ingroup species.

#Discrete mapping
#This maps the character in column 4 of the 
  #character matrix. Change the 4 to view the other characters.
plotBranchbyTrait(DNAtree, charmat[,5])
Figure 4: This is a phylogenetic tree based off of the DNA data for the five species. This tree is the most parsimonious when mapping the character trait changes for the character trait 'number of coronoid processes (1 present=0, 2 present=1)'. This figure should show only 1 change on the branch before S.carolinensis from 0 to 1. The three species with 2 coronoid processes present should be S.carolinensis, M.monax, and C.ludovicanus. Unfortunately, the figure does not accurately present the data from the character matrix, possibly as a result of the script being written for continuous traits instead of binary traits.

Figure 4: This is a phylogenetic tree based off of the DNA data for the five species. This tree is the most parsimonious when mapping the character trait changes for the character trait ‘number of coronoid processes (1 present=0, 2 present=1)’. This figure should show only 1 change on the branch before S.carolinensis from 0 to 1. The three species with 2 coronoid processes present should be S.carolinensis, M.monax, and C.ludovicanus. Unfortunately, the figure does not accurately present the data from the character matrix, possibly as a result of the script being written for continuous traits instead of binary traits.

Questions

  1. Critically compare the morphological tree you made in R with the morphological tree you made by hand in the Phylogenetics I lab. If they differ, describe how and why.

My hand made morphological tree used S.floridanus as the outgroup and therefore had a different organization. However, the level of relatedness matches between the two morphological trees; they are in essence reverses of each other.

  1. Critically compare the molecular tree and the morphological tree. Describe their similarities and differences, and explain why they show different topologies (branch arrangements).

The molecular are morphological trees are both rooted with S.paradoxus but beyond that the relationships are different. The most parsimonious character tree has S.paradoxus and S.floridanus furtherest apart whereas the DNA tree has S.floridanus as the closest relationship to S.paradoxus. In the morphological tree S.carolinensis and S.floridanus are sister taxa. In the molecular tree C.ludovicianus and M.monax are sister taxa. These differences are due to how much data is supporting the tree structure. The morphological tree is based off of five binary traits and the molecular tree is based off the DNA sequence of the cytochrome-B gene. The DNA sequence is much larger and therefore has more comparisons that can be made and level of relatedness can be determined on a more specific level.

Now plot Phylogenetic trees showing the character traces for 3 different morphological characters, and a brief figure description (as a caption) for each tree that summarizes the pattern of trait evolution shown, e.g. if a trait is synapomorphic or exhibits convergent evolution.

Trait 1

#your code here
plotBranchbyTrait(DNAtree, charmat[,1])
Figure 5: This is a phylogenetic tree based off of the DNA data for the five species. This tree is is the most parsimonious when mapping the character trait changes for the character trait'diastema (absent=0, present=1)'. This figure shows that there is 1 change that needs to occur for this morphological trait when mapping it in relation to the DNA phylogenetic tree from 0 at S. paradoxus to 1 for the rest of the species.The small blue branch after S.carolinensis and before the next section of the tree is likely a result of the uncertainty of ancestry that R is trying to determine and since it doesn't have ancestral data it is showing that the ancestor MAY have not had the trait.

Figure 5: This is a phylogenetic tree based off of the DNA data for the five species. This tree is is the most parsimonious when mapping the character trait changes for the character trait’diastema (absent=0, present=1)’. This figure shows that there is 1 change that needs to occur for this morphological trait when mapping it in relation to the DNA phylogenetic tree from 0 at S. paradoxus to 1 for the rest of the species.The small blue branch after S.carolinensis and before the next section of the tree is likely a result of the uncertainty of ancestry that R is trying to determine and since it doesn’t have ancestral data it is showing that the ancestor MAY have not had the trait.

#only character trait 1 is being read correctly

Trait 2

plotBranchbyTrait(DNAtree, charmat[,2])
Figure 6: This is a phylogenetic tree based off of the DNA data for the five species. This tree is the most parsimonious when mapping the character trait changes for the character trait'auditory bullae (deflated=0, inflated=1)'. This figure should show that there are 2 changes that need to occur for this morphological trait when mapping it in relation to the DNA phylogenetic tree. The changes we should see is from 0 to 1 after S.paradoxus and then again at M.monax from 1 back to 0. Unfortunately, the figure does not accurately present the data from the character matrix, possibly as a result of the script being written for continuous traits instead of binary traits.

Figure 6: This is a phylogenetic tree based off of the DNA data for the five species. This tree is the most parsimonious when mapping the character trait changes for the character trait’auditory bullae (deflated=0, inflated=1)’. This figure should show that there are 2 changes that need to occur for this morphological trait when mapping it in relation to the DNA phylogenetic tree. The changes we should see is from 0 to 1 after S.paradoxus and then again at M.monax from 1 back to 0. Unfortunately, the figure does not accurately present the data from the character matrix, possibly as a result of the script being written for continuous traits instead of binary traits.

Trait 3

#your code here
plotBranchbyTrait(DNAtree, charmat[,3])
Figure 7: This is a phylogenetic tree based off of the DNA data for the five species. This tree is the most parsimonious when mapping the character trait changes for the character trait'fenestrated maxillary (absent=0, ipresent=1)'. The figure should show one change from 0 to 1 for S.floridanus.  Unfortunately, the figure does not accurately present the data from the character matrix, possibly as a result of the script being written for continuous traits instead of binary traits.

Figure 7: This is a phylogenetic tree based off of the DNA data for the five species. This tree is the most parsimonious when mapping the character trait changes for the character trait’fenestrated maxillary (absent=0, ipresent=1)’. The figure should show one change from 0 to 1 for S.floridanus. Unfortunately, the figure does not accurately present the data from the character matrix, possibly as a result of the script being written for continuous traits instead of binary traits.

Write a paragraph that compares the patterns of evolution among the three traits and hypotheses for commonalities or differences among traits. In your paragraph, provide some rational for why you think the evolution of at least one of your traits has proceeded in this way. You are encouraged to consult the scientific literature to substantiate your reasoning.

Of the three traits, diastema and fenestrated maxillary traits only had one change in the tree but the auditory bullae had two. The diastema is absent in S. paradoxus and present in the rest of the five species. The fenestrated maxillary is present in S. floridanus and absent in the rest of the species. The auditory bullae is deflated in S.paradoxus and M.monax and is inflated in the other species.

The diastema probably developed in the species after S. paradoxus as a result of a diet change. The fenestrated maxillary is likely to assist in muscle attachement on the face and may have developed in S.floridanus because increased facial muscle control was important for the fitness of the species in it’s environment (possibly to help with navigation through the use of whsikers).I am uncertain of the function of the inflation of the auditory bullae but it is possible since S.paradoxus and M.monax are both digging species that having a deflated bullae is important or useful.

The evolution of the diastema is likely a result of a change in diet. The presence of a diastema changes the morphology of the teeth in the upper jaw specifically. The outgroup, S.paradoxus did not have a diastema but the other four species did. S.paradoxus is omnivorous but eats primarely insects and small reptiles by injecting venom into their prey. Their teeth are evenly spaced in the mouth to eat their varied diet. The rest of the species are herbivores (primarily or entirely) and therefore need strong front teeth to rip plants and closely lined premolars and molars to grind the plants.