plottreeBasic: Plot cell genealogy information as networks using ggtree.

plotTreeBasicR Documentation

Plot cell genealogy information as networks using ggtree.

Description

This function is using the ggtree package to show cell genealogy combined with cell information, e.g. fluorescence intensity. This part of bactMAP is under development - plotting cell trees is possible, but is not (yet) as straight-forward. Check the tutorials on veeninglab.com/bactmap to get more information on how to use this function.

Usage

plotTreeBasic(phylo,
              extradata,
              yscalechange = FALSE,
              showClade = FALSE,
              layout = "rectangular",
              ydata,
              cellNumber,
              open.angle,
              linesize = 1,
              linecolor = "black",
              lines = TRUE,
              colors = FALSE)

Arguments

phylo

The $generation_lists output of extr_SuperSegger or extr_Oufti.

extradata

Data connected to the $generation_lists: $generation_dataframes. When this is added, you can plot for instance the clades of your dataset. See the tutorials for more information.

yscalechange

Default = FALSE. When TRUE, an y-axis is added to the tree. Only works when also indicating what needs to be plotted on the y-axis (indicate by putting the column name of choice from extradata as input in ydata).

showClade

When showClade==TRUE, one clade will be highlighted. Decide which one by putting a cell number in cellNumber.

layout

Inherited from ggtree; this decides the shape of the plotted tree. Options: "rectangular", "slanted", "fan", "circular", "radial", "unrooted", "equal_angle", "daylight"

ydata

Indicate the column name of the variable you want to be plotted on the y-axis of the tree (when yscalechange==TRUE).

cellNumber

Indicate the number of the cell of which you want to highlight the clade (when showClade==TRUE).

open.angle

When layout=="fan", indicate the size of the open angle (in degrees) here.

linesize

Thickness of the lines in the tree.

linecolor

Indicate the color of the lines in the tree.

lines

When highlighting a clade, set lines to TRUE when you want to do that by linetype.

colors

When highlighting a clade, set colors to TRUE when you want to do that by color.

Value

A ggtree object which can be edited using the ggtree commands.

Author(s)

Renske van Raaphorst

References

The ggtree cookbook by Guangchuang Yu.

Examples

## Not run: 
#this code requires other packages:
require(ggtree)
require(ggplot2)

# download example datasets from https://veeninglab.com/f/example_datasets.zip
load("ssbB_phylo.rda")
load("ssbB_meanfluo.rda")

#load example data from bactMAP package
myTreeData <- ssbB_phylo
myFluoData <- ssbB_meanfluo

#plot Tree with attributes
library(ggtree)

plotTreeBasic(myTreeData$phylos)%<+% myTreeData$data_attributes +
  geom_point(aes(x=x-branch.length, color=fluormean), size=6) +
  geom_tippoint(aes(color=fluormean_D), size=6) + #added tip points, different dot size
  geom_label(aes(x=x-branch.length, label=label), color=NA, fill="white", alpha=0.5, size=1) +
    #I also make a seethrough background label so you can see the text over the colored dots
  geom_text(aes(x=x-branch.length, label=label), size=3) +
  scale_color_viridis_c(option="magma") + #add different color scale
  theme(legend.position="right") + #add legend
  coord_flip()


## End(Not run)

vrrenske/shinyspots documentation built on Oct. 28, 2023, 12:26 p.m.