ordering: Ordering

Description Usage Arguments Value See Also Examples

View source: R/data_conditionals.R

Description

This is a companion function to 'conditionals' that allows the specification of variables to order data by for plotting.

Columns to order by should be specified by names/symbols and not characters. To sort by a variable in descending order, wrap the variable name in the 'desc' function. By default ordering is calculated based on the aggregate value (based on '.aggr_fun') of the variable accross all samples. If '.samples' is specified, only the given samples will be used for aggregate calculation and ordering.

Usage

1
ordering(..., .samples = NULL, .aggr_fun = mean)

Arguments

...

Variables to order by. Wrap varaible name in desc() for descending order (like in dplyr::arrange).

.samples

Names of samples to order by aggregate score.

.aggr_fun

If more than one sample is selected feature values are aggregated using this function.

Value

A list of ordering parameters to be passed to the 'data_ordering' argument of 'conditionals'.

See Also

conditionals For more information on advanced data conditions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(TSSs)
assembly <- system.file("extdata", "S288C_Assembly.fasta", package="TSRexploreR")

exp <- TSSs[1] %>%
  tsr_explorer(genome_assembly=assembly) %>%
  format_counts(data_type="tss")

# Sequence color map sorted by descending score.
conditions <- conditionals(data_ordering=ordering(desc(score)))
p <- plot_sequence_colormap(exp, data_conditions=conditions)

rpolicastro/tsrexplorer documentation built on Oct. 17, 2021, 3:02 p.m.