## ----include = [encoded data, 9983 characters]
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----vis-reg-data, echo=FALSE, fig.align='center', out.width='100%'[encoded data, 9931 characters]
knitr::include_graphics("figures/visualisation_diagram.png")

## ----load-greatR, message=FALSE, [encoded data, 9965 characters]
# Load the package
library(greatR)
library(data.table)

## ----brapa-data-results, message=FALSE, warning=FALSE, [encoded data, 9943 characters]
# Load a data frame from the sample data
registration_results <- system.file("extdata/brapa_arabidopsis_registration.rds", package = "greatR") |>
  readRDS()

## ----get-summary-results, fig.align='center'[encoded data, 9954 characters]
# Get registration summary
reg_summary <- summary(registration_results)

reg_summary$summary |>
  knitr::kable()

## [encoded data, 9997 characters]
reg_summary$registered_genes

## [encoded data, 9997 characters]
reg_summary$non_registered_genes

## ----plot-summary-results, echo=FALSE, fig.align='center', fig.height=4, fig.width=4.5, [encoded data, 9910 characters]
plot(
  reg_summary,
  type = "registered",
  scatterplot_size = c(4, 3.5)
)

## ----plot-results, fig.align='center', fig.height=8, fig.width=7, [encoded data, 9932 characters]
# Plot registration result
plot(
  registration_results,
  ncol = 2
)

## [encoded data, 9997 characters]
sample_distance <- calculate_distance(registration_results)

## ----plot-dist-original, fig.align='center', fig.height=4, fig.width=3, [encoded data, 9926 characters]
# Plot heatmap of mean expression profiles distance before registration process
plot(
  sample_distance,
  type = "original"
)

## ----plot-dist-registered, fig.align='center', fig.height=4, fig.width=4, [encoded data, 9924 characters]
# Plot heatmap of mean expression profiles distance after registration process
plot(
  sample_distance,
  type = "result",
  match_timepoints = TRUE
)

