Scaling Gene Set Heatmap


I am currently trying to plot a selection of gene sets on a heat map via the following overall workflow:

1)DEG analysis
3) on ~20 relevant gene sets
4)using to plot the gene sets

I set the standard_scale parameter to “vars” in order to scale all the gene set values to between 0 and 1, and it looks quite good. Is there a way to scale the gene set values so they instead fall between -1 and 1?

Thanks for all the great work and any help you can provide!


I’m entirely sure about this but you may try vcenter, vmax, vmin. Let me know if it works!


1 Like

I ended up using the following solution that GitHub copilot generated for me, and it seems to work quite well. I basically use the sklearn MinMaxScaler to scale the column of the obs dataframe containing the score_gene() output for each gene set. Do you think this is appropriate in this context?

I’m not sure to be honest, but it’s worth a shot to try. The parameters I suggested earlier are directly part of the heatmap function so may be easier to implement. Whatever gets you the result you’re looking for :slight_smile: