getTrajectoryDf.Rd
Computes the expression trends of all specified variables along the direction of the spatial trajectory.
getTrajectoryDf( object, trajectory_name, of_sample = "", variables, method_gs = "mean", accuracy = 5, normalize = TRUE, verbose = TRUE )
object | A valid spata-object. |
---|---|
trajectory_name | The trajectory of interest specified as a single character value. |
of_sample | The sample(s) of interest specified as a single character value or vector. If set to "" (the default) the first sample is chosen. |
variables | Character vector. The variables of interest:
|
method_gs | Character value. The method according to which gene sets will be handled
specified as a character of length one. This can be either 'mean' or one
of 'gsva', 'ssgsea', 'zscore', or 'plage'. The latter four will be given to
|
accuracy | Numeric. Given to |
normalize | Logical. If set to TRUE values will be scaled to 0-1. Hint: Variables that are uniformly expressed can not be scaled and are discarded. |
verbose | Logical. If set to TRUE informative messages regarding the computational progress will be printed. (Warning messages will always be printed.) |
A summarized trajectory data.frame.
Initially the compiled trajectory data.frame of the specified trajectory
is joined with the respective input of variables via joinWithVariables()
.
The argument accuracy
refers to the amount of which the barcode-spots of the
given trajectory will be summarized with regards to the trajectory's direction:
The amount of accuracy
and the previously specified 'trajectory width' in createTrajectories()
determine the length and width of the sub-rectangles in which the rectangle the
trajectory embraces are splitted and in which all barcode-spots are binned.
Via dplyr::summarize()
the variable-means of every sub-rectangle are calculated.
These mean-values are then arranged according to the trajectory's direction.
Eventually the data.frame is shifted via tidyr::pivot_longer()
to a data.frame in which
every observation refers to the mean-value of one of the specified variable-elements (e.g. a specified
gene set) of the particular sub-rectangle. The returned data.frame contains the following variables:
trajectory_part: Character. Specifies the trajectory's sub-part of the observation. (Negligible if there is only one trajectory part.)
trajectory_part_order: Numeric. Indicates the order within the trajectory-part. (Negligible if there is only one trajectory part.)
trajectory_order: Numeric. Indicates the order within the whole trajectory.
gene_sets, genes or features: Character. The respective gene sets, gene or feature the value refers to.
values: Numeric. The actual summarized values.