bias_histogram: Bias histogram

Description Usage Arguments Value Examples

View source: R/bias_histogram.R

Description

Given a summarized experiment, gives histogram of log biases for 2 cell types. Each stacked bar in the histogram represents a clone binned by log bias defined as the log2 of the percentage abundance in the sample specified in "bias_1" divided by the percentage abundance in "bias_2."

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
bias_histogram(
  your_SE,
  split_bias_on,
  bias_1,
  bias_2,
  split_bias_over,
  bias_over = NULL,
  remove_unique = FALSE,
  breaks = c(10, 2, 1, 0.5),
  text_size = 10,
  linesize = 0.4,
  ncols = 1,
  scale_all_y = TRUE,
  return_table = FALSE
)

Arguments

your_SE

Your SummarizedExperiment of barcode data and associated metadata

split_bias_on

The column in 'colData(your_SE)' from which 'bias_1' and 'bias_2' will be chosen

bias_1

The first cell type (or other factor) to be compared. Must be a possible value of the split_bias_on column of your metadata. Will be on the RIGHT side of the histogram.

bias_2

The second cell type (or other factor) to be compared. Must be a possible value of the split_bias_on column of your metadata. Will be on the LEFT side of the ridge plot

split_bias_over

The column in 'colData(your_SE)' that you wish to observe the bias split for. The output will contain a faceted plot: one facet for each value of 'split_bias_over' comparing the samples matching 'bias_1' and 'bias_2' from the 'split_bias_on' argument.

bias_over

Choice(s) from the column designated in 'split_bias_over' that will be used for plotting. Defaults to all.

remove_unique

If set to true, only clones present in both samples will be considered.

breaks

Numeric. The breaks specified for bins on the x-axis (how biased the clones are towards one factor or the other).

text_size

The size of the text in the plot.

linesize

The linewidth of the stacked bars which represent individual barcodes

ncols

Numeric. Number of columns to plot on using plot_grid from cowplot.

scale_all_y

Logical. Whether or not to plot all plots on the same y axis limits.

return_table

Logical. If set to TRUE, instead of a plot, tbe function will return a list containing a dataframe for each sample-sample log bias combination containing each barcode sequence and its bias between the samples.

Value

Histogram of log bias for two factors faceted over another set of factors. Or, if return_table is set to TRUE, a list of dataframes containing the log bias data for each bias comparison passed to the function.

Examples

1
2
3
4
5
6
data(wu_subset)
bias_histogram(
    your_SE = wu_subset, split_bias_on = "celltype",
    bias_1 = "B", bias_2 = "T",
    split_bias_over = "months", ncols = 2
)

dunbarlabNIH/barcodetrackR documentation built on April 26, 2021, 6:20 p.m.