Mercurial > repos > bgruening > music_construct_eset
comparison construct_eset.xml @ 1:be91cb6f48e7 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
author | bgruening |
---|---|
date | Fri, 26 Nov 2021 15:55:11 +0000 |
parents | 2cfd0db49bbc |
children | 7902cd31b9b5 |
comparison
equal
deleted
inserted
replaced
0:2cfd0db49bbc | 1:be91cb6f48e7 |
---|---|
12 <configfile name="conf" > | 12 <configfile name="conf" > |
13 | 13 |
14 suppressWarnings(suppressPackageStartupMessages(library(xbioc))) | 14 suppressWarnings(suppressPackageStartupMessages(library(xbioc))) |
15 suppressWarnings(suppressPackageStartupMessages(library(MuSiC))) | 15 suppressWarnings(suppressPackageStartupMessages(library(MuSiC))) |
16 | 16 |
17 null_str_vec = function(gstr){ | 17 null_str_vec = function(gstr, is.str=FALSE){ |
18 tokens = unlist(as.vector(strsplit(gstr, split=","))) | 18 tokens = unlist(as.vector(strsplit(gstr, split=","))) |
19 if (length(tokens) == 0){ | 19 if (length(tokens) == 0){ |
20 if (is.str){ | |
21 return(character(0)) | |
22 } | |
20 return(NULL) | 23 return(NULL) |
21 } | 24 } |
22 if (length(tokens) == 1){ | 25 if (length(tokens) == 1){ |
23 return(tokens[[1]]) | 26 return(tokens[[1]]) |
24 } | 27 } |
38 pdata_file = '$pdata_file' | 41 pdata_file = '$pdata_file' |
39 pdata = read.table(pdata_file, row.names = 1, header = T, sep = "\t", as.is=T) | 42 pdata = read.table(pdata_file, row.names = 1, header = T, sep = "\t", as.is=T) |
40 #end if | 43 #end if |
41 ## Annotation and Feature Data, or just a string for type of chip used | 44 ## Annotation and Feature Data, or just a string for type of chip used |
42 annotation = null_str_vec('$annotation') | 45 annotation = null_str_vec('$annotation') |
46 if (is.null(annotation)){ | |
47 annotation = character(0) | |
48 } | |
43 | 49 |
44 if (all(rownames(pdata) != colnames(exprs))) { | 50 if (all(rownames(pdata) != colnames(exprs))) { |
45 stop("Number of Samples between phenotypes and assays are not the same") | 51 stop("Number of Samples between phenotypes and assays are not the same") |
46 } | 52 } |
47 | 53 |
64 rownames(metadata) = unlist(metadata\$lname) | 70 rownames(metadata) = unlist(metadata\$lname) |
65 metadata\$ldesc = NULL | 71 metadata\$ldesc = NULL |
66 metadata\$lname = NULL | 72 metadata\$lname = NULL |
67 | 73 |
68 if (nrow(metadata)==0) { | 74 if (nrow(metadata)==0) { |
69 metadata = NULL | 75 pheno_data = new("AnnotatedDataFrame", data = pdata) |
70 } | 76 } else { |
71 | 77 pheno_data = new("AnnotatedDataFrame", data = pdata, varMetadata = metadata) |
72 pheno_data = new("AnnotatedDataFrame", data = pdata, varMetadata = metadata) | 78 } |
79 | |
73 | 80 |
74 ## Experiment Description -- using the MIAME object | 81 ## Experiment Description -- using the MIAME object |
75 experiment_data = new( | 82 experiment_data = new( |
76 "MIAME", | 83 "MIAME", |
77 name = null_str_vec('$expdata.name'), | 84 name = null_str_vec('$expdata.name', is.str=T), |
78 lab = null_str_vec('$expdata.lab'), | 85 lab = null_str_vec('$expdata.lab', is.str=T), |
79 contact = null_str_vec('$expdata.contact'), | 86 contact = null_str_vec('$expdata.contact', is.str=T), |
80 title = null_str_vec('$expdata.title'), | 87 title = null_str_vec('$expdata.title', is.str=T), |
81 abstract = null_str_vec('$expdata.abstract'), | 88 abstract = null_str_vec('$expdata.abstract', is.str=T), |
82 url = null_str_vec('$expdata.url'), | 89 url = null_str_vec('$expdata.url', is.str=T), |
83 other = list( | 90 other = list( |
84 #for i, row in enumerate($expdata.other): | 91 #for i, row in enumerate($expdata.other): |
85 #if i==0 | 92 #if i==0 |
86 '$row.field' = null_str_vec('$row.comment') | 93 '$row.field' = null_str_vec('$row.comment', is.str=T) |
87 #else | 94 #else |
88 ,'$row.field' = null_str_vec('$row.comment') | 95 ,'$row.field' = null_str_vec('$row.comment', is.str=T) |
89 #end if | 96 #end if |
90 #end for | 97 #end for |
91 )) | 98 )) |
92 | 99 |
93 e_set = ExpressionSet(assayData = exprs, | 100 e_set = ExpressionSet(assayData = exprs, |
94 phenoData = pheno_data, | 101 phenoData = pheno_data, |
95 experimentData = experiment_data, | 102 experimentData = experiment_data, |
96 annotation = annotation) | 103 annotation = annotation) |
97 | 104 |
98 capture.output(print(e_set), file = '$out_tab') | 105 capture.output(print(e_set), file = '$out_txt') |
99 saveRDS(e_set, file= '$out_rds') | 106 saveRDS(e_set, file= '$out_rds') |
100 | 107 |
101 </configfile> | 108 </configfile> |
102 </configfiles> | 109 </configfiles> |
103 <inputs> | 110 <inputs> |
110 optional="true" help="A string detailing which chip was used" > | 117 optional="true" help="A string detailing which chip was used" > |
111 <expand macro="validator_text_and_urls" /> | 118 <expand macro="validator_text_and_urls" /> |
112 </param> | 119 </param> |
113 <repeat name="metadata" title="Meta Data" min="0" max="15" > | 120 <repeat name="metadata" title="Meta Data" min="0" max="15" > |
114 <!-- optional, so min=0 --> | 121 <!-- optional, so min=0 --> |
115 <param name="row_names" label="Label" type="text" > | 122 <param name="row_names" label="Label" type="text" |
123 help="Metadata should correspond directly to the columns of the Phenotype Data" > | |
116 <expand macro="validator_text_and_urls" /> | 124 <expand macro="validator_text_and_urls" /> |
117 </param> | 125 </param> |
118 <param name="label_desc" label="Label Description" type="text" > | 126 <param name="label_desc" label="Label Description" type="text" > |
119 <expand macro="validator_text_and_urls" /> | 127 <expand macro="validator_text_and_urls" /> |
120 </param> | 128 </param> |
147 </param> | 155 </param> |
148 </repeat> | 156 </repeat> |
149 </section> | 157 </section> |
150 </inputs> | 158 </inputs> |
151 <outputs> | 159 <outputs> |
152 <data name="out_tab" format="tabular" label="${tool.name} on ${on_string}: General Info" /> | 160 <data name="out_txt" format="txt" 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" /> | 161 <data name="out_rds" format="rdata.eset" label="${tool.name} on ${on_string}: RData ESet Object" /> |
154 </outputs> | 162 </outputs> |
155 <tests> | 163 <tests> |
156 <test expect_num_outputs="2" > | 164 <test expect_num_outputs="2" > |
157 <!-- Values from the manual --> | 165 <!-- Values from the manual --> |
184 <repeat name="other" > | 192 <repeat name="other" > |
185 <param name="field" value="general" /> | 193 <param name="field" value="general" /> |
186 <param name="comment" value="Some other comment" /> | 194 <param name="comment" value="Some other comment" /> |
187 </repeat> | 195 </repeat> |
188 </section> | 196 </section> |
189 <output name="out_tab"> | 197 <output name="out_txt"> |
190 <assert_contents> | 198 <assert_contents> |
191 <has_text text="assayData: 3 features, 2 samples " /> | 199 <has_text text="assayData: 3 features, 2 samples " /> |
192 </assert_contents> | 200 </assert_contents> |
193 </output> | 201 </output> |
194 </test> | 202 </test> |