The santaR
package is designed for the detection of significantly altered time trajectories between study groups, in short time-series. It is robust to missing values and noisy measurements without requiring synchronisation in time.
This vignette will:
.csv
and .RData
files to be used as input for the graphical interface tutorial.In short, for a given variable, each measurement (observation) is a row in a vector.
If more than one variable has been measured at a given time, multiple measurement columns can be provided in a Data.Frame (data
) with observations as rows and variables as columns.
For each data point (row), the following metadata vectors are required (or can be stored in a Data.Frame metadata
):
time
, the time at which the observation has been taken.ind
identifying which subject (individual) is associated with the observation.Optionally:
group
an identifier indicating to which study group the observation belongs.All observations of a given individual need to be affected to the same group. If 2 groups exist, significantly altered time trajectories can be identified. If no group or more than 2 groups are provided, the trajectories can be plotted but significance cannot be calculated.
data
and metadata
information can be stored as vectors, in one or in two separate Data.Frame. If a data-point is not available (no data value for any variables) the row should be discarded.
If some of the variable measurements are missing for a given time-point, the value can be replace by NaN
.
Do not inpute data as the package is explicitely designed to be robust to missing values.
Here is an example of 5
observations of 2
variables. Taken on 3
individual separated in 2
goups, covering 3
time-points:
# Metadata
ind <- c('ind_1','ind_1','ind_2','ind_2','ind_3') time <- c(0, 5, 0, 10, 5) group <- c('group_A','group_A','group_B','group_B','group_A') outputMeta <- data.frame(ind, time, group, stringsAsFactors = FALSE) pander::pandoc.table(outputMeta)
# Data
variable1 <- c(1,3.5, 4,9.5,5) variable2 <- c(110.2, NaN, 79.1, 132.0, 528.3) outputData <- data.frame(variable1, variable2, stringsAsFactors = FALSE) pander::pandoc.table(outputData)
The santaR
package is designed for the analysis of short noisy time-series as produced in most '-omics' platforms, an example of which is provided.
This dataset referred to as acuteInflammation
contains the concentrations of 22 mediators of inflammation over an episode of acute inflammation. The mediators have been measured at 7 time-points on 8 subjects, concentration values have been unit-variance scaled for each variable.
acuteInflammation
is stored as two Data.Frame; meta
for the 56 observations metadata, and data
for the 22 variables measurements:
library(santaR) ## Metadata # number of rows nrow(acuteInflammation$meta) # number of columns ncol(acuteInflammation$meta) # a subset acuteInflammation$meta[12:20,]
library(santaR) nrow(acuteInflammation$meta)
library(santaR) ncol(acuteInflammation$meta)
library(santaR) pander::pandoc.table(acuteInflammation$meta[12:20,])
## Data # number of rows nrow(acuteInflammation$data) # number of columns ncol(acuteInflammation$data) # a subset acuteInflammation$data[12:20,1:4]
library(santaR) nrow(acuteInflammation$data)
library(santaR) ncol(acuteInflammation$data)
library(santaR) pander::pandoc.table(acuteInflammation$data[12:20,1:4])
While the command line functions accept Data.Frame and vectors as input, the graphical user interface will read a .csv
file.
By concatenating acuteInflammation
's data
and metadata
tables and saving them in a .csv
file, we can prepare the input dataset for the graphical user interface tutorial:
library(santaR) # Concatenate outputTable <- cbind(acuteInflammation$meta, acuteInflammation$data) # Save to disk outputPath = file.path('path_to_my_output_folder', 'acuteInflammation_GUI_demo.csv') write.csv(outputTable, file=outputPath, row.names=FALSE)
It is also possible to provide the data directly as 2 Data.Frames stored in a .RData
file; containing the data in a DataFrame named inData
and metadata in a DataFrame named inMeta
:
library(santaR) # Rename datasets inMeta <- acuteInflammation$meta inData <- acuteInflammation$data # Save to disk outputPath = file.path('path_to_my_output_folder', 'acuteInflammation_GUI_demo.rdata') save(inMeta, inData, file=outputPath, compress=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.