I think you mean rowScales instead of rowSums function.
Hi, I have a data table of gene expression which contains TPM value. So here I try to do a heatmap plot. So I scale by gene level at first and produce negative value. So why negative values comes up?
1 answer
OP mentioned in one of the comments that he is using rowScales functions for scaling and has not mentioned the package, while we guess it might be from scrime package.
The reason for getting negative values is because rowScales scales the row in a way such that the values in each row would have zero mean and a standard deviation of 1, thus producing negative values. As the scaling is being done to plot heatmap, the other way would be to perform log2(TPM) transformation and plot a heatmap and incase there are TPM values less than zero then log2(TPM+1) can be done as for the purpose of the heatmap, it won’t make much difference.
Thanks for pointing it out. Have made the modifications.
Log in to answer this question.
Can you include your code here?
rowScales(data) - Very simple code.
That's not as simple as you claim - which package is
rowScalesfrom? Why are you using it instead ofscale?Why don't you share us the
packagename used in R? Tell us about the functionrowScalesWhat kind of scaling have you done?
If it's
log scaleorzscorethere will be negative values for values less than 1