How it works...

The first step carries out a loading and amino acid sequence alignment, as we've seen in an earlier recipe with the msa package, returning an MsaAAMultipleAlignment object.

The second step uses the as.phyDat() function to convert the alignment to a phyDat object that can be used by the phangorn functions.

In Step 3, we actually make trees. Trees are made from a distance matrix, which we can compute with dist.ml() and our alignment (this is a maximum-likelihood distance measure; other functions can be used here if needed). The dist_mat is passed to the upgma() and NJ() functions to make UPGMA and neighbor-joining trees, respectively. These return standard phylo objects that can be worked with in many other functions. Here, we plot directly:

In the final step, we use the bootstraps.phyDat() function to compute bootstrap support for the branches in the tree. The first argument is the phyDat object, aln, while the second argument, FUN, requires a function to calculate trees. Here, we use an anonymous function wrapping the NJ() method we used to generate nj_tree in the first place. The bs argument tells the functions how many bootstraps to compute. Finally, we can plot the resultant bootstraps onto the tree using the plotBS() function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.205.169