comparison rtsne.xml @ 0:dd53658a0843 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tsne commit 62172bde663955b6c3cb86dc22c47739824f014a
author iuc
date Tue, 22 Aug 2017 07:38:53 -0400
parents
children 53cfe6f313b3
comparison
equal deleted inserted replaced
-1:000000000000 0:dd53658a0843
1 <tool id="tsne" name="rtsne" version="0.0.2">
2 <requirements>
3 <requirement type="package">r-getopt</requirement>
4 <requirement type="package">r-rtsne</requirement>
5 <requirement type="package">r-ggplot2</requirement>
6 </requirements>
7 <command detect_errors="exit_code"><![CDATA[
8 cat '$script' &&
9 Rscript '$script' &&
10 mv output_plot.pdf $output1
11 ]]></command>
12 <configfiles>
13 <configfile name="script"><![CDATA[
14 ## Setup R error handling to go to stderr
15 options(show.error.messages=F, error=function(){cat(geterrmessage(),file=stderr());q("no",1,F)})
16 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
17
18 ## Import library
19 library(Rtsne)
20 library(ggplot2)
21
22 all <- read.delim('$input1', sep='\t', header=TRUE)
23
24 data = $data
25 name = $name
26
27 #if $transform == "none"
28 log.all <- all[, data:ncol(all)]
29 #elif $transform == "log2"
30 log.all <- log2(all[, data:ncol(all)])
31 #elsif $transform == "log2plus1"
32 log.all <- log2(1+all[, data:ncol(all)])
33 #elif $transform == "log10"
34 log.all <- log(all[, data:ncol(all)])
35 #elif $transform == "log10plus1"
36 log.all <- log(1+all[, data:ncol(all)])
37 #end if
38
39 ## Show/hide legend
40 #if $legend == "yes"
41 gg_legend = NULL
42 #else
43 gg_legend = theme(legend.position="none")
44 #end if
45
46 set.seed($seed) ## Sets seed for reproducibility
47 tsne_out <- Rtsne(as.matrix(log.all[,1:ncol(log.all)]), perplexity=$perp, theta=$theta) ## Run TSNE
48
49 embedding <- as.data.frame(tsne_out\$Y)
50 embedding\$Class <- as.factor(sub("Class_", "", all[,name]))
51
52 ggplot(embedding, aes(x=V1, y=V2, color=Class)) +
53 geom_point(size=1.25) +
54 gg_legend +
55 xlab("") +
56 ylab("") +
57 ggtitle('$title')
58
59 ggsave(file='output_plot.pdf')
60 dev.off()
61
62 ]]></configfile>
63 </configfiles>
64
65 <inputs>
66 <param name="input1" type="data" format="tabular"
67 label="Tabular input dataset"
68 help="Input should have column headers with an identifier column followed by consencutive numerical columns used for clustering"/>
69 <param name="title" type="text" format="txt" label="Plot title"/>
70 <param name="seed" value="42.0" type="float" label="Seed value for reproducibiity" help="Set to 42 as default" />
71 <param name="perp" value="10.0" type="float" label="perplexity"/>
72 <param name="theta" value="1.0" type="float" label="theta"/>
73 <param name="name" value="1" type="data_column" data_ref="input1"
74 label="The column with the ID to use in grouping (or just an ID if plotting invdividuals)"/>
75 <param name="data" value="2" type="data_column" data_ref="input1"
76 label="The column that contains the first numerical data"/>
77 <param name="transform" type="select" label="Advanced - log transformation">
78 <option value="none">Plot the data as it is</option>
79 <option value="log2">Log2(value) transform my data</option>
80 <option value="log2plus1">Log2(value+1) transform my data</option>
81 <option value="log10">Log10(value) transform my data</option>
82 <option value="log10plus1">Log10(value+1) transform my data</option>
83 </param>
84
85 <param name="legend" type="select" label="Legend options">
86 <option value="yes">Include legend on plot</option>
87 <option value="no">Hide legend</option>
88 </param>
89 </inputs>
90 <outputs>
91 <data name="output1" format="pdf" from_work_dir="Rplot.pdf"/>
92 </outputs>
93 <tests>
94 <test>
95 <param name="input1" value="mtcars.txt"/>
96 <param name="transform" value="none"/>
97 <param name="perp" value="10.0"/>
98 <output name="output1" file="Rplot.pdf"/>
99 </test>
100 </tests>
101 <help><![CDATA[
102 T-distributed Stochastic Neighbor Embedding implementation by Van der Maaten (see <https://github.com/lvdmaaten/bhtsne/>
103 for more information on the original implementation).
104
105 Your data should be in tabular format. Objects in rows will be clustered according to the observations in columns.
106 Labels for objects can be assigned in the tool form by providing the column number of the identifier you wish to use.
107 Additionaly, the first column containing numeric data should be provided to the tool form.
108
109 ]]></help>
110 <citations>
111 <citation type="bibtex">
112 @Manual{,
113 title = {{Rtsne}: T-Distributed Stochastic Neighbor Embedding using
114 Barnes-Hut Implementation},
115 author = {Jesse H. Krijthe},
116 year = {2015},
117 note = {R package version 0.13},
118 url = {https://github.com/jkrijthe/Rtsne},
119 }
120 </citation>
121 </citations>
122 </tool>