A Giotto object or gobject can be created with createGiottoObject or createGiottoVisiumObject for Visium datasets.
gobject = createGiottoObject() gvisiumobject = createGiottoVisiumObject()
createGiottoVisiumObject expects a typical Visium 10X data folder structure or a path to the h5 file, but createGiottoObject is more flexible and can also accept precomputed results (e.g. PCA, UMAP, network, ...)
The minimum requirements to make a Giotto class object are:
- raw_exprs: matrix with raw expression values
- spatial_locs: spatial coordinates for the cell (or spot) centroids. If this is not provided it will actually create dummy coordinates.
Example to add your own pre-computed PCA results
# step1: create matrix from PCA coordinates and name the columns (PCs): Dim.1, Dim.2, Dim.3, ... # e.g. PCA_matrix # step2: create a pca dimension reduction object PCA_list <- list( 'type' = "cells", # only PCA on cells is currently supported 'name' = "pca", # name of your pca, 'pca' is the default name 'reduction_method' = "pca", # needs to be pca 'coordinates' = as.matrix(PCA_matrix), # make sure to provide a matrix 'misc' = NULL) # slot for miscellaneous data, e.g. list(eigenvalues = ..., loadings = ...) # step3a: add PCA_list to createGiottoObject gobj <- createGiottoObject(..., dimension_reduction=list(PCA_list), ...) # step3b: add multiple PCA_lists to createGiottoObject # the name parameter should be different for each PCA list gobj <- createGiottoObject(..., dimension_reduction=list(PCA_list1, PCA_list2, ...)) # step4: for UMAP or tSNE: # same as for PCA, except for UMAP: reduction_method = 'umap' and default name = 'umap'} # same as for PCA, except for UMAP: reduction_method = 'umap' and default name = 'umap'}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.