satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.26k stars 907 forks source link

enrichment spatial plots and UMAPs for Visium data in Seurat? #7463

Closed krigia closed 1 year ago

krigia commented 1 year ago

Hello @troels @pmarks @mxposed @zeehio @smoe

Does Seurat have any option/function to generate enrichment spatial plots and UMAPs for Visium data? Similar to those generated by another pipeline for spatial analysis:

image

Thank you.

pmarks commented 1 year ago

@krigia what feature are you using to color the spots in this case? Generally any quantity you can calculate on a per-spot basis can be used as a color variable for either UMAP or spatial plots. There are lot's of examples on the vignette, but I'm not sure if that specifically covers what you're looking to do.

krigia commented 1 year ago

@pmarks @troels I use a list of ~350 genes to color the spots and estimate a gene signature. The plots above were generated using certain Giotto functions, but now I am using Seurat extensively and I want to reproduce the same results. I checked the examples on the vignette but none can estimate a gene signature. Any advice how to modify an existing function to estimate the average expression of multiple genes across spots? Thank you.

AustinHartman commented 1 year ago

Hi @krigia I'd recommend you check out the AddModuleScore function to compute a single score for a collection of genes for each spot

krigia commented 1 year ago

@AustinHartman Thank you! This is helpful. However I am getting an error when I run cd_features <- list(c( 'FN1', 'VIM', 'PRRX1', 'SNAI2')) se_F1_normalizedmodule <- AddModuleScore( object = se_F1_normalized, features = cd_features, rownames(x=se_F1_normalized), ctrl = 100, name = 'ADRN_Features' ) head(x = se_F1_normalizedmodule[])

}

png("F1_UMAP-spatialpot-MES_plot.png", width=9, height=9, units="in", res=300) p3 <- ST.FeaturePlot(se_F1_normalizedmodule, features = cd_features, ncol = 2, grid.ncol = 2, show.sb = TRUE) p1 <- FeaturePlot(se_F1_normalizedmodule, features = "cd_features", cols = c("mistyrose", "red", "darkred")) p2 <- VlnPlot(se_F1_normalizedmodule, features = "cd_features", ncol = 2, group.by = "seurat_clusters") (p1 - p2)/p3 dev.off()

Error in vars.alt[[var]] : no such index at level 1

I would greatly appreciate your feedback. Thank you again!

krigia commented 1 year ago

Thank you! However I am getting an error when I run cd_features <- list(c( 'FN1', 'VIM', 'PRRX1', 'SNAI2')) se_F1_normalizedmodule <- AddModuleScore( object = se_F1_normalized, features = cd_features, rownames(x=se_F1_normalized), ctrl = 100, name = 'ADRN_Features' ) head(x = se_F1_normalizedmodule[])

}

png("F1_UMAP-spatialpot-MES_plot.png", width=9, height=9, units="in", res=300) p3 <- ST.FeaturePlot(se_F1_normalizedmodule, features = cd_features, ncol = 2, grid.ncol = 2, show.sbhttp://show.sb/ = TRUE) p1 <- FeaturePlot(se_F1_normalizedmodule, features = "cd_features", cols = c("mistyrose", "red", "darkred")) p2 <- VlnPlot(se_F1_normalizedmodule, features = "cd_features", ncol = 2, group.byhttp://group.by/ = "seurat_clusters") (p1 - p2)/p3 dev.off() Error in vars.alt[[var]] : no such index at level 1 I would greatly appreciate your feedback. Thank you again!

From: Austin Hartman @.> Reply-To: satijalab/seurat @.> Date: Friday, June 23, 2023 at 12:27 PM To: satijalab/seurat @.> Cc: "Giannikou, Krinio" @.>, Mention @.***> Subject: Re: [satijalab/seurat] enrichment spatial plots and UMAPs for Visium data in Seurat? (Issue #7463)

    External Email - Use Caution

Hi @krigiahttps://secure-web.cisco.com/1hVQNuV-RCurNYItBIRN1dT7IjXu6vFKYckvnhi71H76Hz7yer_m1PuYXSyxgF54DIYosWQ0ZJ0DRb1EhX5_fk4wwnoe-KLwtHPkEC6_w6w68nLV9Vdwxix0_dT7qMIbDdydQ4ud3pjQDBll27tp0b7J14c7cBBRwVgcJm8jNqmpzv9bklbxm4PjDu9MieUmOwIvLBYNldKEhXIUYO5WDW3DygZT_E_DL_CNW1NidZqu75OAJVAvpJXb8oODnOwav-xMX-LX5FD6lg-M0m5NTRLC_hgFx2rF-rAxD_pmQTNsP9QO93Y2ea31SgY3sHubQ70gdcqzV-Kgi7WrJUfc_3g/https%3A%2F%2Fgithub.com%2Fkrigia I'd recommend you check out the AddModuleScorehttps://secure-web.cisco.com/1TeXvvTRKeSw-0nmSCbQk0gH3H6ynfJNWCj6PoYTCBxX5hLMTSo6_GraIhXX545rTaO_Bp6BfFviorcKaIkCFliF6pDJ59GLfTEsewGPVsBPSxo_mgkd2qkSdezqZsTWAIK-js6AcVVdomCSisZSLw0GQNdo2JtFNdeTSJ77l2vv8rvyBFnNlddFCgL8uVG8T5hiyBdexf4smzMwgfqYiAtRf2voWxyjXZUxnl_HHkDMXXDH7I75yxav-mOhqIoCm66EFzDptvx1kYpxLXfZB9Ax_yMQAxdxIIK1Q3o9j0XIuARHqXB5KbB_SRK5bICV6_Bbw_-gYu9mtauapdkGGtA/https%3A%2F%2Fsatijalab.org%2Fseurat%2Freference%2Faddmodulescore function to compute a single score for a collection of genes for each spot

— Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/1_NN19kA2SrkeOjeoNfy0wH1Ln0H-wgJijqp6IzvdDLGAaGQ39-s64EmLUWheeS5ioKJkpEFoyzidl-qolxOKzQ4Nof3BWhI2TUeuEwY6_CnE08gXIVStBzkLwMjyZFW8kJmu8p2vpmgUYIkd1M4qUzf4UrOD-bw56ukFmraytkZvgQD8UG0HjuCjn7cofA_rCRm4kXRb_0QPRdGrR3m_2gEZX_64TYBfmtttGGcBCJNfw-d9ylEt5YxY6KdnOcmq4s4iHJH7HEeQCan98NOviUUh9ihms6Rztx1dVyeF3rUoD4uB4xsKyz2Bhk8kSafPqHxeSIWTxbZfm79-zfHwDg/https%3A%2F%2Fgithub.com%2Fsatijalab%2Fseurat%2Fissues%2F7463%23issuecomment-1604771464, or unsubscribehttps://secure-web.cisco.com/1lEF3q0i4v9SvueRLkp6GV1pCMhw6-Vdl_CVlPMoEH4FbvhXP-V4s6aeLouHS0KaHqf6o-qTwmRLlIIioRERRxN8CRyFoRcnSUXLtU6Dp_8cf-rftHsJ0O2CciYtMZsAqYxMIKsucYF4sAYSbDrA5qihaLeOl2of62ZxZ3ndKbebuyJlpZgTnow8vr9Ac7IyOmaoSqsymhSlnLe8Ho5X_J4JqNJtj1zwrdeYS206CA7SoAFN8POyug9opvkQ_kXZco_lx-Aq_2Z2LW5zhJp2aTXxPmVrw6i5Aw4kT4V4GgCxoxhkO_tcigVKYKcmpWoldFSHxzbX2R3Y4jws5idE8kw/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAXYDRTLD2SWSTZEVN563FRDXMXUZXANCNFSM6AAAAAAZJ4S324. You are receiving this because you were mentioned.Message ID: @.***> The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at https://www.massgeneralbrigham.org/complianceline https://www.massgeneralbrigham.org/complianceline . Please note that this e-mail is not secure (encrypted). If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately. Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail.

NyKepler commented 5 months ago

Unlist your feature list and it should work.