# HG changeset patch # User proteore # Date 1544197437 18000 # Node ID 8200968789c179785e15a31454d7b78d11454025 # Parent 19d8daa1eb2ef11df23f5b12434baf526afbad05 planemo upload commit 1b95e5bc85662f10cdd6305587ccee8faf9a2354-dirty diff -r 19d8daa1eb2e -r 8200968789c1 reactome_analysis.py --- 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() diff -r 19d8daa1eb2e -r 8200968789c1 reactome_analysis.xml --- 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 @@ - + display your protein list on the Reactome pathway browser @@ -6,11 +6,16 @@ @@ -36,8 +41,12 @@ - + + + + + @@ -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 diff -r 19d8daa1eb2e -r 8200968789c1 template.html --- 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 @@

Please click the button to execute the analysis:

-
+