diff 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
line wrap: on
line diff
--- a/construct_eset.xml	Sun Sep 12 19:49:12 2021 +0000
+++ b/construct_eset.xml	Fri Nov 26 15:55:11 2021 +0000
@@ -14,9 +14,12 @@
 suppressWarnings(suppressPackageStartupMessages(library(xbioc)))
 suppressWarnings(suppressPackageStartupMessages(library(MuSiC)))
 
-null_str_vec = function(gstr){
+null_str_vec = function(gstr, is.str=FALSE){
    tokens = unlist(as.vector(strsplit(gstr, split=",")))
    if (length(tokens) == 0){
+      if (is.str){
+         return(character(0))
+      }
       return(NULL)
    }
    if (length(tokens) == 1){
@@ -40,6 +43,9 @@
 #end if
 ## Annotation and Feature Data, or just a string for type of chip used
 annotation = null_str_vec('$annotation')
+if (is.null(annotation)){
+   annotation = character(0)
+}
 
 if (all(rownames(pdata) != colnames(exprs))) {
    stop("Number of Samples between phenotypes and assays are not the same")
@@ -66,26 +72,27 @@
 metadata\$lname = NULL
 
 if (nrow(metadata)==0) {
-   metadata = NULL
+    pheno_data = new("AnnotatedDataFrame", data = pdata)
+} else {
+    pheno_data = new("AnnotatedDataFrame", data = pdata, varMetadata = metadata)
 }
 
-pheno_data = new("AnnotatedDataFrame", data = pdata, varMetadata = metadata)
 
 ## Experiment Description -- using the MIAME object
 experiment_data = new(
     "MIAME",
-    name = null_str_vec('$expdata.name'),
-    lab = null_str_vec('$expdata.lab'),
-    contact = null_str_vec('$expdata.contact'),
-    title = null_str_vec('$expdata.title'),
-    abstract = null_str_vec('$expdata.abstract'),
-    url = null_str_vec('$expdata.url'),
+    name = null_str_vec('$expdata.name', is.str=T),
+    lab = null_str_vec('$expdata.lab', is.str=T),
+    contact = null_str_vec('$expdata.contact', is.str=T),
+    title = null_str_vec('$expdata.title', is.str=T),
+    abstract = null_str_vec('$expdata.abstract', is.str=T),
+    url = null_str_vec('$expdata.url', is.str=T),
     other = list(
 #for i, row in enumerate($expdata.other):
     #if i==0
-    '$row.field' = null_str_vec('$row.comment')
+    '$row.field' = null_str_vec('$row.comment', is.str=T)
     #else
-    ,'$row.field' = null_str_vec('$row.comment')
+    ,'$row.field' = null_str_vec('$row.comment', is.str=T)
     #end if
 #end for
 ))
@@ -95,7 +102,7 @@
                       experimentData = experiment_data,
                       annotation = annotation)
 
-capture.output(print(e_set), file = '$out_tab')
+capture.output(print(e_set), file = '$out_txt')
 saveRDS(e_set, file= '$out_rds')
 
         </configfile>
@@ -112,7 +119,8 @@
         </param>
         <repeat name="metadata" title="Meta Data" min="0" max="15" >
             <!-- optional, so min=0 -->
-            <param name="row_names" label="Label" type="text" >
+            <param name="row_names" label="Label" type="text"
+                   help="Metadata should correspond directly to the columns of the Phenotype Data" >
                 <expand macro="validator_text_and_urls" />
             </param>
             <param name="label_desc" label="Label Description" type="text" >
@@ -149,7 +157,7 @@
         </section>
     </inputs>
     <outputs>
-        <data name="out_tab" format="tabular" label="${tool.name} on ${on_string}: General Info" />
+        <data name="out_txt" format="txt" label="${tool.name} on ${on_string}: General Info" />
         <data name="out_rds" format="rdata.eset" label="${tool.name} on ${on_string}: RData ESet Object" />
     </outputs>
     <tests>
@@ -186,7 +194,7 @@
                     <param name="comment" value="Some other comment" />
                 </repeat>
             </section>
-            <output name="out_tab">
+            <output name="out_txt">
                 <assert_contents>
                     <has_text text="assayData: 3 features, 2 samples " />
                 </assert_contents>