comparison rtsne.xml @ 0:ac9e08add934 draft default tip

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