Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get histology in SPATA2 #176

Open
wuxiangning opened this issue Sep 29, 2024 · 15 comments
Open

how to get histology in SPATA2 #176

wuxiangning opened this issue Sep 29, 2024 · 15 comments

Comments

@wuxiangning
Copy link

{AC1C7C82-20B7-4A7F-AE3F-C3CC317EFDF0}
how to get histology in SPATA2?
I run it but only get NULL> getSpatSegmVarNames(object)#空值,curently only one: "histology"
No segmentation variables have been added. Use 'createSpatialSegmentation()' for that matter.
NULL
i try to draw something:object <- createImageAnnotations(object) or object <- createSpatialSegmentation(object)
but it only be defined one ids like infilitrated_ids! help!

@kueckelj
Copy link
Collaborator

kueckelj commented Oct 1, 2024

Hello, I am not exactly sure what you need. What is it, that you run that only returns 'histology'? getSpatSegmVarNames()? Do you want to group your spots based on histology by interactively creating a grouping variable as with createSpatialSegmentation() and you can't access it afterwads?

@wuxiangning
Copy link
Author

{56ED8AC8-69C4-4823-B448-D17D1504361D}
I mean, I want to create a pathology segmentation that I draw it refer to the tumor, invasion front, and normal area by createSpatialSegmentation(object), and then form a histology like the one you referred to in the tutorial, so that I can follow the tutorial and do the subsequent Spatial Trajectories Analysis.
But if I run createSpatialSegmentation(object) to create spatial orientations directly, which seems to be a no-brainer,But I can't directly indicate histology here
can you tell us how you implemented the creation histology at that time?

@wuxiangning
Copy link
Author

There is another problem that has been bothering me for a long time, when I want to use Bayesian for spatial clustering, this error appears.
But I look in my SPATA2, the coords_df information is stored in the object@spatial@coordinates, how can I solve this problem, Thank you very much.

object <- #!c("col", "row" %in% colnames(coords_df)): 参数类型无效

  • runBayesSpaceClustering(
  • object = object, 
    
  • name = "bayes_space", # the name of the output grouping variable
    
  • qs = 5
    
  • )
    错误于!c("col", "row" %in% colnames(coords_df)): 参数类型无效

@kueckelj
Copy link
Collaborator

kueckelj commented Oct 3, 2024

okay, so regarding the spatial segmentation. On the left, you need to create a variable first in which to store the histological labels (a column in the meta data.frame). I refer to these as spatial segmentation variables because you spatially divide the sample into multiple segments. You have not done that yet - at least in the screenshot you provide. Click on "Create New Segmentation Variable" and a pop up will appear which prompts you to enter a name, for instance 'histology' or 'histo_segmentation'. Then, on the left a surface plot appears colored by this variable which will be all grey cause you haven't added any segments so far. THEN you use the Interaction field to repeatedly encircle areas, highlight them, name them and save these labels which should immediately update the plot on the left (Overview).

@kueckelj
Copy link
Collaborator

kueckelj commented Oct 3, 2024

regarding bayes space clustering. Which branch are you currently using? master or dev? And what is the output of getCoordsDf()?

@wuxiangning
Copy link
Author

{CB10942C-3324-4541-B19B-EFBBF4AA2C5E}
Hello! This is my getCoordsDf() .It looks pretty normal.Right? But I don't quite understand where my branch looks? Is that my Github branch?

@wuxiangning
Copy link
Author

{9459F82D-2A49-4967-9AF6-D42ACDEA6EF0}
I've tried your tutorial before, but I still can't create two spatial segmentation variables under the named histology to indicate the tumor or normal.Whether there is a problem with which step? Thanks!

@kueckelj
Copy link
Collaborator

kueckelj commented Oct 4, 2024

There is a button below the segmentation plot called 'Name' as in "name this segment". Next to it is an empty text input in which you can enter the name of the segment. Then you clik on 'Name' which should save the segment and it should appear colored on the left.

  1. Draw segment. 2. Click on Connect. 3. Click on Highlight. 4. Enter the name you'd like to give this segment. 5. Click on Name. -> repeat.

You can only name one segment at a time. In this plot you have created two "outlines". The error message on the right bottom indicates that the second outline is not inside the first one. Only draw a second outline you want to use this outline to to create "holes" in the first outline.

Make sure to return the SPATA2 object by closing the app with the green button that says 'Close application'. Furthermore, make sure to reassign the results. my_object <- createSpatialSegmentation(my_object).

@kueckelj
Copy link
Collaborator

kueckelj commented Oct 4, 2024

Regarding the BayesSpace: It is a bug. I'll fix it and let you know once I updated the package.

kueckelj added a commit to kueckelj/SPATA2 that referenced this issue Oct 4, 2024
@kueckelj kueckelj mentioned this issue Oct 4, 2024
kueckelj added a commit that referenced this issue Oct 4, 2024
@kueckelj
Copy link
Collaborator

kueckelj commented Oct 4, 2024

Can you install the dev branch with devtools::install_github("theMILOlab/SPATA2", "dev") in a session that has just been started with no packages attached? Then try runBayesSpaceClustering() again. Does it work now?

@wuxiangning
Copy link
Author

Uploading 0bc56a63cb3ae72ccbd02bfc94b5dce.jpg…

R Code:
remove.packages("SPATA2")
detach("SPATA2")
library(devtools)
devtools::install_github("theMILOlab/SPATA2","dev")
library(SPATA2)
getGroupingOptions(object)
object<-
runBayesSpaceClustering(
object = object,
name = "bayes_space", # the name of the output grouping variable
qs = 5
)
Hello:
I re-uninstalled my SPATA2 with the above code, and after reinstalling, after importing my SPATA2 object, I found that there was no way to import the full spata2, it seemed that the contents were empty and could not do all the normal operations.

@wuxiangning
Copy link
Author

1de61695564c2e33e9d3ab9a86fdf1e

@wuxiangning
Copy link
Author

{659DC0CF-2D26-47D5-88EA-12FE4A3D1DFF}
Wow, this is a great method! I missed the part about naming first. However, I encountered two new issues when drawing:
1、First: I can’t perfectly draw the boundaries between the tumor, peritumoral region, and normal tissue as I intended. Is there a way I could roughly outline the boundaries between the tumor and normal tissue, and then have the rest of the area automatically labeled as the peritumoral region? That way, the defined tissue regions can be perfectly segmented.
2、Additionally, I found that createSpatialSegmentation(object) doesn't work like object <- createImageAnnotations(object) where I can annotate multiple areas , and createSpatialSegmentation(object) only allows single annotations. Is there a way to annotate multiple regions at once and assign them the same name? Currently, I can only annotate one by one and assign the same name to each, which is quite tedious. Moreover, I can only see the defined areas in the overview on the left and can't directly see the defined regions in the drawing area, which is not very convenient.

@kueckelj
Copy link
Collaborator

kueckelj commented Oct 6, 2024

  1. You can create a histology variable, lets call it 'histology', and then only outline what is tumor. Leave the rest "unnamed". Then close the application, return to the Rsession and use object <- renameGroups(object, grouping = "histology", "new_name" = "unnamed"). This way you only annotate the tumor regions and what is left unnamed becomes your input for 'new_name'.
  2. This is a valid point. Currently that is not possible but I'll add it to my to-do list and let you know when it's done.

@wuxiangning
Copy link
Author

1de61695564c2e33e9d3ab9a86fdf1e
I still haven't solved the problem of spatial clustering, I use the following code to try to fix the bug, but it still doesn't work

R Code:
remove.packages("SPATA2")
detach("SPATA2")
library(devtools)
devtools::install_github("theMILOlab/SPATA2","dev")
library(SPATA2)
getGroupingOptions(object)
object<-
runBayesSpaceClustering(
object = object,
name = "bayes_space", # the name of the output grouping variable
qs = 5
)
Hello:
I re-uninstalled my SPATA2 with the above code, and after reinstalling, after importing my SPATA2 object, I found that there was no way to import the full spata2, it seemed that the contents were empty and could not do all the normal operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants