knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

After running the registration function register() as shown in the registering data article, users can summarise and visualise the results as illustrated in the figure below.

knitr::include_graphics("figures/visualisation_diagram.png")

Summarising registration results

The total number of registered and non-registered genes can be obtained by running the function summary() with registration_results object as an input.

# Load the package
library(greatR)
library(data.table)
# Load a data frame from the sample data
registration_results <- system.file("extdata/brapa_arabidopsis_registration.rds", package = "greatR") |>
  readRDS()

The function summary() returns a list with S3 class summary.res_greatR containing four different objects:

# Get registration summary
reg_summary <- summary(registration_results)

reg_summary$summary |>
  knitr::kable()

The list of gene IDs which are registered or non-registered can be viewed by calling:

reg_summary$registered_genes
reg_summary$non_registered_genes

Plot distribution of registration parameters

The function plot() allows users to plot the bivariate distribution of the registration parameters. Non-registered genes can be ignored by selecting type = "registered" instead of the default type = "all". Similarly, the marginal distribution type can be changed from type_dist = "histogram" (default) to type_dist = "density".

plot(
  reg_summary,
  type = "registered"
)
plot(
  reg_summary,
  type = "registered",
  scatterplot_size = c(4, 3.5)
)

Plotting registration results

The function plot() allows users to plot the registration results of the genes of interest (by default only up to the first 25 genes are shown, for more control over this, use the genes_list argument).

# Plot registration result
plot(
  registration_results,
  ncol = 2
)

Notice that the plot includes a label indicating if the particular genes are registered or non-registered, as well as the registration parameters in case the registration is successful.

For more details on the other function arguments, go to plot().

Analysing similarity of expression profiles over time before and after registering

Calculate sample distance

After registering the data, users can compare the overall similarity between datasets before and after registering using the function calculate_distance(). By default all genes are considered in this calculation, this can be changed by using the genes_list argument.

sample_distance <- calculate_distance(registration_results)

The function calculate_distance() returns a list with S3 class dist_greatR of two data frames:

Plot heatmap of sample distances

Each of these data frames above can be visualised using the plot() function, by selecting either type = "result" (default) or type = "original".

# Plot heatmap of mean expression profiles distance before registration process
plot(
  sample_distance,
  type = "original"
)
# Plot heatmap of mean expression profiles distance after registration process
plot(
  sample_distance,
  type = "result",
  match_timepoints = TRUE
)

Notice that we use match_timepoints = TRUE to match the registered query time points to the reference time points.



ruthkr/greatR documentation built on July 20, 2024, 7 p.m.