comparison fisher_test.xml @ 0:5f784a95ce13 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/fisher_test commit 7d954797362ea5de843d812cb823ac1dd869e1df
author artbio
date Mon, 28 Aug 2017 13:25:56 -0400
parents
children 3a67bee2ef63
comparison
equal deleted inserted replaced
-1:000000000000 0:5f784a95ce13
1 <tool id="fishertest" name="Fisher's exact test" version="1.0.0">
2 <description>on two gene hit lists</description>
3 <requirements>
4 <!-- <requirement type="package" version="3.1.2">R</requirement> -->
5 <requirement type="package" version="2.4.2=r3.3.1_0">bioconductor-qvalue</requirement>
6 </requirements>
7 <command><![CDATA[
8 Rscript '$fisher_test' "\${GALAXY_SLOTS:-1}"
9 ]]></command>
10 <configfiles>
11 <configfile name="fisher_test">
12 <![CDATA[
13 ## Setup R error handling to go to stderr
14 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
15 options(warn=-1)
16 suppressMessages(library(qvalue))
17 library(parallel)
18 args = commandArgs(trailingOnly = TRUE)
19 slots = as.numeric(args[1])
20 countsTable = read.delim("${input}", header=TRUE, check.names=FALSE, stringsAsFactor = TRUE)
21 depth1 = sum(countsTable[,2])
22 depth2 = sum(countsTable[,3])
23 float_table=data.frame(countsTable[,2], countsTable[,3])
24
25 calc_pvalue <- function(row, depth1, depth2, ... ){
26 thearray = array( c(row, (depth1 - row[1]), (depth2 - row[2])), dim=c(2,2))
27 current_test = fisher.test( thearray )
28 return(current_test\$p.value)
29 }
30
31 cl <- makePSOCKcluster(slots)
32 clusterExport(cl=cl, varlist=c("calc_pvalue", "depth1", "depth2"))
33 ptm <- proc.time()
34 p_val = parApply(cl, float_table, 1, function(x) calc_pvalue(x, depth1, depth2))
35 stopCluster(cl)
36 proc.time() - ptm
37 p_val[p_val>1]=1
38 p = qvalue(p_val)
39 finalTable = cbind(countsTable, data.frame(p\$pvalues), data.frame(p\$qvalues))
40 write.table ( finalTable, file = "${output}", row.names=FALSE, col.names=TRUE, quote= FALSE, dec = ".", sep = "\t", eol = "\n")
41 ]]>
42 </configfile>
43 </configfiles>
44 <inputs>
45 <param name="input" type="data" format="tabular" label="gene hit lists, 2 samples"/>
46 </inputs>
47 <outputs>
48 <data name="output" format="tabular" label="Fisher test p-values" />
49 </outputs>
50 <tests>
51 <test>
52 <param name="input" value="counts.tab" ftype="tabular"/>
53 <output name="output" file="fisher.tab" ftype="tabular"/>
54 </test>
55 </tests>
56 <help>
57
58 **What it does**
59
60 Runs Fisher's exact test for testing the null of independence of rows and columns in a contingency table of two columns.
61
62 p.pvalues: the chance of getting this data if it is independent between columns (false negative); the p-value.
63
64 q.qvalues: FDR (Faslse Detection Rate) adjusted p-values; a q-value of 0.05 implies that 5% of significant tests will result in false positives.
65
66 Be aware that this test does not take into account the biological noise that would be visible if replicates were available.
67
68
69 </help>
70 <citations>
71 <citation type="doi">10.1111/1467-9868.00346</citation>
72 </citations>
73
74 </tool>