akdess / CaSpER

77 stars 28 forks source link

Negative TPR in calcROC() calcultation #71

Open Fabian-RY opened 2 years ago

Fabian-RY commented 2 years ago

I've tried to benchmark the results of CaSpER ( I used it to detect CNV events at gene level from bulk RNAseq data) using the calcROC function of this package. I found out that this function returned a negative true positive ratio of -0.04 which, as far as I know, it is impossible, because TPR is a ratio of counts so neither of the elements needed to calculate this value can be negative. I followed the vignette with the documentation and example data in the readme of this repository and then used calcROC to check my matrices.

tp <- sum(chrMat * chrMat2)

I checked the code of this function calcROC to know how it calculated the number of true positives and saw that this value is calculated as the product of both matrices (array and CaSpER) and them sum the values. I found this very strange. As the values in the matrices are only -1, 0 and 1, I can expect values of 1 (agreement between matrices), 0 (at least one don't have a cnv event) and -1 (matrices disagree). In my data however there are more disagreements than agreements. and therefore the sum was negative. But i think it doesn't make sense that the number of True Positives is negative or that the disagreements affect the number of true positives.

Why is this calculation implemented this way?