![](../logo.png)
createMetafeats
createMetafeats.Rd
This function creates an average metafeat/metagene/module for clusters.
Usage
createMetafeats(
gobject,
spat_unit = NULL,
feat_type = NULL,
expression_values = c("normalized", "scaled", "custom"),
feat_clusters,
name = "metafeat",
return_gobject = TRUE
)
Arguments
- gobject
Giotto object
- spat_unit
spatial unit
- feat_type
feature type
- expression_values
expression values to use
- feat_clusters
numerical vector with features as names
- name
name of the metagene results
- return_gobject
return giotto object
Details
An example for the 'gene_clusters' could be like this: cluster_vector = c(1, 1, 2, 2); names(cluster_vector) = c('geneA', 'geneB', 'geneC', 'geneD')
Examples
if (FALSE) {
# load a dataset
g <- GiottoData::loadGiottoMini("viz")
# set a spat unit to use
activeSpatUnit(g) <- "aggregate"
# create the metafeats
# We do this by making an annotation vector which is a numerical vector
# of cluster assignments where each number is named by the feature it describes.
#
# Here we create an example annotation vector by arbitrarily using the first 6
# features and putting 3 in cluster 1 and the other 3 in cluster 2.
feats_to_use <- featIDs(g)[1:6]
clust_to_use <- c(1, 1, 1, 2, 2, 2)
names(clust_to_use) <- feats_to_use
# show
clust_to_use
g <- createMetafeats(
gobject = g,
feat_clusters = clust_to_use,
name = "new_metagene"
)
GiottoVisuals::spatCellPlot(
gobject = g,
spat_enr_names = "new_metagene",
cell_annotation_values = c("1", "2"),
point_size = 3.5,
cow_n_col = 2
)
}