NOTE:
When using RStudio, the heatmap might not show inside the plot area, but will be visible once you click the 'Zoom' button.
plot_heatmap(
trajectory,
expression_source = "expression",
features_oi = 20,
clust = "ward.D2",
margin = 0.02,
color_cells = NULL,
milestones = NULL,
milestone_percentages = trajectory$milestone_percentages,
grouping = NULL,
groups = NULL,
cell_feature_importances = NULL,
heatmap_type = c("tiled", "dotted"),
scale = dynutils::scale_quantile,
label_milestones = TRUE
)
A dynwrap trajectory.
Source of the feature expression, defaults to get_expression(trajectory)
.
The features of interest, either the number of features or a vector giving the names of the different features
The method to cluster the features, or a hclust object
A margin between trajectory segments.
How to color the cells.
"auto"
: Try to figure out how to color cells depending on whether
one of the grouping
, feature_io
, milestones
or pseudotime
parameters are defined.
"none"
: Cells are not coloured.
"grouping"
: Cells are coloured according to a grouping (e.g. clustering).
Either the grouping
parameter or trajectory$grouping
must be a named character vector.
"feature"
: Cells are coloured according to the values of a given feature (e.g. gene expression).
Either the expression_source
parameter or get_expression(trajectory)
must be a matrix.
Parameter feature_oi
must also be defined.
"milestone"
(recommended): Cells are coloured according their position in the trajectory. The positioning of the
cells are determined by parameter milestone_percentages
or else by trajectory$milestone_percentages
. The colours
of the milestones can be determined automatically or can be specified by passing a tibble containing character columns
milestone_id
and color
(See add_milestone_coloring()
for help in constructing this object).
"pseudotime"
: Cells are coloured according to the pseudotime value from the root.
Tibble containing the column milestone_id
(character).
If color_milestones
is set to "given"
, this tibble should also contain a column
color
(character), containing colour hex codes (e.g. "#123456"
).
The milestone percentages.
A grouping of the cells (e.g. clustering) as a named character vector.
A tibble containing character columns group_id
and color
. If NULL
, this object is inferred from the grouping
itself.
The importances of every feature in every cell, as returned by dynfeature::calculate_cell_feature_importance()
The type of heatmap, either tiled or dotted
Whether to rescale the expression, can be a function or boolean
How to label the milestones. Can be TRUE (in which case the labels within the trajectory will be used), "all" (in which case both given labels and milestone_ids will be used), a named character vector, or FALSE
A heatmap ggplot of an expression dataset with trajectory.
# NOT RUN {
data(example_bifurcating)
plot_heatmap(example_bifurcating)
# }
Run the code above in your browser using DataLab