drieslab / Giotto

Spatial omics analysis toolbox
https://drieslab.github.io/Giotto_website/
Other
258 stars 98 forks source link

An error from createGiottoCosMxObject() with the Giotto 3.0 #433

Closed GCatatGC closed 1 year ago

GCatatGC commented 1 year ago

Hi. I am excited for the saveGiotto() function in new version 3.0, so I installed it today (3pm, 11/19/2022). And I was following the tutorial of Cosmx (https://giottosuite.readthedocs.io/en/latest/subsections/datasets/Nanostring_Lung12_jan26_21.html). On CosMx Project loading function chapter, I got an error:

fov_join = createGiottoCosMxObject(cosmx_dir = data_path,
                                    data_to_use = 'subcellular',
                                    FOVs = c(2,3,4),
                                    instructions = instrs)

A structured CosMx directory will be used

Checking directory contents... --| CellLabels folder found --| CompartmentLabels folder found --| CellComposite folder found --| CellOverlay folder found --| transcript locations file found --| fov positions file found --| expression matrix file found --| metadata file found Directory check done Loading subcellular information... Subcellular load done Starting FOV 002 Loading image information... Image load done Building subcellular giotto object...

  1. Start extracting polygon information polygonlist is a list with names [ cell ] Process polygon info... Error in match.arg(mask_method, choices = c("guess", "single", "multiple")) : 'arg' must be NULL or a character vector

Unfortunately, I did not save the previous version (Giotto 2.0).

Can we fix this error in Giotto3.0? Because I really want to use the saveGiotto() function.

RubD commented 1 year ago

The createGiottoCosMxObject is probably not yet updated, but the step-by-step workflow might work. This would mean starting from #2 and not use the convenience function.

GCatatGC commented 1 year ago

The createGiottoCosMxObject is probably not yet updated, but the step-by-step workflow might work. This would mean starting from #2 and not use the convenience function.

Hi RubD, Thanks for your reply. I ran step-by-step workflow and it resulted into similar error.

fovsubset = createGiottoObjectSubcellular(gpoints = list('rna' = tx_coord), gpolygons = list('cell' = segmentation_mask), polygon_mask_list_params = list(mask_method = 'guess', flip_vertical = TRUE, flip_horizontal = FALSE, shift_horizontal_step = FALSE), instructions = instrs) and got:

  1. Start extracting polygon information polygonlist is a list with names [ cell ] Process polygon info... Error in match.arg(mask_method, choices = c("guess", "single", "multiple")) : 'arg' must be NULL or a character vector
RubD commented 1 year ago

Thanks @GCatatGC for letting us know. I've pushed a fix for this problem. It should work now.

GCatatGC commented 1 year ago

Thanks @GCatatGC for letting us know. I've pushed a fix for this problem. It should work now.

Thanks a lot ! It works now.

GCatatGC commented 1 year ago

Thanks @GCatatGC for letting us know. I've pushed a fix for this problem. It should work now.

Hi RubD, I got a new error when I ran "Annotate Giotto object" part, in the tutorial of Nanostring_Lung1

add cell types

clusters_cell_types_lung = c('Normal Epithelial', 'Cancer', 'Stromal', 'Plasma Cells',
                             'Cytotoxic T Cells', 'Cancer Stem Cells',
                             'Macrophage', 'Memory B Cell', 'Memory B Cell')

names(clusters_cell_types_lung) = as.character(sort(cluster_order))

fov_join = annotateGiotto(gobject = fov_join,
                          annotation_vector = clusters_cell_types_lung,
                          cluster_column = 'leiden_clus')

plotUMAP(fov_join,
         cell_color = 'cell_types',
         point_size = 1.5)

The Error is: Error in get_cell_metadata(gobject, spat_unit = spat_unit, feat_type = feat_type, : metadata referenced is not cellMetaObj

jiajic commented 1 year ago

Hi RubD, I got a new error when I ran "Annotate Giotto object" part, in the tutorial of Nanostring_Lung1

add cell types

clusters_cell_types_lung = c('Normal Epithelial', 'Cancer', 'Stromal', 'Plasma Cells',
                             'Cytotoxic T Cells', 'Cancer Stem Cells',
                             'Macrophage', 'Memory B Cell', 'Memory B Cell')

names(clusters_cell_types_lung) = as.character(sort(cluster_order))

fov_join = annotateGiotto(gobject = fov_join,
                          annotation_vector = clusters_cell_types_lung,
                          cluster_column = 'leiden_clus')

plotUMAP(fov_join,
         cell_color = 'cell_types',
         point_size = 1.5)

The Error is: Error in get_cell_metadata(gobject, spat_unit = spat_unit, feat_type = feat_type, : metadata referenced is not cellMetaObj

Hi @GCatatGC, thank you for letting us know about this error. createGiottoCosMxObject() has been partially updated for the 'subcellular' workflow in the 3.1 update (#458). The issue with annotateGiotto() was also addressed.

The CosMx tutorial has also been updated.

GCatatGC commented 1 year ago

Thanks a lot for all the remarkable work!