comparison fisher_test.xml @ 0:c3facdc53ddc draft default tip

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