Mercurial > repos > proteore > proteore_reactome
changeset 8:a58dc5d4b8cd draft
planemo upload commit 4ba1ebe7b3f5e3fabf78b5fed7ed0b92e2cbf9e5-dirty
author | proteore |
---|---|
date | Fri, 28 Jun 2019 05:17:11 -0400 |
parents | 6c95f1b88627 |
children | badc91b93945 |
files | reactome_analysis.py reactome_analysis.xml |
diffstat | 2 files changed, 28 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- 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"]))
--- 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 @@ -<tool id="reactome_analysis" name="Query pathway database" version="2019.03.05"> +<tool id="reactome_analysis" name="Query pathway database" version="2019.06.27"> <description>[Reactome]</description> <requirements> </requirements> @@ -20,7 +20,7 @@ ]]></command> <inputs> <conditional name="opt"> - <param name="input" type="select" label="Input IDs (UniProt Accession number, Entrez Gene ID or Gene Name" multiple="False" > + <param name="input" type="select" label="Input IDs (UniProt Accession number, Entrez Gene ID, Gene Name)" multiple="False" > <option value="text">Copy/paste your list of IDs </option> <option value="file" selected="true">Input file containing your IDs</option> </param> @@ -44,7 +44,7 @@ </param> </when> </conditional> - <param name="species" type="select" label="Species"> + <param name="species" type="select" label="Species (human, mouse, rat)"> <option value="48887">Human (Homo sapiens)</option> <option value="48892">Mouse (Mouse musculus)</option> <option value="48895">Rat (Rattus norvegicus)</option> @@ -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. ]]></help> <citations> </citations>