drieslab / Giotto

Spatial omics analysis toolbox
https://drieslab.github.io/Giotto_website/
Other
258 stars 98 forks source link

cellProximityHeatmap outputs partially wrong heatmap when scale=T #671

Open KoichiHashikawa opened 1 year ago

KoichiHashikawa commented 1 year ago

Hello Giotto team,

I really appreciate your team's huge contributions to the community by sharing and providing cutting edge spatial analysis platforms for recent years.

We have noticed discrepancy between the analysis results cellProximityBarplot and cellProximityHeatmap (some ranks in the cellProximityBarplot is not retained in cellProximityHeatmap) and did a bit dive into your original code.

We believe it arises from "scale = T" in cellProximityHeatmap.

https://github.com/drieslab/Giotto/blob/suite/R/spatial_interaction_visuals.R lines 132 to 135 are: if(scale == TRUE) { final_matrix <- t_flex(scale(t_flex(final_matrix))) #line 133 final_matrix <- t_flex(final_matrix). #line 134 final_matrix[lower.tri(final_matrix)] <- t_flex(final_matrix)[lower.tri(final_matrix)] #line 135, this is the suspicious line } I have run step by step and found that until #134 is working well, retaining the ranks of "enrichm", but #line 135 is mis-replacing the half of the columns with the wrong values.

best, Koichi

RubD commented 1 year ago

Thanks for letting us know and the proposed fix. We'll take a look soon and update if necessary.