drieslab / Giotto

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

Changing RNA shape in spatInSituPlotPoints #516

Open ayumatsubo opened 1 year ago

ayumatsubo commented 1 year ago

Thank you for good tools!

I would like to show RNA expression in spatInSituPlotPoints more easily to see.

When I make point_size larger value, it is difficult to distinguish cell shapes and RNA dots. I want to change feature shape and I think feat_shape_code value is RNA shape option, but no change occurred.

Is there any way to change the shape of the RNA dot in spatInSituPlotPoints?

RubD commented 1 year ago

I've added this functionality to our development branch: suite_dev. You can install this branch or wait a bit until it will be merged into the suite branch.

Now you will be able to change the feature shapes with: feat_shape_code = list('rna' = 5)

You can use any point symbols, see https://www.datanovia.com/en/blog/ggplot-point-shapes-best-tips/.

If you have GiottoData installed you can quickly test it out with:

library(Giotto)
library(GiottoData)

## load mini vizgen example
gvizg = loadGiotto(path_to_folder = system.file('/Mini_datasets/Vizgen/VizgenObject/',
                                                package = 'GiottoData'))

## subset object
selected_ids = pDataDT(gvizg)$cell_ID[1:100]
mySubset <- subsetGiotto(gobject = gvizg, cell_ids = selected_ids)

spatInSituPlotPoints(mySubset,
                     spat_unit = 'aggregate',
                     show_image = T,
                     largeImage_name = 'dapi_z0',
                     feats = list('rna' = c("Htr1b", "Ackr1", "Epha7")),
                     feats_color_code = c("Htr1b" = 'green', 'Ackr1' = 'blue', 'Epha7' = 'red'),
                     point_size = 2,
                     feat_shape_code = list('rna' = 5),
                     show_polygon = TRUE,
                     polygon_feat_type = 'aggregate',
                     polygon_color = 'white',
                     polygon_line_size = 0.1,
                     polygon_fill = 'leiden_clus',
                     polygon_fill_as_factor = T,
                     coord_fix_ratio = TRUE)
ayumatsubo commented 1 year ago

Thank you so much!!!

ayumatsubo commented 1 year ago

I was able to change the shape of the RNA, but the line of the shape is too thin and hard to see, like shape 4 or 5. Have the options for increasing the thickness of the RNA border been added?

And if possible, can I change the shape of each RNA?

Thank you.

RubD commented 1 year ago

I've added an additional stroke parameter to change the thickness of the shapes, but giving each different RNA a different shape is currently not yet possible.