Genealogy part 5 - veeninglab/BactMAP GitHub Wiki

Tree with fluorescence data

It’s nice to know which cell originates from which, but finally that’s only interesting if we know the cell attributes. In the example dataset, we are curious whether the internal cell fluorescence is inherited from the mother cell. To put this information into the trees, we have to add the dataset myTreeDF which includes the fluorescence information to our tree.

If I just plot the tree coming out of plotTreeBasic(), it’s just a boring tree without any other things, so I’ll add the same x-axis lines as I did before. After that, let’s color all tree nodes based on cell fluorescence. I put the nodes at the place of cell birth. Because I don’t like the standard colors of R that much, I add the viridis color palette. Finally, because the standard tree layout omits figure legends, I’ll put the figure legend on the right side to make sense of the colors.

Let’s do this layer by layer:

treefluo <- plotTreeBasic(myTreePhylo, myTreeDF)
#add basics:
treefluo1 <- treefluo + theme(axis.text.x = element_text(), #make axis numbers visible
              axis.ticks.x=element_line()) + #add axis ticks
            xlab("Time (frames)")  #x axis label
#add point colors:
treefluo2 <- treefluo1 + geom_point(aes(x=x-branch.length, color=fluormean)) + #add cell fluorescence at cell birth
            scale_color_viridis_c() + #add different color scale
            theme(legend.position="right") #add legend

Type the plot name (treefluo1 for instance) in your console to see the intermediate plots. Here is treefluo2:

What still looks a bit stupid to me, is that the last lines of each branch don’t have a colored dot yet. Now that makes sense, because I just plotted the mean fluorescence at cell birth (fluormean). I can add the mean fluorescence at cell death (fluormean_D) at only the ends of each branch using geom_tippoint().

treefluo3 <- treefluo2 +
  geom_tippoint(aes(color=fluormean_D))  #added tip points

Also, I would like the dots to be a bit bigger. This I have to change in geom_point(); which means that I have to go back a few steps in my plot to make it work. I take treefluo1 as my basis, then I add all layers on top again, but I specify the size of the dots with size=4 inside the geom_point() and geom_tippoint() functions:

treefluo4 <- treefluo1 + geom_point(aes(x=x-branch.length, color=fluormean), size=4) + #add cell fluorescence at cell birth, change dot size to 4
                        geom_tippoint(aes(color=fluormean_D), size=4) +  #added tip points, dot size 4
                        scale_color_viridis_c() + #add viridis color scale
                        theme(legend.position="right") #add legend

Now, my final plot looks like this:


⬅️ Genealogy Part 4: Basic Tree Genealogy Part 6: More Tree Manipulation ➡️
⚠️ **GitHub.com Fallback** ⚠️