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.

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

# \donttest{ 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)
#> Warning: Arguments in '...' ignored
# }