I want to get fisher score of this following list-like data by element wise. My apology to ask this statistical question from this community. However, my data contains list of overlap's significance score of 3 GRanges objects, I want to get its global fisher score by element-wise. How can I get this in R?
This is the data that I want to get its global score by element wise:
[[1]]
NumericList of length 7
[[1]] 1e-22
[[2]] 1e-19
[[3]] 1e-18
[[4]] 1e-16
[[5]] 1e-24
[[6]] 1e-20
[[7]] 1e-15
[[2]]
NumericList of length 7
[[1]] 1e-24
[[2]] 1e-24
[[3]] 1e-20
[[4]] 1e-25
[[5]] 0.1
[[6]] 1e-19
[[7]] 1e-18
[[3]]
NumericList of length 7
[[1]] 1e-11
[[2]] 1e-11
[[3]] 1e-10
[[4]] numeric(0)
[[5]] numeric(0)
[[6]] 1e-15
[[7]] numeric(0)
reproducible example are:
to replace numeric(0) with 0, try this:
v3 <- lapply(v3, function(x) {
res <- ifelse(length(x)>0, x, 0)
})
data <- DataFrame(
v1=c(1e-22,1e-19,1e-18,1e-16,1e-24,1e-20, 1e-15),
v2=c(1e-24,1e-24,1e-20,1e-25,0.1,1e-19,1e-18),
v3=c(1e-11,1e-11,1e-10,numeric(0),numeric(0),1e-15,numeric(0)))
my desired output something like (just example by element wise) :
global fisher score of `(1e-22, 1e-24, 1e-11)` = ?
global fisher score of `(1e-19, 1e-24, 1e-11)` = ?
...
global fisher score of `(1e-24, 1e-01, numeric(0))` = ?
I know fisher.test function from base packages can do fisher exact test. but it needs matrix as input, while I can't make my data as matrix. I put my data my desired format for element-wise operation.
I want to get global fisher score by element wise. How can I get this in R? Alternatively, If I used chisq.test, How can I obtain its chi-square statistics by element wise for above data table? I will be grateful if anyone can give me any idea for doing this.