zcang / COMMOT

MIT License
75 stars 13 forks source link

Questions about the meaning of arrow lengths #20

Closed RYY0722 closed 9 months ago

RYY0722 commented 11 months ago

Hi there! Thanks a lot for the great work! Congrats!! I have some questions regarding the length of the arrows in the results of plot_cell_communication function. Does the length indicate the strength of the signal? I guess V only contains information about the direction, but when I divided V by 2, the arrow length shrinks. However, the parameter angles used in the matplotlib.pyplot.quiver is not specified, which becomes "uv" by default. Then it should be representing some orientations only. I become unsure about whether the scale of matrix V matters.

The function I used is

ct.pl.plot_cell_communication(adata_dis500, database_name='cellchat', pathway_name=pathway,
plot_method='grid', background_legend=True, scale=0.00008, ndsize=ndsize, grid_density=0.4, 
summary='sender', background='summary', clustering='leiden', cmap='summer',
 normalize_v = True, normalize_v_quantile=0.995,)

Would you please give me some advice regarding this? Can we obtain the signaling strength from your method? Thank you very much!

zcang commented 9 months ago

Hello,

I'm sorry for the late response. This function would visualize the vector field obtained from the function commot.tl.communication_direction which first computes a unit vector about the "signaling direction" and multiplies it by the "signaling strength" at each spot. So the length differences within the same plot give us a direct visualization of signaling strength difference. Since V describes the direction (i.e., u v in quiver plots), not the end point of the arrows, we are free to tweak the overall length scale by multiplying a scalar to V or change the scale parameter in the plotting function.

To get a sense of "signaling strength", we can simply do a row sum or column sum (for received or sent signal) on the spot-by-spot signaling matrices stored in obsp slots after you run commot.tl.spatial_communication. Please see here for more details: https://commot.readthedocs.io/en/latest/api/commot.tl.spatial_communication.html#commot.tl.spatial_communication.

Best, Zixuan