Repository 'marea'
hg clone https://toolshed.g2.bx.psu.edu/repos/bimib/marea

Changeset 47:3af9d394367c (2020-02-19)
Previous changeset 46:5d5d01ef1d68 (2020-01-22) Next changeset 48:e4235b5231e4 (2020-02-23)
Commit message:
Uploaded
modified:
Marea/marea.py
Marea/marea.xml
Marea/ras_generator.py
Marea/ras_generator.xml
b
diff -r 5d5d01ef1d68 -r 3af9d394367c Marea/marea.py
--- a/Marea/marea.py Wed Jan 22 11:50:54 2020 -0500
+++ b/Marea/marea.py Wed Feb 19 10:44:52 2020 -0500
[
b'@@ -26,10 +26,6 @@\n     parser.add_argument(\'-cr\', \'--custom\',\n                         type = str,\n                         help=\'your dataset if you want custom rules\')\n-    parser.add_argument(\'-na\', \'--names\', \n-                        type = str,\n-                        nargs = \'+\', \n-                        help = \'input names\')\n     parser.add_argument(\'-n\', \'--none\',\n                         type = str,\n                         default = \'true\',\n@@ -37,7 +33,7 @@\n                         help = \'compute Nan values\')\n     parser.add_argument(\'-pv\' ,\'--pValue\', \n                         type = float, \n-                        default = 0.05, \n+                        default = 0.1, \n                         help = \'P-Value threshold (default: %(default)s)\')\n     parser.add_argument(\'-fc\', \'--fChange\', \n                         type = float, \n@@ -49,14 +45,10 @@\n                         help = \'your tool directory\')\n     parser.add_argument(\'-op\', \'--option\', \n                         type = str, \n-                        choices = [\'datasets\', \'dataset_class\', \'datasets_rasonly\'],\n+                        choices = [\'datasets\', \'dataset_class\'],\n                         help=\'dataset or dataset and class\')\n     parser.add_argument(\'-ol\', \'--out_log\', \n                         help = "Output log")    \n-    parser.add_argument(\'-ids\', \'--input_datas\', \n-                        type = str,\n-                        nargs = \'+\', \n-                        help = \'input datasets\')\n     parser.add_argument(\'-id\', \'--input_data\',\n                         type = str,\n                         help = \'input dataset\')\n@@ -80,15 +72,21 @@\n                         default = \'true\',\n                         choices = [\'true\', \'false\'], \n                         help = \'generate pdf map\')\n-    parser.add_argument(\'-gr\', \'--generate_ras\',\n+    parser.add_argument(\'-on\', \'--control\',\n+                        type = str)\n+    parser.add_argument(\'-co\', \'--comparison\',\n+                        type = str, \n+                        default = \'1vs1\',\n+                        choices = [\'manyvsmany\', \'onevsrest\', \'onevsmany\'])\n+    parser.add_argument(\'-ids\', \'--input_datas\', \n                         type = str,\n-                        default = \'true\',\n-                        choices = [\'true\', \'false\'],\n-                        help = \'generate reaction activity score\')\n-    parser.add_argument(\'-sr\', \'--single_ras_file\',  \n-                         type = str,              \n-                         help = \'file that will contain ras\')\n-    \t\t\t\t\t\n+                        nargs = \'+\', \n+                        help = \'input datasets\')\n+    parser.add_argument(\'-na\', \'--names\', \n+                        type = str,\n+                        nargs = \'+\', \n+                        help = \'input names\')\n+                                    \n     args = parser.parse_args()\n     return args\n \n@@ -615,7 +613,6 @@\n \n def resolve(genes, rules, ids, resolve_none, name):\n     resolve_rules = {}\n-    names_array = []\n     not_found = []\n     flag = False\n     for key, value in genes.items():\n@@ -663,79 +660,157 @@\n                         \', the class has been disregarded\\n\')\n     return class_pat\n \n-############################ create_ras #######################################\n-\n-def create_ras (resolve_rules, dataset_name, single_ras, rules, ids):\n-\n-    if resolve_rules == None:\n-        warning("Couldn\'t generate RAS for current dataset: " + dataset_name)\n-\n-    for geni in resolve_rules.values():\n-        for i, valori in enumerate(geni):\n-            if valori == None:\n-                geni[i] = \'None\'\n-                \n-    output_ras = pd.DataFrame.from_dict(resolve_rules)\n-    \n-    output_ras.insert(0, \'Reactions\', ids)\n-    output_to_csv = pd.DataFrame.to_csv(output_ras, sep = \'\\t\', index = False)\n-    \n-    if (single_ras):\n-        args = process_args(sys.argv)\n-        text_file = open(args.single_ras_file, "w")\n-    else:\n-        tex'..b"name)\n+            ids =  pd.Series.tolist(resolve_rules.iloc[:, 0])\n \n-            if generate_ras:\n-                create_ras(resolve_rules, name, False, rules, ids)\n+            resolve_rules = resolve_rules.drop(resolve_rules.columns[[0]], axis=1)\n+            resolve_rules = resolve_rules.replace({'None': None})\n+            resolve_rules = resolve_rules.to_dict('list')\n             \n-            if err != None and err:\n-                warning('Warning: gene\\n' + str(err) + '\\nnot found in class '\n-                    + name + ', the expression level for this gene ' +\n-                    'will be considered NaN\\n')\n+            #Converto i valori da str a float\n+            to_float = lambda x: float(x) if (x != None) else None\n+            \n+            resolve_rules_float = {}\n+           \n+            for k in resolve_rules:\n+                resolve_rules_float[k] = list(map(to_float, resolve_rules[k])); resolve_rules_float\n+            \n             if resolve_rules != None:\n-                class_pat[name] = list(map(list, zip(*resolve_rules.values())))\n+                class_pat[name] = list(map(list, zip(*resolve_rules_float.values())))\n+        \n             num += 1\n-    elif args.option == 'dataset_class':\n-        name = 'RNAseq'\n-        dataset = read_dataset(args.input_data, name)\n-        dataset.iloc[:, 0] = (dataset.iloc[:, 0]).astype(str)\n-        type_gene = gene_type(dataset.iloc[0, 0], name)\n+            \n+    if args.option == 'dataset_class':\n+        name = 'RAS'\n+        resolve_rules = read_dataset(args.input_data, name)\n+        resolve_rules.iloc[:, 0] = (resolve_rules.iloc[:, 0]).astype(str)\n+            \n+        ids =  pd.Series.tolist(resolve_rules.iloc[:, 0])\n+\n+        resolve_rules = resolve_rules.drop(resolve_rules.columns[[0]], axis=1)\n+        resolve_rules = resolve_rules.replace({'None': None})\n+        resolve_rules = resolve_rules.to_dict('list')\n+            \n+        #Converto i valori da str a float\n+        to_float = lambda x: float(x) if (x != None) else None\n+            \n+        resolve_rules_float = {}\n+           \n+        for k in resolve_rules:\n+            resolve_rules_float[k] = list(map(to_float, resolve_rules[k])); resolve_rules_float\n+\n         classes = read_dataset(args.input_class, 'class')\n-        if not len(classes.columns) == 2:\n-            warning('Warning: more than 2 columns in class file. Extra' +\n-                    'columns have been disregarded\\n')\n         classes = classes.astype(str)\n-        if args.rules_selector != 'Custom':\n-            genes = data_gene(dataset, type_gene, name, None)\n-            ids, rules = load_id_rules(recon.get(type_gene))\n-        elif args.rules_selector == 'Custom':\n-            genes = data_gene(dataset, type_gene, name, gene_in_rule)\n-        resolve_rules, err = resolve(genes, rules, ids, resolve_none, name)\n-        if err != None and err:\n-            warning('Warning: gene\\n'+str(err)+'\\nnot found in class '\n-                    + name + ', the expression level for this gene ' +\n-                    'will be considered NaN\\n')\n-        if resolve_rules != None:\n-            class_pat = split_class(classes, resolve_rules)\n-            if generate_ras:\n-                create_ras(resolve_rules, name, False, rules, ids)\n-    \n+        \n+        if resolve_rules_float != None:\n+            class_pat = split_class(classes, resolve_rules_float)\n     \t\n     if args.rules_selector == 'Custom':\n         if args.yes_no == 'yes':\n@@ -857,11 +896,12 @@\n     else:       \n         core_map = ET.parse(args.tool_dir+'/local/HMRcoreMap.svg')\n         \n-    maps(core_map, class_pat, ids, args.pValue, args.fChange, create_svg, create_pdf)\n+    maps(core_map, class_pat, ids, args.pValue, args.fChange, create_svg, create_pdf, args.comparison, args.control)\n         \n     print('Execution succeded')\n+    \n+    return None\n \n-    return None\n \n ###############################################################################\n \n"
b
diff -r 5d5d01ef1d68 -r 3af9d394367c Marea/marea.xml
--- a/Marea/marea.xml Wed Jan 22 11:50:54 2020 -0500
+++ b/Marea/marea.xml Wed Feb 19 10:44:52 2020 -0500
[
b'@@ -1,28 +1,19 @@\n-<tool id="MaREA" name="Metabolic Reaction Enrichment Analysis" version="1.0.6">\n-    <description></description>\n-    <macros>\n-        <import>marea_macros.xml</import>\n-    </macros>\n-    <requirements>\n-        <requirement type="package" version="0.23.0">pandas</requirement>\n-        <requirement type="package" version="1.1.0">scipy</requirement>\n-        <requirement type="package" version="0.10.1">cobra</requirement>\n-        <requirement type="package" version="4.2.1">lxml</requirement>\n-        <requirement type="package" version="0.8.1">svglib</requirement>\n-        <requirement type="package" version="3.4.0">reportlab</requirement>\n-    </requirements>\n-    <command detect_errors="exit_code">\n-        <![CDATA[\n+<tool id="MaREA" name="Metabolic Reaction Enrichment Analysis" version="1.0.7">\n+\t<macros>\n+\t\t<import>marea_macros.xml</import>\n+\t</macros>\n+\t<requirements>\n+\t\t<requirement type="package" version="0.23.0">pandas</requirement>\n+\t\t<requirement type="package" version="1.1.0">scipy</requirement>\n+\t\t<requirement type="package" version="0.10.1">cobra</requirement>\n+\t\t<requirement type="package" version="4.2.1">lxml</requirement>\n+\t\t<requirement type="package" version="0.8.1">svglib</requirement>\n+\t\t<requirement type="package" version="3.4.0">reportlab</requirement>\n+\t</requirements>\n+\t<command detect_errors="exit_code">\n+\t\t<![CDATA[\n       \tpython $__tool_directory__/marea.py\n-        --rules_selector $cond_rule.rules_selector\n-        #if $cond_rule.rules_selector == \'Custom\':\n-            --custom ${cond_rule.Custom_rules}\n-            --yes_no ${cond_rule.cond_map.yes_no}\n-            #if $cond_rule.cond_map.yes_no == \'yes\':\n-                --custom_map $cond_rule.cond_map.Custom_map\n-            #end if\n-        #end if\n-\t\n+\n       \t--tool_dir $__tool_directory__\n       \t--option $cond.type_selector\n         --out_log $log\t\t\n@@ -36,153 +27,130 @@\n             #for $data in $cond.input_Datasets:\n                 ${data.input_name}\n             #end for\n+            --comparison ${cond.comparis.comparison}\n             #if $cond.advanced.choice == \'true\':\n-      \t    --none ${cond.advanced.None}\n-      \t    --pValue ${cond.advanced.pValue}\n-      \t    --fChange ${cond.advanced.fChange}\n-\t    \t--generate_svg ${cond.advanced.generateSvg}\n-\t    \t--generate_pdf ${cond.advanced.generatePdf}\n-\t    --generate_ras ${cond.advanced.generateRas}\n-\t#else \n-\t    --none true\n-\t    --pValue 0.05\n-\t    --fChange 1.5\n-\t    --generate_svg false\n-\t    --generate_pdf true\n-\t    --generate_ras false\n-\t#end if\n+      \t       --pValue ${cond.advanced.pValue}\n+      \t       --fChange ${cond.advanced.fChange}\n+\t           --generate_svg ${cond.advanced.generateSvg}\n+\t    \t   --generate_pdf ${cond.advanced.generatePdf}\n+     \t    #else \n+\t            --pValue 0.05\n+\t            --fChange 1.5\n+\t            --generate_svg false\n+\t            --generate_pdf true\n+\t            --generate_ras false\n+\t        #end if\n         #elif $cond.type_selector == \'dataset_class\':\n             --input_data ${input_data}\n             --input_class ${input_class}\n+            --comparison ${cond.comparis.comparison}\n+            #if $cond.comparis.comparison == \'onevsmany\'\n+            \t--control ${cond.comparis.controlgroup}\n+            #end if\n             #if $cond.advanced.choice == \'true\':\n-      \t    --none ${cond.advanced.None}\n-      \t    --pValue ${cond.advanced.pValue}\n-      \t    --fChange ${cond.advanced.fChange}\n-\t    --generate_svg ${cond.advanced.generateSvg}\n-\t    --generate_pdf ${cond.advanced.generatePdf}\n-\t    --generate_ras ${cond.advanced.generateRas}\n-\t#else \n-\t    --none true\n-\t    --pValue 0.05\n-\t    --fChange 1.5\n-\t    --generate_svg false\n-\t    --generate_pdf true\n-\t    --generate_ras false\n-\t#end if\n-        #end if\n-        #if $cond.type_selector == \'datasets_rasonly\':\n-            --input_datas ${input_Datasets}\n-            --single_ras_file $ras_single\n-            --none ${cond.None}\n+      \t        --'..b'\n-\t\t    \t\t\t<param name="generatePdf" argument="--generatePdf" type="boolean" checked="true" label="Generate PDF map" help="should the program return a non editable (but displayble) pdf map of the processes?" />\t\n-\t\t    \t\t\t<param name="generateRas" argument="--generateRas" type="boolean" checked="false" label="Generate Reaction Activity Score for each table" help="Generate Reaction Activity Score for each table" />\t\t\n+\t\t\t\t\t<when value="onevsmany">\n+\t\t\t\t\t\t<param name="controlgroup" argument="--controlgroup" type="text" label="Control group label:" value="0" help="Name of group label to be compared to others"/>\n \t\t\t\t\t</when>\n-    \t</conditional>\n-            </when>\n-        </conditional>\n-       \n-      \n-       \n-\t\n-    </inputs>\n-\n-    <outputs>\n-        <data format="txt" name="log" label="MaREA - Log" />\n-        <data format="tabular" name="ras_single" label="MaREA - RAS - ${cond.input_name}">\n-        \t<filter>cond[\'type_selector\'] == "datasets_rasonly"</filter>\n-        </data>\n-        <collection name="results" type="list" label="MaREA - Results">\n-        <filter>cond[\'type_selector\'] == "datasets" or cond[\'type_selector\'] == "dataset_class"</filter>\n-            <discover_datasets pattern="__name_and_ext__" directory="result"/>\n-        </collection>\n-\t<collection name="ras" type="list" label="MaREA - RAS list" format_source="tabular">\n-\t    <filter>cond[\'type_selector\'] != "datasets_rasonly" and cond[\'advanced\'][\'choice\'] and cond[\'advanced\'][\'generateRas\']</filter>\n-    \t    <discover_datasets pattern="__name_and_ext__" directory="ras" format="tabular"/>\n+\t\t\t\t</conditional>\n+\t\t\t\t<conditional name="advanced">\n+\t\t\t\t<param name="choice" type="boolean" checked="false" label="Use advanced options?" help="Use this options to choose custom parameters for evaluation: pValue, Fold-Change threshold, how to solve (A and NaN) and specify output maps.">\n+\t\t\t\t\t<option value="true" selected="true">No</option>\n+\t\t\t\t\t<option value="false">Yes</option>\n+\t\t\t\t</param>\n+\t\t\t\t<when value="false"></when>\n+\t\t\t\t<when value="true">\n+\t\t\t\t\t<conditional name="cond_map">\n+\t\t\t\t\t\t<param name="choice" type="boolean" checked="false" label="Use custom map?" help="Use this option only if you have generated RAS using a custom set of rules">\n+\t\t\t\t\t\t\t<option value="false" selected="true">No</option>\n+\t\t\t\t\t\t\t<option value="true">Yes</option>\n+\t\t\t\t\t\t</param>\n+\t\t\t\t\t\t<when value="true">\t\t\t\t\t\t\t\n+\t\t\t\t\t\t\t<param name="Custom_map" argument="--custom_map" type="data" format="xml, svg" label="custom-map.svg"/>\n+\t\t\t\t\t\t</when>\n+\t\t\t\t\t</conditional>\n+\t\t\t\t\t<param name="pValue" argument="--pValue" type="float" size="20" value="0.01" max="1" min="0" label="P-value threshold:" help="min value 0" />\n+\t\t\t\t\t<param name="fChange" argument="--fChange" type="float" size="20" value="1.2" min="1" label="Fold-Change threshold:" help="min value 1" />\n+\t\t\t\t\t<param name="generateSvg" argument="--generateSvg" type="boolean" checked="false" label="Generate SVG map" help="should the program generate an editable svg map of the processes?" />\n+\t\t\t\t\t<param name="generatePdf" argument="--generatePdf" type="boolean" checked="true" label="Generate PDF map" help="should the program return a non editable (but displayble) pdf map of the processes?" />\n+\t\t\t\t</when>\n+\t\t\t</conditional>\n+\t\t</when>\n+\t</conditional>\n+</inputs>\n+<outputs>\n+\t<data format="txt" name="log" label="MaREA - Log" />\n+\t<collection name="results" type="list" label="MaREA - Results">\n+\t\t<discover_datasets pattern="__name_and_ext__" directory="result"/>\n \t</collection>\n-\t\n-    </outputs>\n-    <tests>\n-        <test>\n-            <param name="pValue" value="0.56"/>\n-            <output name="log" file="log.txt"/>\n-        </test>\n-    </tests>\n-    <help>\n-<![CDATA[\n+</outputs>\n+<help>\n+\t<![CDATA[\n \n What it does\n -------------\n@@ -268,7 +236,6 @@\n .. _MaREA cluster analysis: http://link del tool di cluster.org\n \n ]]>\n-    </help>\n-    <expand macro="citations" />\n-</tool>\n+</help>\n+<expand macro="citations" />undefined</tool>\n \t\n'
b
diff -r 5d5d01ef1d68 -r 3af9d394367c Marea/ras_generator.py
--- a/Marea/ras_generator.py Wed Jan 22 11:50:54 2020 -0500
+++ b/Marea/ras_generator.py Wed Feb 19 10:44:52 2020 -0500
[
b'@@ -1,16 +1,10 @@\n from __future__ import division\n import sys\n import pandas as pd\n-import itertools as it\n-import scipy.stats as st\n import collections\n-import lxml.etree as ET\n import pickle as pk\n import math\n-import os\n import argparse\n-from svglib.svglib import svg2rlg\n-from reportlab.graphics import renderPDF\n \n ########################## argparse ##########################################\n \n@@ -26,69 +20,25 @@\n     parser.add_argument(\'-cr\', \'--custom\',\n                         type = str,\n                         help=\'your dataset if you want custom rules\')\n-    parser.add_argument(\'-na\', \'--names\', \n-                        type = str,\n-                        nargs = \'+\', \n-                        help = \'input names\')\n     parser.add_argument(\'-n\', \'--none\',\n                         type = str,\n                         default = \'true\',\n                         choices = [\'true\', \'false\'], \n                         help = \'compute Nan values\')\n-    parser.add_argument(\'-pv\' ,\'--pValue\', \n-                        type = float, \n-                        default = 0.05, \n-                        help = \'P-Value threshold (default: %(default)s)\')\n-    parser.add_argument(\'-fc\', \'--fChange\', \n-                        type = float, \n-                        default = 1.5, \n-                        help = \'Fold-Change threshold (default: %(default)s)\')\n     parser.add_argument(\'-td\', \'--tool_dir\',\n                         type = str,\n                         required = True,\n                         help = \'your tool directory\')\n-    parser.add_argument(\'-op\', \'--option\', \n-                        type = str, \n-                        choices = [\'datasets\', \'dataset_class\', \'datasets_rasonly\'],\n-                        help=\'dataset or dataset and class\')\n     parser.add_argument(\'-ol\', \'--out_log\', \n                         help = "Output log")    \n-    parser.add_argument(\'-ids\', \'--input_datas\', \n-                        type = str,\n-                        nargs = \'+\', \n-                        help = \'input datasets\')\n-    parser.add_argument(\'-id\', \'--input_data\',\n+    parser.add_argument(\'-id\', \'--input\',\n                         type = str,\n                         help = \'input dataset\')\n-    parser.add_argument(\'-ic\', \'--input_class\', \n-                        type = str, \n-                        help = \'sample group specification\')\n-    parser.add_argument(\'-cm\', \'--custom_map\', \n-                        type = str, \n-                        help = \'custom map\')\n-    parser.add_argument(\'-yn\', \'--yes_no\', \n-                        type = str,\n-                        choices = [\'yes\', \'no\'],\n-                        help = \'if make or not custom map\')\n-    parser.add_argument(\'-gs\', \'--generate_svg\',\n+    parser.add_argument(\'-ra\', \'--ras_output\',\n                         type = str,\n-                        default = \'true\',\n-                        choices = [\'true\', \'false\'], \n-                        help = \'generate svg map\')\n-    parser.add_argument(\'-gp\', \'--generate_pdf\',\n-                        type = str,\n-                        default = \'true\',\n-                        choices = [\'true\', \'false\'], \n-                        help = \'generate pdf map\')\n-    parser.add_argument(\'-gr\', \'--generate_ras\',\n-                        type = str,\n-                        default = \'true\',\n-                        choices = [\'true\', \'false\'],\n-                        help = \'generate reaction activity score\')\n-    parser.add_argument(\'-sr\', \'--single_ras_file\',  \n-                         type = str,              \n-                         help = \'file that will contain ras\')\n-    \t\t\t\t\t\n+                        required = True,\n+                        help = \'ras output\')\n+    \n     args = parser.parse_args()\n     return args\n \n@@ -297,79 +247,6 @@\n             return False\n     return ris\n \n-############################ map_methods ######################################\n-\n-def fold_change(avg1, avg2):\n-  '..b"    return None\n-    \n-    \n-    elif args.option == 'datasets':\n-        num = 1\n-        for i, j in zip(args.input_datas, args.names):\n-\n-            name = name_dataset(j, num)\n-            dataset = read_dataset(i, name)\n-\n-            dataset.iloc[:, 0] = (dataset.iloc[:, 0]).astype(str)\n-\n-            type_gene = gene_type(dataset.iloc[0, 0], name) \n-            \n-            if args.rules_selector != 'Custom':\n-                genes = data_gene(dataset, type_gene, name, None)\n-                ids, rules = load_id_rules(recon.get(type_gene))\n-            elif args.rules_selector == 'Custom':\n-                genes = data_gene(dataset, type_gene, name, gene_in_rule)\n-                \n-                \n-            resolve_rules, err = resolve(genes, rules, ids, resolve_none, name)\n+    dataset.iloc[:, 0] = (dataset.iloc[:, 0]).astype(str)\n \n-            if generate_ras:\n-                create_ras(resolve_rules, name, False, rules, ids)\n-            \n-            if err != None and err:\n-                warning('Warning: gene\\n' + str(err) + '\\nnot found in class '\n-                    + name + ', the expression level for this gene ' +\n-                    'will be considered NaN\\n')\n-            if resolve_rules != None:\n-                class_pat[name] = list(map(list, zip(*resolve_rules.values())))\n-            num += 1\n-    elif args.option == 'dataset_class':\n-        name = 'RNAseq'\n-        dataset = read_dataset(args.input_data, name)\n-        dataset.iloc[:, 0] = (dataset.iloc[:, 0]).astype(str)\n-        type_gene = gene_type(dataset.iloc[0, 0], name)\n-        classes = read_dataset(args.input_class, 'class')\n-        if not len(classes.columns) == 2:\n-            warning('Warning: more than 2 columns in class file. Extra' +\n-                    'columns have been disregarded\\n')\n-        classes = classes.astype(str)\n-        if args.rules_selector != 'Custom':\n-            genes = data_gene(dataset, type_gene, name, None)\n-            ids, rules = load_id_rules(recon.get(type_gene))\n-        elif args.rules_selector == 'Custom':\n-            genes = data_gene(dataset, type_gene, name, gene_in_rule)\n-        resolve_rules, err = resolve(genes, rules, ids, resolve_none, name)\n-        if err != None and err:\n-            warning('Warning: gene\\n'+str(err)+'\\nnot found in class '\n-                    + name + ', the expression level for this gene ' +\n-                    'will be considered NaN\\n')\n-        if resolve_rules != None:\n-            class_pat = split_class(classes, resolve_rules)\n-            if generate_ras:\n-                create_ras(resolve_rules, name, False, rules, ids)\n+    type_gene = gene_type(dataset.iloc[0, 0], name) \n+        \n+    if args.rules_selector != 'Custom':\n+        genes = data_gene(dataset, type_gene, name, None)\n+        ids, rules = load_id_rules(recon.get(type_gene))\n+    elif args.rules_selector == 'Custom':\n+        genes = data_gene(dataset, type_gene, name, gene_in_rule)\n     \n-    \t\n-    if args.rules_selector == 'Custom':\n-        if args.yes_no == 'yes':\n-            try:\n-                core_map = ET.parse(args.custom_map)\n-            except (ET.XMLSyntaxError, ET.XMLSchemaParseError):\n-                sys.exit('Execution aborted: custom map in wrong format')\n-        elif args.yes_no == 'no':\n-            core_map = ET.parse(args.tool_dir + '/local/HMRcoreMap.svg')\n-    else:       \n-        core_map = ET.parse(args.tool_dir+'/local/HMRcoreMap.svg')\n-        \n-    maps(core_map, class_pat, ids, args.pValue, args.fChange, create_svg, create_pdf)\n-        \n+    resolve_rules, err = resolve(genes, rules, ids, resolve_none, name)\n+\n+    create_ras(resolve_rules, name, rules, ids, args.ras_output)\n+      \n+    if err != None and err:\n+        warning('Warning: gene\\n' + str(err) + '\\nnot found in class '\n+            + name + ', the expression level for this gene ' +\n+            'will be considered NaN\\n')\n+\n+    \n     print('Execution succeded')\n \n     return None\n"
b
diff -r 5d5d01ef1d68 -r 3af9d394367c Marea/ras_generator.xml
--- a/Marea/ras_generator.xml Wed Jan 22 11:50:54 2020 -0500
+++ b/Marea/ras_generator.xml Wed Feb 19 10:44:52 2020 -0500
[
@@ -1,5 +1,5 @@
-<tool id="MaREA RAS Generator" name="RAS Generator" version="1.0.0">
-    <description></description>
+<tool id="MaREA RAS Generator" name="Expression2RAS" version="1.0.2">
+    <description>- Reaction Activity Scores computation</description>
     <macros>
         <import>marea_macros.xml</import>
     </macros>
@@ -13,18 +13,15 @@
     </requirements>
     <command detect_errors="exit_code">
         <![CDATA[
-       python $__tool_directory__/marea.py
-        --rules_selector $cond_rule.rules_selector
-       --tool_dir $__tool_directory__
-       --option $cond.type_selector
-        --out_log $log
-        --input_datas ${input_Datasets}
-        --single_ras_file $ras_single
-        --none ${cond.None}
-        #end if
+       python $__tool_directory__/ras_generator.py
+       --rules_selector $cond_rule.rules_selector
+        --input $input
+        --none $none
+        --tool_dir $__tool_directory__
+        --out_log $log
+        --ras_output $ras_output
         ]]>
     </command>
-
     <inputs>
         <conditional name="cond_rule">
             <expand macro="options"/>
@@ -47,124 +44,21 @@
                 </conditional>
             </when>
         </conditional>
-        <conditional name="cond">
-            
-             <param name="input_Datasets" argument="--input_datas" type="data" format="tabular, csv, tsv" label="add dataset" />
-                <param name="input_name" argument="--names" type="text" label="Dataset's name:" value="Dataset" help="Default: Dataset" />
-                <param name="None" argument="--none" type="boolean" truevalue="true" falsevalue="false" checked="true" label="(A and NaN) solved as (A)?" /> 
-
-                       
-            </when>
-        </conditional>
+        <param name="input" argument="--input" type="data" format="tabular, csv, tsv" label="Gene Expression dataset:" />
+        <param name="name" argument="--name" type="text" label="Dataset's name:" value="Dataset" help="Default: Dataset" />
+        <param name="none" argument="--none" type="boolean" truevalue="true" falsevalue="false" checked="true" label="(A and NaN) solved as (A)?" /> 
     </inputs>
 
     <outputs>
-        <data format="txt" name="log" label="MaREA - Log" />
-        <data format="tabular" name="ras_single" label="MaREA - RAS - ${cond.input_name}">
-         <filter>cond['type_selector'] == "datasets_rasonly"</filter>
-        </data>
-        <collection name="results" type="list" label="MaREA - Results">
-        <filter>cond['type_selector'] == "datasets" or cond['type_selector'] == "dataset_class"</filter>
-            <discover_datasets pattern="__name_and_ext__" directory="result"/>
-        </collection>
- <collection name="ras" type="list" label="MaREA - RAS list" format_source="tabular">
-     <filter>cond['type_selector'] != "datasets_rasonly" and cond['advanced']['choice'] and cond['advanced']['generateRas']</filter>
-         <discover_datasets pattern="__name_and_ext__" directory="ras" format="tabular"/>
- </collection>
-
+        <data format="txt" name="log" label="Expression2RAS - $name - Log" />
+        <data format="tabular" name="ras_output" label="$name RAS"/>
     </outputs>
-    <tests>
-        <test>
-            <param name="pValue" value="0.56"/>
-            <output name="log" file="log.txt"/>
-        </test>
-    </tests>
+
     <help>
 <![CDATA[
 
 What it does
 -------------
-
-This tool analyzes RNA-seq dataset(s) as described in Graudenzi et al."`MaREA`_: Metabolic feature extraction, enrichment and visualization of RNAseq data" bioRxiv (2018): 248724.
-
-Accepted files are: 
-    - option 1) two or more RNA-seq datasets, each referring to samples in a given condition/class. The user can specify a label for each class (as e.g. "*classA*" and "*classB*");
-    - option 2) one RNA dataset and one class-file specifying the class/condition each sample belongs to.
-
-Optional files:
-    - custom GPR (Gene-Protein-Reaction) rules. Two accepted formats:
-
- * (Cobra Toolbox and CobraPy compliant) xml of metabolic model;
- * .csv file specifyig for each reaction ID (column 1) the corresponding GPR rule (column 2).
-    - custom svg map. Graphical elements must have the same IDs of reactions. See HmrCore svg map for an example.
-
-The tool generates:
-    1) a tab-separated file: reporting fold-change and p-values of reaction activity scores (RASs) between a pair of conditions/classes;
-    2) a metabolic map file (downlodable as .svg): visualizing up- and down-regulated reactions between a pair of conditions/classes;
-    3) a log file (.txt).
-
-RNA-seq datasets format: tab-separated text files, reporting the expression level (e.g., TPM, RPKM, ...) of each gene (row) for a given sample (column). Header: sample ID.
-
-Class-file format: each row of the class-file reports the sample ID (column1) and the label of the class/condition the sample belongs to (column 2).
-
-To calculate P-Values and Fold-Changes and to generate maps, comparisons are performed for each possible pair of classes.
-
-Output files will be named as classA_vs_classB. Reactions will conventionally be reported as up-regulated (down-regulated) if they are significantly more (less) active in class having label "classA".
-
-
-Example input
--------------
-
-**"Custom Rules"** option:
-
-Custom Rules Dastaset:
-
-@CUSTOM_RULES_EXEMPLE@
-
-**"RNAseq of group 1 + RNAseq of group 2 + ... + RNAseq of group N"** option:
-
-RNA-seq Dataset 1:
-
-@DATASET_EXEMPLE1@
-
-RNA-seq Dataset 2:
-
-@DATASET_EXEMPLE2@
-
-**"RNAseq of all samples + sample group specification"** option:
-
-RNA-seq Dataset:
-
-@DATASET_EXEMPLE1@
-
-Class-file:
-
-+------------+------------+   
-| Patient_ID |    class   |   
-+============+============+   
-| TCGAAA3529 |     MSI    |   
-+------------+------------+    
-| TCGAA62671 |     MSS    |    
-+------------+------------+    
-| TCGAA62672 |     MSI    |   
-+------------+------------+
-
-|
-
-.. class:: infomark
-
-**TIP**: If your data is not TAB delimited, use `Convert delimiters to TAB`_.
-
-.. class:: infomark
-
-**TIP**: If your dataset is not split into classes, use `MaREA cluster analysis`_.
-
-@REFERENCE@
-
-.. _MaREA: https://www.biorxiv.org/content/early/2018/01/16/248724
-.. _Convert delimiters to TAB: https://usegalaxy.org/?tool_id=Convert+characters1&version=1.0.0&__identifer=6t22teyofhj
-.. _MaREA cluster analysis: http://link del tool di cluster.org
-
 ]]>
     </help>
     <expand macro="citations" />