Hi,

I am trying to run fgsea on ranked p-values, but keep getting the same error:

res <- fgsea(pathways = mylist, stats = rank(-p.val), eps = 0, scoreType = "pos",nPermSimple = 100000)
    "Error in if (any(simpleFgseaRes$modeFraction < 10)) { :    missing value where TRUE/FALSE needed"

I checked one hundred times already that the vector names are the same as the ones in the pathway list.

I am new to R and fgsea, but after some attempts to debug, I figured that for one pathway, I keep getting NA for results.

    Browse[2]> counts[[1]][420:430,]
    pathway  leEs  geEs leZero geZero leZeroSum geZeroSum
 1:     420 99257   743      0  1e+05         0  26201.27
 2:     421  1135 98865      0  1e+05         0  28324.93
 3:     422 29269 70731      0  1e+05         0  32941.02
 4:     423 29571 70429      0  1e+05         0  36958.29
 5:     424 59529 40471      0  1e+05         0  28029.62
 6:     425    NA    NA     NA     NA       NaN       NaN
 7:     426 83255 16745      0  1e+05         0  28093.93
 8:     427 28468 71532      0  1e+05         0  32573.34
 9:     428 84112 15888      0  1e+05         0  37584.64
10:     429 96643  3357      0  1e+05         0  29239.96
11:     430   497 99503      0  1e+05         0  27778.11

I believe this is the issue, but have no idea how to solve it.
I noticed that the pathway with issue has a large size: 1885 compared to the number of stats (1978).

Browse[2]> length(stats)
[1] 1978

Not sure if this could affect the results some how. In total, there are 500 pathways in the list.

Any help is very much appreciated. =)



Source link