scimap
scimap copied to clipboard
supplying additional groupings
Just wondering if there is support to add additional arguments into some functions to change the way the data is grouped other than by 'imageid'. eg in tl.foldchange 'from_group' could be another categorical variable in adata.obs, eg 'mutation1', and 'to_group' could be 'mutation2' similarly tl.spatial_interaction is performed by 'imageid', can these scores be further grouped by another adata.obs variable?
thanks
Hi, @jamesMo84 thankyou for your questions. I think the reason I restricted pulling data from a single column (tl.foldchange
) is to decrease the number of parameters the user
needs to worry about but that does impede flexibility. For now, it assumes that the cells belonging to mutation1
and mutation2
are referred to within the same column and you would pass that column name in the parameter imageid='some_column_name'
.
With regards to your question about tl.spatial_interaction
. Again the same reason. If you wish to have finer subcategories, the easiest way would be to create a new column that merges the information like so:
imageid | someother_column | merged_column |
---|---|---|
imageA | ROI_1 | imageA_ROI_1 |
imageA | ROI_2 | imageA_ROI_2 |
imageB | ROI_1 | imageB_ROI_1 |
imageB | ROI_2 | imageB_ROI_2 |
And then you can pass in the new column name into the imageid='merged_column'
parameter.
But note that if you are analyzing multiple images together, the unique imageid
information needs to be captured somehow (like the example above). As distances are calculated based on every image independently. For example, if you simply change the imageid= 'someother_column '
it can lead to spurious results as the X and Y coordinates will overlap between images (in most cases).
I am having same issue here. I have two conditions conditionA and conditionB within each image. After I run adata = sm.tl.spatial_distance. by different image, if I plot the the spatial distance with sm.pl.spatial_distance (adata, method='numeric',distance_from='Tumor', imageid='condition', log=True). does this cause overlap between images?