1

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.

  • [How to make a great R reproducible example?](http://stackoverflow.com/questions/5963269) – zx8754 Jul 11 '16 at 07:46
  • Is [this](http://stackoverflow.com/users/6070577/datageek) your classmate, asked the [same question and deleted](http://stackoverflow.com/questions/38280952), though it had a reproducible example data: – zx8754 Jul 11 '16 at 07:57
  • I really don't know, apparently I couldn't get enough information about him to know ID. I cannot see that deleted question and did not know data the that he got was same with mine.However, I am facing this issue when I implementing my own utility function, and need to solve this issues. Any Idea for the problem that I raised? Thanks –  Jul 11 '16 at 08:11
  • 1
    @zx8754: As you suggested, I added my reproducible example. Thanks –  Jul 11 '16 at 08:25

1 Answers1

0

this is the solution for getting global fisher score by using Fisher' method:

library(metap)
comb.pval <- suppressWarnings(
  res <- apply(data[,1:3],1, function(ro) sumlog(ro)$p)
)

cheers

Jurat