bactKymo | R Documentation |
bactKymo() takes the output of extr_OriginalCells()
and makes kymographs or demographs of them, depending on the chosen options. By default, all cells are used to make a demograph where the average fluorescence over the length axis of each cell is plotted, where all cells are ordered by cell length.
When 'timeD' is set to TRUE, bactKymo() makes kymographs of single cells. However, when 'percDiv' is set to true as well, bactKymo will make a kymograph of the average of all cell's fluorescence over their length axis, binning cells by the moment of division they are in (see perc_Division()
).
Other settings which can be changes are the bin size (in how many groups is the average fluorescence intensity over the cell length calculated), whether the bins are placed such, that they represent the cell length at that moment (sizeAV=TRUE, takes more computing time), and when using a demograph, whether the extreme values are removed (cutoff_demograph).
The output will standardly be in the "viridis" color scale of the viridis package. However, this can be overwritten manually by adding a fill color scale to the plot.
To make computing time shorter while playing with the settings, it is possible to first prepare the kymographs using prepForKymo()
. This is generally not necessary, but recommended when plotting single cell kymographs one by one.
bactKymo(originalCells,
timeD = FALSE,
dimension = "length",
bins = 25,
sizeAV = FALSE,
cells = "all",
prep = TRUE,
percDiv = FALSE,
cutoff_demograph = 0.975,
mag,
legend=TRUE)
originalCells |
The output of extr_OriginalCells, which combines TIFF data with mesh data. |
timeD |
if |
dimension |
default="length", but when put to "width" the kymographs will average over cell width. |
bins |
the amount of bins the fluorescence intensity will be averaged over (per cell/time point) |
sizeAV |
when |
cells |
default = "all". 'cells' is a numeric vector OR the word "all". When set to "all" ,all cells will be processed into a demograph (when timeD==FALSE) or a kymograph will be made of all cells (when timeD==TRUE). When a numeric vector of length 1 or more, the cells identified with the cell numbers in these vector will be processed into a demograph (when timeD == FALSE), or a kymograph will be made of all single cells (when timeD==TRUE). Finally, when only 1 cell number is identified, a kymograph will be made of this cell (when timeD == TRUE). It is not possible to make a plot of a single cell without time dimension. |
prep |
default = TRUE. Inside the function, the data will be prepared so it is possible to plot kymographs. Sometimes, when you want to run |
percDiv |
this will call for |
cutoff_demograph |
to make it easier to look at demographs of all cells, the highest 2.5 percent of the intensity values are removed from the demograph. set the cutoff to 1 to not remove anything, or put it lower to remove more values. |
mag |
magnification converter (see |
legend |
when |
Many options are possible within bactKymo()
. Make sure you set the time dimension & cells correctly! For examples, see the BactMAP wiki
Note that when you have an output of many plots, it is useful to use gridExtra::grid.arrange()
to save all plots in a PDF, this makes the plots easier to investigate and saves loading time in between.
One or multiple demographs/kymographs (see the details in arguments
).
Renske van Raaphorst
## Not run:
#download example dataset TurnedCell4 from https://veeninglab.com/f/example_datasets.zip
load("TurnedCell4.Rda")
#to plot a timelapse demograph of 1 cell:
kymo_cell4 <- bactKymo(originalCells = TurnedCell4, timeD=TRUE, sizeAV=TRUE)
#to change the color scheme:
OrangeHot <- getPalette("OrangeHot")
require(ggplot2)
kymo_cell4 + ggplot2::scale_fill_gradient2(low=OrangeHot[1], mid=OrangeHot[2], high=OrangeHot[3])
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.