prep_images: prep_images

prep_imagesR Documentation

prep_images

Description

Prepares images summarizing profiles in t-sne regions and returns ggimage compatible data.frame for plotting.

Usage

prep_images(
  summary_dt,
  x_points,
  y_points = x_points,
  xrng = c(-0.5, 0.5),
  yrng = c(-0.5, 0.5),
  rname = NULL,
  odir = file.path(tempdir(), rname),
  force_rewrite = FALSE,
  apply_norm = TRUE,
  ylim = c(0, 1),
  facet_by = NULL,
  ma_size = 2,
  n_splines = 10,
  n_cores = getOption("mc.cores", 1),
  line_color_mapping = NULL,
  vertical_facet_mapping = NULL,
  wide_var = "name",
  x_var = "x",
  y_var = "y"
)

Arguments

summary_dt

a tidy data.table from prep_summary()

x_points

numeric. number of grid points to use in x dimension.

y_points

numeric. number of grid points to use in y dimension. Defaults to same value as x_points.

xrng

view domain in x dimension, default is range of position_dt$tx.

yrng

view domain in y dimension, default is range of position_dt$ty.

rname

prefix for image files. existing image files are used if present.

odir

output directory for image files.

force_rewrite

if TRUE, images are overwritten even if they exist.

apply_norm

if TRUE, y values are trimmed to 95th percentile and transformed ot domain of [0,1]. Default is TRUE.

ylim

y-limits of regional summary plots. Default of c(0, 1) is compatible with apply_norm = TRUE.

facet_by

character. varaible name to facet profile_dt by when constructing images. The only valid non-null value with chiptsne functions is "tall_var".

ma_size

moving average size when smoothing profiles.

n_splines

number of points to interpolate with splines.

n_cores

number of cores to use when writing images. Default is value of mc.cores option if set or 1.

line_color_mapping

named vector of line color. Names correspond to values of profile_dt 'wide_var' variable and values are colors.

vertical_facet_mapping

named vector of vertical facet for data

Value

data.table with variables

Examples

data("profile_dt")
data("tsne_dt")
summary_dt = prep_summary(profile_dt, tsne_dt, 4)
img_res = prep_images(summary_dt, 4)
#zoom on top-right quadrant
summary_dt.zoom = prep_summary(profile_dt, tsne_dt, 4,
    xrng = c(0, .5), yrng = c(0, .5))
img_res.zoom = prep_images(summary_dt.zoom, 4,
    xrng = c(0, .5), yrng = c(0, .5))
#use results with plot_summary_raster() to make plots

jrboyd/seqtsne documentation built on Nov. 5, 2022, 6:37 a.m.