Spectre icon indicating copy to clipboard operation
Spectre copied to clipboard

transpose = T/F in make.pheatmap() produced inconsistent results

Open denvercal1234GitHub opened this issue 3 years ago • 3 comments

Hi there,

Thank you for the package.

When I plotted the same data and markers but with transpose=T or transpose = F, the expression for markers per cluster were different. For example, cluster 5 showed much more expression for more markers compared to that shown for cluster 5 when transpose = T.

Would you mind helping me clarify potential source of this inconsistency?

Note I used only a few markers in run.flowsom(), but I set use.cols in make.pheatmap and do.aggregate = to all cellular markers because I want to visualize the median expression of all markers and not only markers that were used in the clustering.

Thank you again.

exp_all_cellular.cols <- do.aggregate(F33_data.list_cell.dat_runflowsom_cellular.cols, use.cols=all_cellular.cols, by = "FlowSOM_metacluster")

make.pheatmap(exp_all_cellular.cols, "FlowSOM_metacluster", plot.cols = all_cellular.cols, transpose = F)

make.pheatmap(exp_all_cellular.cols, "FlowSOM_metacluster", plot.cols = all_cellular.cols, transpose = T)
Screenshot 2022-10-20 at 00 36 47 Screenshot 2022-10-20 at 00 37 02

denvercal1234GitHub avatar Oct 19 '22 23:10 denvercal1234GitHub

It may have been due to the normalisation function applied to each column. By default, normalise parameter is set to TRUE, which I think transform the values between the range of 0 to 1 based on the min and max value in each column: x_ij=(x_ij-min(col_i) / (max(col_i) - min(col_i)) for cell j's marker i. When transforming, the columns and rows are swapped, which caused the min and max values to be different. Perhaps try setting normalise to FALSE?

ghar1821 avatar Jan 29 '23 22:01 ghar1821

@ghar1821 spot on! @denvercal1234GitHub normalisation will run on the columns, regardless of whether it has been transposed or not.

tomashhurst avatar Jan 31 '23 08:01 tomashhurst

Thank you @tomashhurst and @ghar1821! I am confused. Would you mind clarifying whether the below statement is accurate?

Q1. If transpose = T, normalise=T, then does it mean the marker expression in the heatmap are first aggregated within a cluster with do.aggregate (with default parameters), then expression of each marker is normalised between 0-1 within each cluster?

Q2. Does transpose happens first or normalise happens first?

denvercal1234GitHub avatar Jun 22 '23 09:06 denvercal1234GitHub