Mercurial > repos > proteore > proteore_reactome
changeset 1:8200968789c1 draft
planemo upload commit 1b95e5bc85662f10cdd6305587ccee8faf9a2354-dirty
| author | proteore |
|---|---|
| date | Fri, 07 Dec 2018 10:43:57 -0500 |
| parents | 19d8daa1eb2e |
| children | db63d069b5e6 |
| files | reactome_analysis.py reactome_analysis.xml template.html |
| diffstat | 3 files changed, 22 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/reactome_analysis.py Mon Nov 26 04:48:25 2018 -0500 +++ b/reactome_analysis.py Fri Dec 07 10:43:57 2018 -0500 @@ -45,7 +45,7 @@ ids = "\n".join(id_valid(identifiers[0].split())[0]) #print(ids) #print("curl -H \"Content-Type: text/plain\" -d \"$(printf '%s')\" -X POST --url www.reactome.org/AnalysisService/identifiers/projection/\?pageSize\=1\&page\=1" % ids) - json_string = os.popen("curl -H \"Content-Type: text/plain\" -d \"$(printf '%s')\" -X POST --url www.reactome.org/AnalysisService/identifiers/projection/\?pageSize\=1\&page\=1" % ids).read() + json_string = os.popen("curl -H \"Content-Type: text/plain\" -d \"$(printf '%s')\" -X POST --url www.reactome.org/AnalysisService/identifiers/\?pageSize\=1\&page\=1" % ids).read() if len(id_valid(identifiers[0].split())[1]) > 0: trash = id_valid(identifiers[0].split())[1] elif identifiers[1] == "file": @@ -59,13 +59,13 @@ ids = "\n".join(id_valid(idens)[0]) #print(ids) #print("curl -H \"Content-Type: text/plain\" -d \"$(printf '%s')\" -X POST --url www.reactome.org/AnalysisService/identifiers/projection/\?pageSize\=1\&page\=1" % ids) - json_string = os.popen("curl -H \"Content-Type: text/plain\" -d \"$(printf '%s')\" -X POST --url www.reactome.org/AnalysisService/identifiers/projection/\?pageSize\=1\&page\=1" % ids).read() + json_string = os.popen("curl -H \"Content-Type: text/plain\" -d \"$(printf '%s')\" -X POST --url www.reactome.org/AnalysisService/identifiers/\?pageSize\=1\&page\=1" % ids).read() if len(id_valid(idens)[1]) > 0: trash = id_valid(idens)[1] print(json_string) return json_string, trash -def write_output(filename, json_string, trash_file, trash): +def write_output(filename, json_string, species, trash_file, trash): """ Replace json result in template and print to output """ @@ -74,6 +74,7 @@ try: for line in template: if "{token}" in line: + line = line.replace("{species}", species) line = line.replace("{token}", json.loads(json_string)["summary"]["token"]) output.write(line) except ValueError: @@ -92,10 +93,11 @@ argument = parser.add_argument("--json", nargs="+", required=True) argument = parser.add_argument("--output", default="output.html") argument = parser.add_argument("--trash", default="trash.txt") + argument = parser.add_argument("--species", default="48887") args = parser.parse_args() filename = args.output json_string, trash = data_json(args.json) - write_output(filename, json_string, args.trash, trash) + write_output(filename, json_string, args.species, args.trash, trash) if __name__ == "__main__": options()
--- a/reactome_analysis.xml Mon Nov 26 04:48:25 2018 -0500 +++ b/reactome_analysis.xml Fri Dec 07 10:43:57 2018 -0500 @@ -1,4 +1,4 @@ -<tool id="reactome_analysis" name="Reactome" version="2018.10.12"> +<tool id="reactome_analysis" name="Reactome" version="2018.12.07"> <description>display your protein list on the Reactome pathway browser</description> <requirements> </requirements> @@ -6,11 +6,16 @@ <exit_code range="1:" /> </stdio> <command><![CDATA[ + + python $__tool_directory__/reactome_analysis.py #if $opt.input == "text" - python $__tool_directory__/reactome_analysis.py --json "$opt.list" "list" --output "$output" --trash "$trash" + --json "$opt.list" "list" #else if $opt.input == "file" - python $__tool_directory__/reactome_analysis.py --json "$opt.file" "file" $opt.header $opt.ncol --output "$output" --trash "$trash" + --json "$opt.file" "file" "$opt.header" "$opt.ncol" #end if + --output "$output" + --trash "$trash" + --species "$species" ]]></command> <inputs> @@ -36,8 +41,12 @@ <param name="header" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does your input file contain header?" /> <param type="text" name="ncol" value="c1" label="Please specify the column number where are your IDs (e.g : Enter c1 for column n°1)" /> </when> - </conditional> + <param name="species" type="select" label="Select species"> + <option value="48887">Human (H. sapiens)</option> + <option value="48892">Mouse (M. musculus)</option> + <option value="48895">Rat (R. norvegicus)</option> + </param> </inputs> <outputs> <data name="output" format="html" label="" /> @@ -64,6 +73,8 @@ **Supported IDs: Uniprot accession number (e.g. P01023), Entrez gene ID (e.g.7157), gene name (e.g. AQP7). If there is any ID containing invalid characters, it will be removed from the queue and placed in "Invalid identifiers" file.** +**Supported species: Human (H. sapiens), Mouse (M. musculus), Rat (Rattus norvegicus)** + ----- .. class:: infomark
--- a/template.html Mon Nov 26 04:48:25 2018 -0500 +++ b/template.html Fri Dec 07 10:43:57 2018 -0500 @@ -35,7 +35,7 @@ <p>Please click the button to execute the analysis:</p> - <form action="http://www.reactome.org/PathwayBrowser/#/DTAB=AN&ANALYSIS={token}" target="_blank"> + <form action="http://www.reactome.org/PathwayBrowser/#/SPECIES={species}&DTAB=AN&ANALYSIS={token}" target="_blank"> <button>Analyse</button>
