Mercurial > repos > bgruening > music_construct_eset
comparison construct_eset.xml @ 0:2cfd0db49bbc draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
author | bgruening |
---|---|
date | Sun, 12 Sep 2021 19:49:12 +0000 |
parents | |
children | be91cb6f48e7 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:2cfd0db49bbc |
---|---|
1 <tool id="music_construct_eset" name="Construct Expression Set Object" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" | |
2 profile="20.05" license="GPL-3.0-or-later" > | |
3 <description>Create an ExpressionSet object from tabular and textual data</description> | |
4 <macros> | |
5 <import>macros.xml</import> | |
6 </macros> | |
7 <expand macro="requirements" /> | |
8 <command detect_errors="exit_code"><![CDATA[ | |
9 Rscript --vanilla '$conf' | |
10 ]]></command> | |
11 <configfiles> | |
12 <configfile name="conf" > | |
13 | |
14 suppressWarnings(suppressPackageStartupMessages(library(xbioc))) | |
15 suppressWarnings(suppressPackageStartupMessages(library(MuSiC))) | |
16 | |
17 null_str_vec = function(gstr){ | |
18 tokens = unlist(as.vector(strsplit(gstr, split=","))) | |
19 if (length(tokens) == 0){ | |
20 return(NULL) | |
21 } | |
22 if (length(tokens) == 1){ | |
23 return(tokens[[1]]) | |
24 } | |
25 return(tokens) | |
26 } | |
27 | |
28 ## Assay Data | |
29 ## F rows of features and S columns of samples | |
30 ## - This file is the only non-optional parameter | |
31 exprs_file = '$exprs_file' | |
32 exprs = as.matrix(read.table(exprs_file, header = T, sep = "\t", | |
33 row.names = 1, as.is = T)) | |
34 ## Phenotype Data | |
35 ## S rows of samples, and V columns of covariates (e.g. sex, age, etc.) | |
36 pdata = NULL | |
37 #if '$pdata_file': | |
38 pdata_file = '$pdata_file' | |
39 pdata = read.table(pdata_file, row.names = 1, header = T, sep = "\t", as.is=T) | |
40 #end if | |
41 ## Annotation and Feature Data, or just a string for type of chip used | |
42 annotation = null_str_vec('$annotation') | |
43 | |
44 if (all(rownames(pdata) != colnames(exprs))) { | |
45 stop("Number of Samples between phenotypes and assays are not the same") | |
46 } | |
47 | |
48 ##metadata = data.frame( | |
49 ## labelDescription = c( | |
50 ## "Patient gender", | |
51 ## "Case/Control", | |
52 ## "Tumor progress"), | |
53 ## row.names = c("gender", "type", "score")) | |
54 metadata = as.data.frame(do.call(rbind, list( | |
55 #for i, row in enumerate($metadata): | |
56 #if i==0 | |
57 list(ldesc='$row.label_desc', lname='$row.row_names') | |
58 #else | |
59 ,list(ldesc='$row.label_desc', lname='$row.row_names') | |
60 #end if | |
61 #end for | |
62 ))) | |
63 metadata\$labelDescription = unlist(metadata\$ldesc) | |
64 rownames(metadata) = unlist(metadata\$lname) | |
65 metadata\$ldesc = NULL | |
66 metadata\$lname = NULL | |
67 | |
68 if (nrow(metadata)==0) { | |
69 metadata = NULL | |
70 } | |
71 | |
72 pheno_data = new("AnnotatedDataFrame", data = pdata, varMetadata = metadata) | |
73 | |
74 ## Experiment Description -- using the MIAME object | |
75 experiment_data = new( | |
76 "MIAME", | |
77 name = null_str_vec('$expdata.name'), | |
78 lab = null_str_vec('$expdata.lab'), | |
79 contact = null_str_vec('$expdata.contact'), | |
80 title = null_str_vec('$expdata.title'), | |
81 abstract = null_str_vec('$expdata.abstract'), | |
82 url = null_str_vec('$expdata.url'), | |
83 other = list( | |
84 #for i, row in enumerate($expdata.other): | |
85 #if i==0 | |
86 '$row.field' = null_str_vec('$row.comment') | |
87 #else | |
88 ,'$row.field' = null_str_vec('$row.comment') | |
89 #end if | |
90 #end for | |
91 )) | |
92 | |
93 e_set = ExpressionSet(assayData = exprs, | |
94 phenoData = pheno_data, | |
95 experimentData = experiment_data, | |
96 annotation = annotation) | |
97 | |
98 capture.output(print(e_set), file = '$out_tab') | |
99 saveRDS(e_set, file= '$out_rds') | |
100 | |
101 </configfile> | |
102 </configfiles> | |
103 <inputs> | |
104 <param name="exprs_file" label="Assay Data" type="data" format="tabular,tsv" | |
105 help="F rows of features and S columns of samples. A Tab delimited file, with a header line and the first column has row names." /> | |
106 <param name="pdata_file" label="Phenotype Data" type="data" | |
107 format="tabular,tsv" optional="true" | |
108 help="S rows of samples, and V columns of covariates (e.g. sex, age)" /> | |
109 <param name="annotation" label="Annotation" type="text" | |
110 optional="true" help="A string detailing which chip was used" > | |
111 <expand macro="validator_text_and_urls" /> | |
112 </param> | |
113 <repeat name="metadata" title="Meta Data" min="0" max="15" > | |
114 <!-- optional, so min=0 --> | |
115 <param name="row_names" label="Label" type="text" > | |
116 <expand macro="validator_text_and_urls" /> | |
117 </param> | |
118 <param name="label_desc" label="Label Description" type="text" > | |
119 <expand macro="validator_text_and_urls" /> | |
120 </param> | |
121 </repeat> | |
122 <section name="expdata" title="Experiment Data" > | |
123 <param name="name" label="Experimenter Name" type="text" value="" optional="true" > | |
124 <expand macro="validator_text_and_urls" /> | |
125 </param> | |
126 <param name="lab" label="Lab" type="text" value="" optional="true" > | |
127 <expand macro="validator_text_and_urls" /> | |
128 </param> | |
129 <param name="contact" label="Contact" type="text" value="" optional="true" > | |
130 <expand macro="validator_text_and_urls" /> | |
131 </param> | |
132 <param name="title" label="Title" type="text" value="" optional="true" > | |
133 <expand macro="validator_text_and_urls" /> | |
134 </param> | |
135 <param name="abstract" label="Abstract" type="text" value="" optional="true" > | |
136 <expand macro="validator_text_and_urls" /> | |
137 </param> | |
138 <param name="url" label="URL" type="text" value="" optional="true" > | |
139 <expand macro="validator_text_and_urls" /> | |
140 </param> | |
141 <repeat name="other" title="Other Fields" min="1"> | |
142 <param name="field" label="FieldName" type="text" value="notes" > | |
143 <expand macro="validator_text_and_urls" /> | |
144 </param> | |
145 <param name="comment" label="Comment" type="text" value="Created in Galaxy" > | |
146 <expand macro="validator_text_and_urls" /> | |
147 </param> | |
148 </repeat> | |
149 </section> | |
150 </inputs> | |
151 <outputs> | |
152 <data name="out_tab" format="tabular" label="${tool.name} on ${on_string}: General Info" /> | |
153 <data name="out_rds" format="rdata.eset" label="${tool.name} on ${on_string}: RData ESet Object" /> | |
154 </outputs> | |
155 <tests> | |
156 <test expect_num_outputs="2" > | |
157 <!-- Values from the manual --> | |
158 <param name="exprs_file" value="array.tsv" /> | |
159 <param name="pdata_file" value="pheno.tsv" /> | |
160 <param name="annotation" value="hgu95av2" /> | |
161 <repeat name="metadata" > | |
162 <param name="row_names" value="gender" /> | |
163 <param name="label_desc" value="Patient gender" /> | |
164 </repeat> | |
165 <repeat name="metadata" > | |
166 <param name="row_names" value="type" /> | |
167 <param name="label_desc" value="Case/control status" /> | |
168 </repeat> | |
169 <repeat name="metadata" > | |
170 <param name="row_names" value="score" /> | |
171 <param name="label_desc" value="Tumor Progress on XYZ scale" /> | |
172 </repeat> | |
173 <section name="expdata"> | |
174 <param name="name" value="Pierre Fermat" /> | |
175 <param name="lab" value="Francis Galton Lab" /> | |
176 <param name="contact" value="pfermat@lab.not.exist" /> | |
177 <param name="title" value="Smoking-Cancer Experiment" /> | |
178 <param name="abstract" value="An example ExpressionSet" /> | |
179 <param name="url" value="www.lab.not.exist" /> | |
180 <repeat name="other" > | |
181 <param name="field" value="notes" /> | |
182 <param name="comment" value="Created in Galaxy" /> | |
183 </repeat> | |
184 <repeat name="other" > | |
185 <param name="field" value="general" /> | |
186 <param name="comment" value="Some other comment" /> | |
187 </repeat> | |
188 </section> | |
189 <output name="out_tab"> | |
190 <assert_contents> | |
191 <has_text text="assayData: 3 features, 2 samples " /> | |
192 </assert_contents> | |
193 </output> | |
194 </test> | |
195 </tests> | |
196 <help><![CDATA[ | |
197 Construct an ExpressionSet object from a variety of input attributes, such as experimentData, phenotype data, and annotations. | |
198 | |
199 For more options and information, consult `the manual <http://www.bioconductor.org/packages/release/bioc/vignettes/Biobase/inst/doc/ExpressionSetIntroduction.pdf>`_ and the `rdocumentation <https://www.rdocumentation.org/packages/Biobase/versions/2.32.0/topics/ExpressionSet>`_ | |
200 . | |
201 ]]></help> | |
202 <citations> | |
203 <citation type="bibtex"> | |
204 @misc{falcon2007introduction, | |
205 title={An introduction to bioconductor’s expressionset class}, | |
206 author={Falcon, Seth and Morgan, Martin and Gentleman, Robert}, | |
207 year={2007} | |
208 } | |
209 </citation> | |
210 </citations> | |
211 </tool> |