conditionals: Data Conditions Input

View source: R/data_conditionals.R

conditionalsR Documentation

Data Conditions Input

Description

This function allows filtering, ordering, quantiling, and grouping of data for plotting.

Usage

conditionals(
  data_filters = NULL,
  data_ordering = ordering(),
  data_quantiling = quantiling(),
  data_grouping = NULL
)

Arguments

data_filters

Logical statements by which to filter data.

data_ordering

Order object with order settings. See ?ordering for more information.

data_quantiling

Quantile object with quantile settings. See ?quantiling for more information.

data_grouping

If quantiles not set, split data by the specified categorical variable.

Details

It may be desirable to analyze certain subsets of TSSs or TSRs, or split the data based on various categorical variables. This function extends the flexibility of various other functions by adding the ability to filter, quantile, order, and/or group data prior to downstream analysis.

'data_filters' takes logical statements to filter TSSs or TSRs by any column stored in the data. 'data_ordering' takes an 'ordering' object as input, which allows ordering of data by one or more columns. 'data_quantiling' takes a 'quantiling' object as input, and will split plots by the given number of quantiles. 'data_grouping' will split a plot by the given column if quantiling is not set.

Value

'data_conditions' object for input to the corresponding 'data_conditions' argument in select functions.

See Also

ordering for ordering information. quantiling for quantiling information.

Examples

data(TSSs)
assembly <- system.file("extdata", "S288C_Assembly.fasta", package="TSRexploreR")

exp <- TSSs[1] %>%
  tsr_explorer(genome_assembly=assembly) %>%
  format_counts(data_type="tss") %>%
  tss_clustering(threshold=3) %>%
  associate_with_tsr %>%
  tsr_metrics

# Sequence logo of TSSs from peaked TSRs
conditions <- conditionals(shape_class == "peaked")
p <- plot_sequence_logo(exp, data_conditions=conditions)

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

# Sequence logos split by TSS score quantile
conditions <- conditionals(data_quantiling=quantiling(score, n=5))
p <- plot_sequence_logo(exp, data_conditions=conditions)

# Sequence logo split by TSR shape class
conditions <- conditionals(data_grouping=shape_class)
p <- plot_sequence_logo(exp, data_conditions=conditions)


zentnerlab/TSRexploreR documentation built on Dec. 30, 2022, 10:27 p.m.