# HG changeset patch # User proteore # Date 1561713431 14400 # Node ID a58dc5d4b8cdccbfa0a7014e3b37fe3c3dc610b8 # Parent 6c95f1b88627814ba0fb747415f5a41cc790cc51 planemo upload commit 4ba1ebe7b3f5e3fabf78b5fed7ed0b92e2cbf9e5-dirty diff -r 6c95f1b88627 -r a58dc5d4b8cd reactome_analysis.py --- a/reactome_analysis.py Tue Mar 05 09:40:41 2019 -0500 +++ b/reactome_analysis.py Fri Jun 28 05:17:11 2019 -0400 @@ -1,7 +1,4 @@ -import os -import re -import json -import argparse +import os, re, json, argparse, csv CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -42,22 +39,29 @@ """ trash = [] if identifiers[1] == "list": - ids = "\n".join(id_valid(identifiers[0].split())[0]) + ids = identifiers[0].split() + ids = [x.split(";") for x in ids] + ids = [item.strip() for sublist in ids for item in sublist if item != ''] 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": header = identifiers[2] - mq = open(identifiers[0]).readlines() - if isnumber("int", identifiers[3].replace("c", "")): - if header == "true": - idens = [x.split("\t")[int(identifiers[3].replace("c", ""))-1] for x in mq[1:]] - else: - idens = [x.split("\t")[int(identifiers[3].replace("c", ""))-1] for x in mq] - ids = "\n".join(id_valid(idens)[0]) - 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] + with open(identifiers[0],"r") as mq : + file_content = csv.reader(mq,delimiter="\t") + file_content = list(file_content) #csv object to list + ncol = identifiers[3] + if isnumber("int", ncol.replace("c", "")): + if header == "true": + idens = [x for x in [line[int(ncol.replace("c", ""))-1].split(";") for line in file_content[1:]]] + else: + idens = [x for x in [line[int(ncol.replace("c", ""))-1].split(";") for line in file_content]] + + idens = [item.strip() for sublist in idens for item in sublist if item != ''] #flat list of list of lists, remove empty items + ids = "\n".join(id_valid(idens)[0]) + 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) j = json.loads(json_string) print ("Identifiers not found: " + str(j["identifiersNotFound"])) diff -r 6c95f1b88627 -r a58dc5d4b8cd reactome_analysis.xml --- a/reactome_analysis.xml Tue Mar 05 09:40:41 2019 -0500 +++ b/reactome_analysis.xml Fri Jun 28 05:17:11 2019 -0400 @@ -1,4 +1,4 @@ - + [Reactome] @@ -20,7 +20,7 @@ ]]> - + @@ -44,7 +44,7 @@ - + @@ -82,6 +82,10 @@ ID types allowed are: UniProt accNumber (e.g. O75391), Entrez gene ID (e.g. 8086) and gene name (e.g. TP53, NUP58...). If you have other type of ID, please use the ID_Converter tool of ProteoRE. +.. class:: warningmark + +In copy/paste mode, the number of IDs considered in input is limited to 5000. + ----- **Parameters** @@ -108,13 +112,13 @@ **Galaxy integration** -T.P. Lien Nguyen, Florence Combes, Yves Vandenbrouck - CEA, INSERM, CNRS, Grenoble-Alpes University, BIG Institute, FR +Lien Nguyen, Florence Combes, Yves Vandenbrouck - CEA, INSERM, CNRS, Grenoble-Alpes University, BIG Institute, FR Sandra Dérozier, Olivier Rué, Christophe Caron, Valentin Loux - INRA, Paris-Saclay University, MAIAGE Unit, Migale Bioinformatics platform, FR This work has been partially funded through the French National Agency for Research (ANR) IFB project. -Contact support@proteore.org for any questions or concerns about the Galaxy implementation of this tool. +Help: contact@proteore.org for any questions or concerns about this tool. ]]>