annotate sparql_uniprot.py @ 23:478f5587f12a draft default tip

Uploaded
author fabad
date Sun, 22 Oct 2017 15:57:18 -0400
parents 9bb153d42a1c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
1 from SPARQLWrapper import SPARQLWrapper, JSON
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
2 import sys
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
3
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
4 # Constante con los prefijos comunes a usar en queries
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
5 COMMON_PREFIXES = """
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
6 PREFIX up:<http://purl.uniprot.org/core/>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
7 PREFIX keywords:<http://purl.uniprot.org/keywords/>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
8 PREFIX uniprotkb:<http://purl.uniprot.org/uniprot/>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
9 PREFIX taxon:<http://purl.uniprot.org/taxonomy/>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
10 PREFIX ec:<http://purl.uniprot.org/enzyme/>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
11 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
12 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
13 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
14 PREFIX owl:<http://www.w3.org/2002/07/owl#>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
15 PREFIX bibo:<http://purl.org/ontology/bibo/>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
16 PREFIX dc:<http://purl.org/dc/terms/>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
17 PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
18 PREFIX faldo:<http://biohackathon.org/resource/faldo#>
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
19 """
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
20
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
21 # Lista con los nombres de las variables que obtenemos de la base de datos.
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
22 paramList = ['protein', 'proteinFullName', 'geneName', 'organismName', 'diseaseAnnotationText', 'domainFullName', 'similarityAnnotationText', 'locationAnnotationText', 'functionAnnotationText', 'pharmaceuticalAnnotationText'];
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
23
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
24 def buildQuery(proteinId, proteinName, geneName, organismName, diseaseAnnotation, domainName, similarityAnnotation, locationAnnotation, functionAnnotation, pharmaceuticalAnnotation):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
25 query = COMMON_PREFIXES
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
26 query += "select distinct \n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
27 query += " ?protein\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
28 query += " ?proteinFullName\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
29 query += " ?geneName\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
30 query += " ?organismName\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
31 query += " ?diseaseAnnotationText\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
32 query += " ?domainFullName\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
33 query += " ?similarityAnnotationText\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
34 query += " ?locationAnnotationText\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
35 query += " ?functionAnnotationText\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
36 query += " ?pharmaceuticalAnnotationText\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
37 query += "where{\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
38
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
39 query += " ?protein a up:Protein .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
40
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
41 if (proteinId != ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
42 query += " VALUES ?protein {uniprotkb:"+ proteinId + "}\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
43
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
44 query += "\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
45
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
46 if (proteinName == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
47 query += " OPTIONAL {\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
48 query += " ?protein up:recommendedName ?proteinName .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
49 query += " ?proteinName up:fullName ?proteinFullName . \n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
50 if (proteinName !=''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
51 query += " filter( regex(str(?proteinFullName), " + '"' + proteinName + '"' + ",\"i\" )) .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
52 if (proteinName == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
53 query += " }\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
54 query += "\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
55
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
56 if (geneName == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
57 query += " OPTIONAL {\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
58 query += " ?protein up:encodedBy ?gene .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
59 query += " ?gene skos:prefLabel ?geneName .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
60 if (geneName != ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
61 query += " filter( regex(str(?geneName), " + '"' + geneName + '"' + ",\"i\" )) .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
62 if (geneName == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
63 query += " }\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
64
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
65 query += "\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
66
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
67 if (organismName == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
68 query += " OPTIONAL {\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
69 query += " ?protein up:organism ?organism .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
70 query += " ?organism up:scientificName ?organismName .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
71 if (organismName != ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
72 query += " filter( regex(str(?organismName), " + '"' + organismName + '"' + ",\"i\" )) .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
73 if (organismName == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
74 query += " }\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
75
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
76 query += "\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
77
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
78 if (diseaseAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
79 query += " OPTIONAL {\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
80 query += " ?protein up:annotation ?diseaseAnnotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
81 query += " ?diseaseAnnotation a up:Disease_Annotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
82 query += " ?diseaseAnnotation up:disease ?disease .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
83 query += " ?disease rdfs:comment ?diseaseAnnotationText\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
84 if (diseaseAnnotation != ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
85 query += " filter( regex(str(?diseaseAnnotationText), " + '"' + diseaseAnnotation + '"' + ",\"i\" )) .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
86 if (diseaseAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
87 query += " }\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
88
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
89 query += "\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
90
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
91 if (domainName == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
92 query += " OPTIONAL {\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
93 query += " ?protein up:domain ?domain .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
94 query += " ?domain up:recommendedName ?domainName .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
95 query += " ?domainName up:fullName ?domainFullName .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
96 if (domainName != ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
97 query += " filter( regex(str(?domainFullName), " + '"' + domainName + '"' + ",\"i\" )) .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
98 if (domainName == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
99 query += " }\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
100
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
101 query += "\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
102
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
103 if (similarityAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
104 query += " OPTIONAL {\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
105 query += " ?protein up:annotation ?similarityAnnotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
106 query += " ?similarityAnnotation a up:Similarity_Annotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
107 query += " ?similarityAnnotation rdfs:comment ?similarityAnnotationText .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
108 if (similarityAnnotation != ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
109 query += " filter( regex(str(?similarityAnotationText), " + '"' + similarityAnnotation + '"' + ",\"i\" )) .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
110 if (similarityAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
111 query += " }\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
112
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
113 query += "\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
114
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
115 if (locationAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
116 query += " OPTIONAL {\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
117 query += " ?protein up:annotation ?locationAnnotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
118 query += " ?locationAnnotation a up:Subcellular_Location_Annotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
119 query += " ?locationAnnotation up:locatedIn ?location .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
120 query += " ?location up:cellularComponent ?cellComponent .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
121 query += " ?cellComponent rdfs:comment ?locationAnnotationText .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
122 if (locationAnnotation != ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
123 query += " filter( regex(str(?locationAnnotationText), " + '"' + locationAnnotation + '"' + ",\"i\" )) .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
124 if (locationAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
125 query += " }\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
126
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
127 query += "\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
128
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
129 if (functionAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
130 query += " OPTIONAL {\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
131 query += " ?protein up:annotation ?functionAnnotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
132 query += " ?functionAnnotation a up:Function_Annotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
133 query += " ?functionAnnotation rdfs:comment ?functionAnnotationText .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
134 if (functionAnnotation != ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
135 query += " filter( regex(str(?functionAnnotationText), " + '"' + functionAnnotation + '"' + ",\"i\" )) .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
136 if(functionAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
137 query += " }\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
138
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
139 query += "\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
140
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
141 if (pharmaceuticalAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
142 query += " OPTIONAL {\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
143 query += " ?protein up:annotation ?pharmaceuticalAnnotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
144 query += " ?pharmaceuticalAnnotation a up:Pharmaceutical_Annotation .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
145 query += " ?pharmaceuticalAnnotation rdfs:comment ?pharmaceuticalAnnotationText .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
146 if (pharmaceuticalAnnotation != ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
147 query += " filter( regex(str(?pharmaceuticalAnnotationText), " + '"' + pharmaceuticalAnnotation + '"' + ",\"i\" )) .\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
148 if (pharmaceuticalAnnotation == ''):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
149 query += " }\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
150 query += "}\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
151 #query += "limit 30\n"
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
152
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
153 return query
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
154
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
155 def printResults(json, output):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
156 # Abrir fichero para escritura
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
157 fileRes = open(output, 'w')
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
158 # Imprimir cabecera
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
159 for param in paramList:
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
160 fileRes.write(param + "\t")
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
161 fileRes.write("\n")
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
162
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
163 # El formato json se puede recorrer de esta manera
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
164 # para ir obteniendo valores de la respuesta.
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
165 for entrada in json["results"]["bindings"]:
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
166 for param in paramList:
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
167 if (entrada.get(param)):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
168 fileRes.write(entrada.get(param)["value"] + "\t")
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
169 else:
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
170 fileRes.write("\t")
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
171 fileRes.write("\n")
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
172 fileRes.close()
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
173
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
174 def sparqlwrap(proteinId, proteinName, geneName, organismName, diseaseAnnotation, domainName, similarityAnnotation, locationAnnotation, functionAnnotation, pharmaceuticalAnnotation, output):
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
175
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
176 query = buildQuery(proteinId, proteinName, geneName, organismName, diseaseAnnotation, domainName, similarityAnnotation, locationAnnotation, functionAnnotation, pharmaceuticalAnnotation)
23
478f5587f12a Uploaded
fabad
parents: 2
diff changeset
177 print (query)
2
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
178
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
179 # Creamos un objeto del tipo SPARQLWrapper indicando en que
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
180 # direccion esta el servicio que recibe consultas en sparql
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
181 # y responde a estas.
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
182 sparql = SPARQLWrapper('http://sparql.uniprot.org/sparql')
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
183
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
184 # Especificamos la consulta que queremos hacer en sparql.
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
185 sparql.setQuery(query)
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
186
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
187 # Indicamos en que formato queremos que nos devuelva
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
188 # los resultados de la consulta. Puede ser json, xml,
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
189 # rfd, turtle... Simplemente son distintos formatos
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
190 # para representar los datos en ficheros de texto.
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
191 sparql.setReturnFormat(JSON)
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
192
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
193 # Esta es la instruccion que realiza la consulta a
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
194 # uniprot. Devuelve un objeto de python que hay que
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
195 # tratar.
23
478f5587f12a Uploaded
fabad
parents: 2
diff changeset
196 print ("Ejecutando query")
2
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
197 results = sparql.query()
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
198
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
199 # Con esto, convertimos el objeto devuelto por
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
200 # el servicio al formato que especificamos antes.
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
201 # En este caso, json.
23
478f5587f12a Uploaded
fabad
parents: 2
diff changeset
202 print ("Conviertiendo a json")
2
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
203 json = results.convert()
23
478f5587f12a Uploaded
fabad
parents: 2
diff changeset
204 print ("Fin conversion a json")
2
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
205
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
206 # Dentro de la variable results tenemos informacion
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
207 # (metadatos) de lo que ha devuelto el servidor de
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
208 # uniprot.
23
478f5587f12a Uploaded
fabad
parents: 2
diff changeset
209 print (results.info())
2
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
210
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
211 # Imprimir resultados
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
212 printResults(json, output)
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
213
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
214
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
215 # Obtener parametros de la linea de comandos.
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
216 proteinId = sys.argv[1]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
217 proteinName = sys.argv[2]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
218 geneName = sys.argv[3]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
219 organismName = sys.argv[4]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
220 diseaseAnnotation = sys.argv[5]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
221 domainName =sys.argv[6]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
222 similarityAnnotation = sys.argv[7]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
223 locationAnnotation = sys.argv[8]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
224 functionAnnotation = sys.argv[9]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
225 pharmaceuticalAnnotation = sys.argv[10]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
226 output = sys.argv[11]
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
227
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
228 # Llamada a la funcion que realiza la consulta.
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
229 sparqlwrap(proteinId, proteinName, geneName, organismName, diseaseAnnotation, domainName, similarityAnnotation, locationAnnotation, functionAnnotation, pharmaceuticalAnnotation, output)
9bb153d42a1c Uploaded
fabad
parents:
diff changeset
230