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