ftest.fun: Fisher Exact Test for miRNA Enrichment

Usage Arguments Examples

Usage

1
ftest.fun(dat = x, fg = fg, bg = bg, col = col)

Arguments

dat
fg
bg
col

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (dat = x, fg = fg, bg = bg, col = col) 
{
    fg.total = nrow(fg)
    expr.total = nrow(bg) - nrow(fg)
    targets = unique(as.character(dat$Gene.Symbol))
    fg.yes = length(intersect(unique(as.character(fg[, col])), 
        targets))
    expr.yes = length(intersect(unique(as.character(bg[, col])), 
        targets))
    expr.yes = expr.yes - fg.yes
    fg.no = fg.total - fg.yes
    expr.no = expr.total - expr.yes
    mat = matrix(c(fg.yes, expr.yes, fg.no, expr.no), nrow = 2, 
        dimnames = list(c("Downreg", "Expressed"), c("present", 
            "absent")))
    ftest = fisher.test(mat, alternative = "greater")
    res = data.frame(Foreground.Present = fg.yes, Foreground.Absent = fg.no, 
        Foreground.Total = fg.total, Background.Present = expr.yes, 
        Background.Absent = expr.no, Background.Total = expr.total, 
        estimate = ftest$estimate, pvalue = ftest$p.value)
  }

komalsrathi/miRNAEnrich documentation built on May 20, 2019, 12:55 p.m.