# HG changeset patch # User proteore # Date 1545145430 18000 # Node ID 9cc475dcd0f2fec0cec0355c79ce0c3e0cc3eef5 # Parent 7fbd66f985b79f2bff63423b99f905ad1ebc2734 planemo upload commit ad5f1c5a1a71d7fa2bc8bac408856aa80b0fc2a3 diff -r 7fbd66f985b7 -r 9cc475dcd0f2 README.rst diff -r 7fbd66f985b7 -r 9cc475dcd0f2 reactome_analysis.py --- a/reactome_analysis.py Tue Apr 10 04:35:05 2018 -0400 +++ b/reactome_analysis.py Tue Dec 18 10:03:50 2018 -0500 @@ -43,9 +43,7 @@ trash = [] if identifiers[1] == "list": 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": @@ -57,15 +55,16 @@ else: idens = [x.split("\t")[int(identifiers[3].replace("c", ""))-1] for x in mq] 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 2> stderr" % ids).read() if len(id_valid(idens)[1]) > 0: trash = id_valid(idens)[1] - print(json_string) + #print(json_string) + j = json.loads(json_string) + print ("Identifiers not found: " + str(j["identifiersNotFound"])) + print ("Pathways found: " + str(j["pathwaysFound"])) 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 +73,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: @@ -82,7 +82,7 @@ output.close() if trash: - print(trash) + #print(trash) trash_out = open(trash_file, "w") trash_out.write("\n".join(trash)) trash_out.close() @@ -92,10 +92,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 7fbd66f985b7 -r 9cc475dcd0f2 reactome_analysis.xml --- a/reactome_analysis.xml Tue Apr 10 04:35:05 2018 -0400 +++ b/reactome_analysis.xml Tue Dec 18 10:03:50 2018 -0500 @@ -1,27 +1,31 @@ - - queries web service and display pathways - + + - + - + - + @@ -33,17 +37,21 @@ - - - + + + - + + + + + @@ -59,11 +67,30 @@ diff -r 7fbd66f985b7 -r 9cc475dcd0f2 template.html --- a/template.html Tue Apr 10 04:35:05 2018 -0400 +++ b/template.html Tue Dec 18 10:03:50 2018 -0500 @@ -35,7 +35,7 @@

Please click the button to execute the analysis:

-
+ diff -r 7fbd66f985b7 -r 9cc475dcd0f2 test-data/ID_Converter_FKW_Lacombe_et_al_2017_OK.txt diff -r 7fbd66f985b7 -r 9cc475dcd0f2 test-data/Reactome_Analysis_Tools.html diff -r 7fbd66f985b7 -r 9cc475dcd0f2 test-data/Reactome_Analysis_Tools_invalid_ID.txt