ludvigla / semla

Other
47 stars 6 forks source link

Any advice about intereacting with Seurat? #4

Closed yunbokai closed 9 months ago

yunbokai commented 1 year ago

Hi authors! It's great to see that STUtility has launched an upgraded version quickly, and it's more compatible with Seurat objects. However, I have some questions. My Seurat object has a lot of metadata information (including sample information and data analysis results) and newly created assays. Besides, the data has also been processed with SCT normalization, etc. But it seems that I can only choose to add more columns when creating semla objects to import the previously analyzed metadata, and it's not very convenient to switch between semla's Seurat objects and regular Seurat objects during the data analysis process. In my ideal thought, I can easily transform my previous Seurat analysis results into a semla result, so that I do not need to recalculate my raw data again. Do you have any suggestions for this?

ludvigla commented 1 year ago

Hi yunbokai,

Did you create the object with STUtility? In that case you can try to update the object with the UpdateSTUtilityV1Object function: https://ludvigla.github.io/semla/reference/UpdateSTUtilityV1Object.html

Could you provide some more details about how the Seurat object was processed?

Cheers, Ludvig

yunbokai commented 1 year ago

Hi, @ludvigla I didn't have a STUtility obj. I have already processed my data by Seurat and got a complex result like: Seurat_obj

An object of class Seurat 40523 features across 4750 samples within 7 assays Active assay: SCT (19472 features, 3000 variable features) 6 other assays present: Spatial, dorothea, progeny, user_gsets_wmean, user_gsets_mlm, user_gsets_ulm 3 dimensional reductions calculated: pca, umap, tsne 1 image present: T112 These days I used the code you provided in https://ludvigla.github.io/semla/articles/create_object.html to trans my seurat data to selma seurat data successfully. However the function semla::FeatureViewer() didn't work in my pc and my colleague‘s . We didn't initiate the viewer. I'm not sure is it our computer's problem? how to check it? image Thanks for your attention! Best, Yunbokai

ludvigla commented 1 year ago

Hi!

Did you get any error messages or did the function just freeze at the tiling step?

/Ludvig

lfranzen commented 10 months ago

Hi @yunbokai, We wanted to inform you that we have now made a new function called UpdateSeuratForSemla() that allows you to make an object created with Seurat compatible with semla. By updating your object using this function you should now be able to use both the Seurat spatial functionalities as well as all functions within semla. Hopefully this will help you with your analyses and your initial request!

Closing this issue due to inactivity.

cjhong commented 10 months ago

Ludvigla

First of all, thank you so much for the great analysis pipeline for spatial tx data. I successfully installed semla, shinyBS, beakr, and colourpicker in my RStudio server (within the same local network) in Linux. This is what I did.

se = UpdateSeuratForSemla(seurat_obj) se = LoadImages(se) se = FeatureView(se) # Nothing happened as shown in the figure above

My R version is 4.2.2

ludvigla commented 10 months ago

Hi @cjhong,

I'm pretty sure that the issue is that you are running the code from an RStudio server. If I understand it correctly, the app without errors but then nothing happens?

I added an option to set the browser manually in FeatureViewer. If you set launch.browser = getOption("viewer") it should run in the RStudio viewer:

FeatureViewer(..., launch.browser = getOption("viewer"))

Not an optimal solution, but it worked fine when I ran it locally. I'll look into it and see if I can come up with a better solution.

/Ludvig

ludvigla commented 10 months ago

Seems like there's an issue with the magick R package when using multiple threads on linux.

Try this:

FeatureViewer(..., nCores = 1)

Although I suspect it will fail to load the H&E image tiles.

/Ludvig

cjhong commented 10 months ago

I upgraded to 1.1.5. se=FeatureViewer(se, launch.browser = getOption("viewer"), nCores=1) Yep! Now I can see a window to interact with! but no image :(

On Wed, Sep 6, 2023 at 5:06 PM ludvigla @.***> wrote:

Seems like there's an issue with the magick R package when using multiple threads on linux.

Try this:

FeatureViewer(..., nCores = 1)

Although I suspect it will fail to load the H&E image tiles.

/Ludvig

— Reply to this email directly, view it on GitHub https://github.com/ludvigla/semla/issues/4#issuecomment-1709118297, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXOWOUJ4OR3ORAE3LIGICLXZDQU5ANCNFSM6AAAAAAWSJWDXM . You are receiving this because you were mentioned.Message ID: @.***>

ludvigla commented 10 months ago

Are you running the RStudio server from a docker container?

I managed to get it running using rocker/rstudio:4.3.

sudo docker run -d -p 1337:8787 -p 3030:3030 --name test -e PASSWORD=<YOURPASSWORD> --memory=16g --mount type=bind,source="<SOMEDIRECTORY>",target=/home/rstudio -e ROOT=TRUE rocker/rstudio:4.3

The key here is to use the -p flag flag to you publish the container's specific port(s) to the Docker host.

Once the container is up and running, go to http://localhost:1337 and login. Install the remotes R package and then the latest semla version: remotes::install_url("https://github.com/ludvigla/semla/releases/download/v1.1.5/semla_1.1.5.tar.gz")

You also need to install additional packages for Ubuntu to be able to install some of the dependencies:

sudo apt-get update
sudo apt-get install libglpk-dev
sudo apt-get install libmagick++-dev

Then, once semla is installed, I could run:

library(semla)
se_mbrain <- readRDS(system.file("extdata/mousebrain",  "se_mbrain", package = "semla"))
se_mbrain <- LoadImages(se_mbrain)

se_mbrain <- FeatureViewer(se_mbrain, nCores = 1, host = "0.0.0.0", port = 3030)

I hope this helps.

/Ludvig

cjhong commented 10 months ago

After I configure a port forwarding in ssh, It works successfully! Thank you so much for your help, ludvigla

On Thu, Sep 7, 2023 at 11:30 AM ludvigla @.***> wrote:

Reopened #4 https://github.com/ludvigla/semla/issues/4.

— Reply to this email directly, view it on GitHub https://github.com/ludvigla/semla/issues/4#event-10308910017, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXOWOUNIRJJ4MRX4GVNP6LXZHSATANCNFSM6AAAAAAWSJWDXM . You are receiving this because you were mentioned.Message ID: @.***>

ludvigla commented 10 months ago

Fantastic!

Could you please share your solution? If someone else want to use a similar setup.

/Ludvig