The method of rooting trees described in the post “Unifrac and Tree Roots” is now included in QsRutils
beginning with version 0.3.2 as function root_phyloseq_tree
. Given a phyloseq object with an unrooted tree, it returns the same type of phyloseq
object with the tree rooted by the longest terminal branch.
Blog
Unifrac and Tree Roots
Unifrac distances have the attraction of including phylogenetic relatedness, based on a tree of the representative sequences, in the distances among samples calculated from an OTU table. FastTree is the usual method of choice in generating the tree, although USEARCH also provides a method. Both methods calculate unrooted trees, and calculation of Unifrac distances requires a rooted tree. The problem arises in how to best root the tree. I found a discussion of the problem on the phyloseq
GitHub site (https://github.com/joey711/phyloseq/issues/597). Continue reading “Unifrac and Tree Roots”
Update R in Ubuntu
If you installed R from the Ubuntu repository with
sudo apt-get install r-base
you most likely got an out of date version. In February 2018, that method still gave me R version 3.2.3 (2015-12-10). To get the latest versions of R and its packages, you need to add CRAN to the apt-get repositories. Do this with the code below. Enter one line at a time. Cut and paste to prevent errors. Continue reading “Update R in Ubuntu”
Get Execution Time for a Shell Script
If you need to know the execution time for a bash script, you can place it inside the script below. The the total run time will be printed to the screen after the script finishes. Continue reading “Get Execution Time for a Shell Script”
Commenting Code in gedit
Gedit is the basic editor that is included in Ubuntu and other Linux distributions. Its functionality can be extended with plugins as explained in the post below. I installed the plugin initially because it allows one to comment or un-comment selected lines of text. I find this useful when I want to include two configuration blocks in a script, say one for a local installation of a program and another for a remote installation on a cluster. If you do this, just make sure the appropriate blocks are commented and un-commented when you run the script.
Rotatable 3D Plots
The R package vegan includes the function ordiplot for making ordination plots using R’s base graphics. Additionally vegan provides several functions for enhancing the plots with spiders, hulls, and ellipses. It is even possible to overlay an ordination plot with a cluster diagram. (See my package ggordiplots on GitHub for making the same kinds of plots with ggplot graphics.) Vegan’s functions for adding these layers begin with “ordi”: ordispider, ordihull, ordiellipse, ordicluster. Earlier this year I discovered the package vegan3d. It makes use of rgl graphics which means that the plots it generates can be scaled and rotated with the mouse. This is not just fun – it allows you to see how well separated treatment groups are in the ordination space.