R error: "all entries of 'x' must be nonnegative and finite" leading to incomplete intersect of data -
i intersecting 2 files , afterwards doing fisher test , enrichment test on results. after running fisher test there error not understand.
> ee=c() > e=c() > (e in 1: length(conditions)) + { + for(i in 1: length(view)) + { + a=length(na.omit(intersect(conditions[,e], view[,i]))) + b=length(na.omit(intersect(conditions[,1], view[,i]))) + c=length(na.omit(conditions[,e])) + d=length(na.omit(conditions[,1])) + ee=c(ee, fisher.test(matrix(c(a,b-a,c-a,a-b-c+d),nrow=2,ncol=2) + ,alternative="two.sided")$p.val) + e=c(e, (a/b) / ((c-a)/(d-b)))
+ } + } error in fisher.test(matrix(c(a, b - a, c - a, - b - c + d), nrow = 2, : entries of 'x' must nonnegative , finite
ee
[1] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 [8] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 2.429018e-05 1.572763e-01 1.000000e+00 [15] 3.620512e-03 6.605189e-01 3.930938e-01 7.564593e-01 8.356520e-01 8.354842e-01 8.718355e-01 [22] 1.000000e+00 7.174337e-01 1.813913e-01 3.480816e-01 9.189262e-02 8.892926e-01 6.528839e-02 [29] 1.000000e+00 8.452332e-01 1.000000e+00 1.000000e+00 1.000000e+00
e
[1] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 [11] nan 0.2527881 0.6250381 0.9075342 2.1028830 0.8772727 0.6801843 1.1282051 0.8698752 0.9007353 [21] 0.9247312 nan 0.8624535 1.3294461 0.5018939 0.5030426 1.0376344 1.5870968 0.9445438 0.9242424 [31] 0.9570313 0.9907834 nan
the "conditions" dataframe contains 10 columns, , "view" dataframe contains 11 columns. after intersection expect 110 results come out of fisher test , enrichment caculation (e=c(e, (a/b) / ((c-a)/(d-b))) ) ,not 33 in output. there na's in both dataframes na.omit should take care of that, other values positive numerical values.
help appreciated.
Comments
Post a Comment