Previous changeset 47:3af9d394367c (2020-02-19) Next changeset 49:2c2a11aa1e02 (2020-03-04) |
Commit message:
Uploaded |
modified:
Marea/marea.py Marea/marea.xml Marea/ras_generator.xml |
b |
diff -r 3af9d394367c -r e4235b5231e4 Marea/marea.py --- a/Marea/marea.py Wed Feb 19 10:44:52 2020 -0500 +++ b/Marea/marea.py Sun Feb 23 09:41:14 2020 -0500 |
[ |
@@ -18,14 +18,17 @@ parser = argparse.ArgumentParser(usage = '%(prog)s [options]', description = 'process some value\'s'+ ' genes to create a comparison\'s map.') - parser.add_argument('-rs', '--rules_selector', + parser.add_argument('-cr', '--custom_rules', type = str, - default = 'HMRcore', - choices = ['HMRcore', 'Recon', 'Custom'], - help = 'chose which type of dataset you want use') - parser.add_argument('-cr', '--custom', + default = 'false', + choices = ['true', 'false'], + help = 'choose whether to use custom rules') + parser.add_argument('-cc', '--custom_rule', type = str, - help='your dataset if you want custom rules') + help='custom rules to use') + parser.add_argument('-cm', '--custom_map', + type = str, + help='custom map to use') parser.add_argument('-n', '--none', type = str, default = 'true', @@ -55,13 +58,6 @@ parser.add_argument('-ic', '--input_class', type = str, help = 'sample group specification') - parser.add_argument('-cm', '--custom_map', - type = str, - help = 'custom map') - parser.add_argument('-yn', '--yes_no', - type = str, - choices = ['yes', 'no'], - help = 'if make or not custom map') parser.add_argument('-gs', '--generate_svg', type = str, default = 'true', @@ -551,7 +547,7 @@ react = recon.reactions rules = [react[i].gene_reaction_rule for i in range(len(react))] ids = [react[i].id for i in range(len(react))] - except cb.io.sbml3.CobraSBMLError: + except cb.io.sbml.CobraSBMLError: try: data = (pd.read_csv(data, sep = '\t', dtype = str, engine='python')).fillna('') if len(data.columns) < 2: @@ -693,8 +689,8 @@ tmp_csv.to_csv(tab, sep = '\t', index = False, header = header) if create_svg or create_pdf: - if args.rules_selector == 'HMRcore' or (args.rules_selector == 'Custom' - and args.yes_no == 'yes'): + if args.custom_rules == 'false' or (args.custom_rules == 'true' + and args.custom_map != ''): fix_map(tmp, core_map, threshold_P_V, threshold_F_C, max_F_C) file_svg = 'result/' + i + '_vs_' + j + ' (SVG Map).svg' with open(file_svg, 'wb') as new_map: @@ -760,13 +756,6 @@ elif comparison == "onevsmany": for i, j in it.combinations(class_pat.keys(), 2): - - if i != control and j != control: - print(str(control) + " " + str(i) + " " + str(j)) - #Se è un confronto fra elementi diversi dal controllo, skippo - continue - - print('vado') tmp = {} count = 0 max_F_C = 0 @@ -823,13 +812,9 @@ if os.path.isdir('result') == False: os.makedirs('result') - - if args.rules_selector == 'HMRcore': - recon = pk.load(open(args.tool_dir + '/local/HMRcore_rules.p', 'rb')) - elif args.rules_selector == 'Recon': - recon = pk.load(open(args.tool_dir + '/local/Recon_rules.p', 'rb')) - elif args.rules_selector == 'Custom': - ids, rules, gene_in_rule = make_recon(args.custom) + + if args.custom_rules == 'true': + ids, rules, gene_in_rule = make_recon(args.custom_rule) class_pat = {} @@ -885,15 +870,13 @@ if resolve_rules_float != None: class_pat = split_class(classes, resolve_rules_float) - if args.rules_selector == 'Custom': - if args.yes_no == 'yes': - try: - core_map = ET.parse(args.custom_map) - except (ET.XMLSyntaxError, ET.XMLSchemaParseError): - sys.exit('Execution aborted: custom map in wrong format') - elif args.yes_no == 'no': - core_map = ET.parse(args.tool_dir + '/local/HMRcoreMap.svg') - else: + + if args.custom_rules == 'true': + try: + core_map = ET.parse(args.custom_map) + except (ET.XMLSyntaxError, ET.XMLSchemaParseError): + sys.exit('Execution aborted: custom map in wrong format') + else: core_map = ET.parse(args.tool_dir+'/local/HMRcoreMap.svg') maps(core_map, class_pat, ids, args.pValue, args.fChange, create_svg, create_pdf, args.comparison, args.control) |
b |
diff -r 3af9d394367c -r e4235b5231e4 Marea/marea.xml --- a/Marea/marea.xml Wed Feb 19 10:44:52 2020 -0500 +++ b/Marea/marea.xml Sun Feb 23 09:41:14 2020 -0500 |
b |
b'@@ -1,4 +1,4 @@\n-<tool id="MaREA" name="Metabolic Reaction Enrichment Analysis" version="1.0.7">\n+<tool id="MaREA" name="Metabolic Reaction Enrichment Analysis" version="1.0.8">\n \t<macros>\n \t\t<import>marea_macros.xml</import>\n \t</macros>\n@@ -28,6 +28,11 @@\n ${data.input_name}\n #end for\n --comparison ${cond.comparis.comparison}\n+ #if $cond.advanced.cond_map == \'true\':\n+ \t--custom_rules true\n+ \t--custom_rule ${cond.advanced.cond_map.custom_rule}\n+ \t--custom_map ${cond.advanced.cond_map.custom_map}\n+ #end if\n #if $cond.advanced.choice == \'true\':\n \t --pValue ${cond.advanced.pValue}\n \t --fChange ${cond.advanced.fChange}\n@@ -47,6 +52,11 @@\n #if $cond.comparis.comparison == \'onevsmany\'\n \t--control ${cond.comparis.controlgroup}\n #end if\n+ #if $cond.advanced.cond_map == \'true\':\n+ \t--custom_rules true\n+ \t--custom_rule ${cond.advanced.cond_map.custom_rule}\n+ \t--custom_map ${cond.advanced.cond_map.custom_map}\n+ #end if\n #if $cond.advanced.choice == \'true\':\n \t --pValue ${cond.advanced.pValue}\n \t --fChange ${cond.advanced.fChange}\n@@ -90,11 +100,12 @@\n \t\t\t\t\t<when value="false"></when>\n \t\t\t\t\t<when value="true">\n \t\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<param name="choice" type="boolean" checked="false" label="Use custom map and rules?" 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<when value="true">\t\n+\t\t\t\t\t\t\t<param name="Custom_rule" argument="--custom_rule" type="data" format="tabular, csv, tsv, xml" label="Custom rules" />\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@@ -131,6 +142,7 @@\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_rule" argument="--custom_rule" type="data" format="tabular, csv, tsv, xml" label="Custom rules" />\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@@ -155,71 +167,108 @@\n What it does\n -------------\n \n-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.\n+This tool analyzes and visualizes differences in the Reaction Activity Scores (RASs) of groups of samples, as computed by the Expression2RAS tool, of groups of samples.\n \n Accepted files are: \n- - 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*");\n- - option 2) one RNA dataset and one class-file specifying the class/condition each sample belongs to.\n+ - option 1) two or more RAS datasets, each referring to samples in a given group. The user can specify a label for each group (as e.g. "classA" and "classB");\n+ - option 2) one RAS dataset and one group-file specifying the group each sample belongs to.\n+ \n+RAS datasets format: tab-separated text files, reporting the RAS value of each reaction (row) for a given sample (column).\n+\n+Column header: sample ID.\n+Raw header: reaction ID. \n \n Optional files:\n- - custom GPR (Gene-Protein-Reaction) rules. Two accepted formats:\n-\n-\t* (Cobra Toolbox and CobraPy compliant) xml of metabolic model;\n-\t* .csv file specifyig for each reaction ID (column 1) the corresponding'..b'AA62671 | TCGAA62672 | \n++============+================+================+================+\n+| r1642 | 0.523167 | 0.371355 | 0.925661 | \n++------------+----------------+----------------+----------------+ \n+| r1643 | 0.568765 | 0.765567 | 0.456789 | \n++------------+----------------+----------------+----------------+ \n+| r1640 | 0.876545 | 0.768933 | 0.987654 | \n++------------+----------------+----------------+----------------+\n+| r1641 | 0.456788 | 0.876543 | 0.876542 | \n++------------+----------------+----------------+----------------+ \n+| r1646 | 0.876543 | 0.786543 | 0.897654 | \n++------------+----------------+----------------+----------------+\n \n-RNA-seq Dataset 1:\t\t\t\t\t\t\n-\n-@DATASET_EXEMPLE1@\n+RAS Dataset 2:\n \n-RNA-seq Dataset 2:\n++------------+----------------+----------------+----------------+ \n+| Reaction ID| TCGAA62670 | TCGAA62671 | TCGAA62672 | \n++============+================+================+================+\n+| r1642 | 0.523167 | 0.371355 | 0.925661 | \n++------------+----------------+----------------+----------------+ \n+| r1643 | 0.568765 | 0.765567 | 0.456789 | \n++------------+----------------+----------------+----------------+ \n+| r1640 | 0.876545 | 0.768933 | 0.987654 | \n++------------+----------------+----------------+----------------+\n+| r1641 | 0.456788 | 0.876543 | 0.876542 | \n++------------+----------------+----------------+----------------+ \n+| r1646 | 0.876543 | 0.786543 | 0.897654 | \n++------------+----------------+----------------+----------------+\n \n-@DATASET_EXEMPLE2@\n-\n-**"RNAseq of all samples + sample group specification"** option:\n+"RAS of all samples + sample group specification" option:\n \n-RNA-seq Dataset:\n+RAS Dataset:\n \n-@DATASET_EXEMPLE1@\n++------------+----------------+----------------+----------------+ \n+| Reaction ID| TCGAA62670 | TCGAA62671 | TCGAA62672 | \n++============+================+================+================+\n+| r1642 | 0.523167 | 0.371355 | 0.925661 | \n++------------+----------------+----------------+----------------+ \n+| r1643 | 0.568765 | 0.765567 | 0.456789 | \n++------------+----------------+----------------+----------------+ \n+| r1640 | 0.876545 | 0.768933 | 0.987654 | \n++------------+----------------+----------------+----------------+\n+| r1641 | 0.456788 | 0.876543 | 0.876542 | \n++------------+----------------+----------------+----------------+ \n+| r1646 | 0.876543 | 0.786543 | 0.897654 | \n++------------+----------------+----------------+----------------+\n \n-Class-file:\n+Group-file\n \n-+------------+------------+ \n-| Patient_ID | class | \n-+============+============+ \n-| TCGAAA3529 | MSI | \n-+------------+------------+ \n-| TCGAA62671 | MSS | \n-+------------+------------+ \n-| TCGAA62672 | MSI | \n-+------------+------------+\n++---------------+-----------+\n+| Patient ID | Class | \n++===============+===========+\n+| TCGAAA3529 | MSI | \n++---------------+-----------+ \n+| TCGAA62671 | MSS | \n++---------------+-----------+ \n+| TCGAA62672 | MSI |\n++---------------+-----------+\n \n-|\n+Advanced options\n+----------------\n+\n+P-Value threshold: the threshold used for significance Kolmogorov-Smirnov (KS) test, to verify whether the distributions of RASs over the samples in two sets are significantly different\n+\n+Fold-Change threshold: threshold of the fold-change between the average RAS of two groups. Among the reactions that pass the KS test, only fold-change values larger than the indicated threshold will be visualized on the output metabolic map;\n+\n \n .. class:: infomark\n \n' |
b |
diff -r 3af9d394367c -r e4235b5231e4 Marea/ras_generator.xml --- a/Marea/ras_generator.xml Wed Feb 19 10:44:52 2020 -0500 +++ b/Marea/ras_generator.xml Sun Feb 23 09:41:14 2020 -0500 |
b |
@@ -1,4 +1,4 @@ -<tool id="MaREA RAS Generator" name="Expression2RAS" version="1.0.2"> +<tool id="MaREA RAS Generator" name="Expression2RAS" version="1.0.3"> <description>- Reaction Activity Scores computation</description> <macros> <import>marea_macros.xml</import> @@ -31,17 +31,6 @@ </when> <when value="Custom"> <param name="Custom_rules" type="data" format="tabular, csv, tsv, xml" label="Custom rules" /> - <conditional name="cond_map"> - <param name="yes_no" type="select" label="Custom map? (optional)"> - <option value="no" selected="true">no</option> - <option value="yes">yes</option> - </param> - <when value="yes"> - <param name="Custom_map" argument="--custom_map" type="data" format="xml, svg" label="custom-map.svg"/> - </when> - <when value="no"> - </when> - </conditional> </when> </conditional> <param name="input" argument="--input" type="data" format="tabular, csv, tsv" label="Gene Expression dataset:" /> @@ -59,6 +48,62 @@ What it does ------------- + +This tool computes Reaction Activity Scores from gene expression (RNA-seq) dataset(s), as described in Graudenzi et al. Integration of transcriptomic data and metabolic networks in cancer samples reveals highly significant prognostic power. Journal of Biomedical Informatics, 2018, 87: 37-49. + +Accepted files: + - A gene expression dataset + +Format: +Tab-separated text file reporting the normalized expression level (e.g., TPM, RPKM, ...) of each gene (row) for a given sample (column). +Column header: sample ID. +Row header: gene ID. + + +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). + +Computation option ‘(A and NaN) solved as (A)’: +In case of missing expression value, referred to as NaN (Not a Number), for a gene joined with an AND operator in a given GPR rule, the rule ‘A and NaN’ + +If YES is selected: the GPR will be solved as A. + +If NO is selected: the GPR will be disregarded tout-court (i.e., treated as NaN). + +Example input +------------- + +Custom GPR rules: + ++------------+--------------------------------------+ +| id | rule (with entrez-id | ++============+======================================+ +| r1642 | 155060 or 10357 | ++------------+--------------------------------------+ +| r1643 | 155060 or 100134869 | ++------------+--------------------------------------+ +| r1640 | 155060 and 100134869 or 10357 | ++------------+--------------------------------------+ + +RNA-seq dataset: + ++------------+----------------+----------------+----------------+ +| Hugo_ID | TCGAA62670 | TCGAA62671 | TCGAA62672 | ++============+================+================+================+ +| HGNC:24086 | 0.523167 | 0.371355 | 0.925661 | ++------------+----------------+----------------+----------------+ +| HGNC:24086 | 0.568765 | 0.765567 | 0.456789 | ++------------+----------------+----------------+----------------+ +| HGNC:9876 | 0.876545 | 0.768933 | 0.987654 | ++------------+----------------+----------------+----------------+ +| HGNC:9 | 0.456788 | 0.876543 | 0.876542 | ++------------+----------------+----------------+----------------+ +| HGNC:23 | 0.876543 | 0.786543 | 0.897654 | ++------------+----------------+----------------+----------------+ + ]]> </help> <expand macro="citations" /> |