plotOverlay: Display spot- and/or object-localization of different color...

View source: R/combine_analyses.R

plotOverlayR Documentation

Display spot- and/or object-localization of different color channels and/or experimental conditions in one plot.

Description

This function returns a list of plots or one plot, displaying the localization of spots, objects in groups of cells - either as projections, demographs or as histograms.

Usage

plotOverlay(meshdata,
            spotdata,
            objectdata,
            by="both",
            type="all",
            quantiles = 1,
            quantiles_by = "max_um",
            equal_groups=TRUE,
            mag,
            objectcolor=c("#E69F00", "#56B4E9", "#009E73", "#F0E442"),
            spotcolor = c("#0072B2", "#D55E00", "#CC79A7", "000000"),
            histogram_outline = NA,
            his_scales = "free",
            transparency  = 0.05,
            meshcolor = "black",
            dotsize=1,
            summaryquant = FALSE)

Arguments

meshdata

A mesh dataframe generated by combining dataframes with the function combineDataframes. Optional.

spotdata

A spot dataframe generated by combining dataframes with the function combineDataframes. Optional.

objectdata

A object dataframe generated by combining dataframes with the function combineDataframes. Optional.

by

Either "both", "channel" or "condition", indicating which variables are to be plotted.

type

The type of output plot. Options are: "histogram", "length", "width", "projection" or "all". Examples of each plot are given below.

quantiles

When "projection" or "all" is chosen, the cells can be split into groups by quantiles_by: one of the other columns existing in each dataset (default = max_um). Default for quantiles = 1, so no grouping.

quantiles_by

see quantiles

equal_groups

when set to TRUE, the number of cells in each group is equal (for instance, 3 equally-sized groups grouped by size). when set to FALSE, the cells are grouped by bin (for instance, from 0-1 micron, from 1-2 micron and from 2-3 micron).

mag

magnification convertion factor, needed when cell values are not yet converted to microns. See getPixels2um.

objectcolor

Indicates the color(s) of the objects (if included). Default colorset is a range of 4 colors ("#E69F00", "#56B4E9", "#009E73" and "#F0E442").

spotcolor

Indicates the color(s) of the spot data (if included). Default colorset is a range of 4 colors ("#0072B2", "#D55E00", "#CC79A7" and "000000").

histogram_outline

By default, the histograms displayed have no outlines. Indicate a hex value or a colorname to change this.

his_scales

Inherited from ggplot2::geom_facet_grid(): when cells are grouped into different groups, by default, the histograms y-axis is scaled free per group. Setting his_scales to "fixed" will make the scale the same for each group.

transparency

Change this value to set the transparency of the plotted objects.

meshcolor

By defaults, the cells are black. change this here.

dotsize

Change this value to change the size of the plotted spots.

summaryquant

To receive a summary of each quantile (defined by quantiles_by) with the projection, set this to TRUE.

Value

A plot or a list of plots:

histogram

Histogram plot of the localization distribution, if quantiles are set, grouped by by_quantiles.

length

Dotplot showing the localization of the spots and/or objects on the cell's length axis on the y-axis, and the cells ordered by cell length on the x-axis.

width

Dotplot showing the localization of the spots and/or objects on the cell's width axis on the y-axis, and the cells ordered by cell length on the x-axis.

projection

Cell projections showing the relative object localization, spot localization and cell shape; if quantiles are set, grouped by quantiles_by. If summaryquant is set to TRUE, the output will be a list including a $plot (=the projections) and a $summary dataframe summarizing each quantile by the variable quantiles_by.

Author(s)

Renske van Raaphorst

Examples

## Not run: 
##get data from BactMAP examples: https://veeninglab.com/f/examples_datasets.zip

#condition one: wild type
load("VanFL_objWT")
load("VanFL_meshWT")

load("VanFL_objDM")
load("VanFL_meshDM")

comboMesh <- combineDataframes( list(VanFL_meshWT, VanFL_meshDM),
                                listofconditions=list("WildType", "DeltaMapZ"))
comboObjects <- combineDataframes(list(VanFL_objWT, VanFL_objDM),
                                  listofconditions=list("WildType", "DeltaMapZ"))

plotOverlay(meshdata=comboMesh$finalframe,
            objectdata=comboObjects$finalframe,
            by="condition",
            quantiles=4,
            type="projection")

## End(Not run)

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