Function to create a giotto object
Usage
createGiottoObject(
expression,
expression_feat = "rna",
spatial_locs = NULL,
spatial_info = NULL,
calc_poly_centroids = FALSE,
centroids_to_spatlocs = FALSE,
feat_info = NULL,
cell_metadata = NULL,
feat_metadata = NULL,
spatial_network = NULL,
spatial_grid = NULL,
spatial_grid_name = NULL,
spatial_enrichment = NULL,
dimension_reduction = NULL,
nn_network = NULL,
images = NULL,
largeImages = NULL,
offset_file = NULL,
instructions = NULL,
cores = determine_cores(),
raw_exprs = NULL,
expression_matrix_class = c("dgCMatrix", "DelayedArray"),
h5_file = NULL,
verbose = FALSE
)
Arguments
- expression
expression information
- expression_feat
available features (e.g. rna, protein, ...)
- spatial_locs
data.table or data.frame with coordinates for cell centroids
- spatial_info
list of giotto polygon objects with spatial information, see
createGiottoPolygonsFromMask
andcreateGiottoPolygonsFromDfr
- calc_poly_centroids
if spatial_info is provided, whether to also calculate centroids
- centroids_to_spatlocs
if spatial_info is provided, whether to also convert centroids to spatial locations
- feat_info
list of giotto point objects with feature info, see
createGiottoPoints
- cell_metadata
cell annotation metadata
- feat_metadata
feature annotation metadata for each unique feature
- spatial_network
list of spatial network(s)
- spatial_grid
list of spatial grid(s)
- spatial_grid_name
list of spatial grid name(s)
- spatial_enrichment
list of spatial enrichment score(s) for each spatial region
- dimension_reduction
list of dimension reduction(s)
- nn_network
list of nearest neighbor network(s)
- images
list of images
- largeImages
deprecated
- offset_file
file used to stitch fields together (optional)
- instructions
list of instructions or output result from
createGiottoInstructions
- cores
how many cores or threads to use to read data if paths are provided
- raw_exprs
deprecated, use expression
- expression_matrix_class
class of expression matrix to use (e.g. 'dgCMatrix', 'DelayedArray')
- h5_file
path to h5 file
- verbose
be verbose when building Giotto object
Details
See http://giottosuite.com/articles/getting_started_gobject.html for more details
[Requirements] To create a giotto object you need to provide at least a matrix with genes as row names and cells as column names. This matrix can be provided as a base matrix, sparse Matrix, data.frame, data.table or as a path to any of those. To include spatial information about cells (or regions) you need to provide a matrix, data.table or data.frame (or path to them) with coordinates for all spatial dimensions. This can be 2D (x and y) or 3D (x, y, x). The row order for the cell coordinates should be the same as the column order for the provided expression data.
[Instructions] Additionally an instruction file, generated manually or
with createGiottoInstructions
can be provided to instructions,
if not a default instruction file will be created for the Giotto object.
[Multiple fields] In case a dataset consists of multiple fields, like
seqFISH+ for example, an offset file can be provided to stitch the different
fields together. stitchFieldCoordinates
can be used to
generate such an offset file.
[Processed data] Processed count data, such as normalized data, can be provided using one of the different expression slots (norm_expr, norm_scaled_expr, custom_expr).
[Metadata] Cell and gene metadata can be provided using the cell and
gene metadata slots. This data can also be added afterwards using
the addFeatMetadata
or addCellMetadata
functions.
[Other information] Additional information can be provided through the appropriate slots:
spatial networks
spatial grids
spatial enrichments
dimensions reduction
nearest neighbours networks
images
Examples
expr_matrix <- readRDS(system.file("extdata/toy_matrix.RDS",
package = "GiottoClass"
))
createGiottoObject(expression = expr_matrix)
#> python already initialized in this session
#> active environment : 'giotto_env'
#> python version : 3.10
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#> "/usr/share/miniconda/envs/giotto_env/bin/python"
#> There are non numeric or integer columns for the spatial location
#> input at column position(s): 1
#> The first non-numeric column will be considered as a cell ID
#> to test for consistency with the expression matrix
#> Other non numeric columns will be removed
#> An object of class giotto
#> >Active spat_unit: cell
#> >Active feat_type: rna
#> dimensions : 10, 10 (features, cells)
#> [SUBCELLULAR INFO]
#> [AGGREGATE INFO]
#> expression -----------------------
#> [cell][rna] raw
#> spatial locations ----------------
#> [cell] raw
#>
#>
#> Use objHistory() to see steps and params used