Skip to content

Commit 119a3d8

Browse files
committed
Add instruction for updating the new databases
1 parent 3e38820 commit 119a3d8

File tree

2 files changed

+69
-33
lines changed

2 files changed

+69
-33
lines changed

docs/source/pyrice_instruction.rst

Lines changed: 68 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -135,38 +135,6 @@ To save the result, package uses the :py:func:`~pyrice.multi_query.MultiQuery.sa
135135
>>> query.save(result, save_path = "./result/",
136136
format=["csv", "html", "json", "pkl"], hyper_link=False)
137137

138-
Search new attributes on new databases
139-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140-
PyRice package supports query on new databases by adding its description manually on file `database_description.xml`. Use the :py:func:`~pyrice.multi_query.MultiQuery.query_new_databse` function in the :py:class:`~pyrice.multi_query.MultiQuery` class::
141-
142-
>>> from pyrice.multi_query import MultiQuery
143-
144-
>>> query = MultiQuery()
145-
>>> result = query.query_new_database(atts=['AT4G32150'], number_process= 4,
146-
multi_processing=True,multi_threading=True,dbs=['planteome'])
147-
148-
149-
This function returns a :py:class:`dictionary`.::
150-
151-
>>> print("Output database:",result)
152-
Output database:
153-
{'AT4G32150': {
154-
'planteome': {
155-
'service': '/api/search/annotation',
156-
'status': 'success.',
157-
'arguments': '{}',
158-
'comments': ['Results found for: annotation; queries: ; filters: '],
159-
'data': [{...}]
160-
...},
161-
...}
162-
}
163-
164-
To save the result, package uses the :py:func:`~pyrice.multi_query.MultiQuery.save` function in the :py:class:`~pyrice.multi_query.MultiQuery` with different types of file html, pkl, json, csv.::
165-
166-
>>> query.save(result, save_path="./result/",
167-
format=["csv", "html", "json", "pkl"], hyper_link=False)
168-
169-
170138
Using the build_dictionary module
171139
---------------------------------
172140

@@ -253,3 +221,71 @@ Example: here is a Oryzabase database::
253221
<prettify>\n>LOC_.*\n|\n|\r|\t</prettify>
254222
</database>
255223

224+
Search new attributes on new databases
225+
--------------------------------------
226+
227+
Add new database
228+
^^^^^^^^^^^^^^^^^^^
229+
PyRice package supports queries on new databases by adding its description manually on `database_description.xml`.
230+
With JSON format, here is SNP-SEEK database with API: https://snp-seek.irri.org/ws/genomics/gene/osnippo/chr01?start=1&end=15000&model=iric::
231+
232+
<database dbname="snpseek" type="text/JSON" method="GET" normalize="false">
233+
<link stern="https://snp-seek.irri.org/ws/genomics/gene/osnippo/" aft=""/>
234+
<fields>
235+
<field></field>
236+
<field op="=">start</field>
237+
<field op="=">end</field>
238+
<field op="=">model</field>
239+
</fields>
240+
</database>
241+
242+
For more details:
243+
- dbname : database name
244+
- type : the result return by API
245+
- method : GET/POST (usually GET)
246+
- normalize : normalize name of database true/false (usually false)
247+
- stern : URL of API
248+
- op : paramaters (see on API above)
249+
250+
For example, with an API from Planteome: http://browser.planteome.org/api/search/annotation?bioentity=AT4G32150::
251+
252+
<database dbname="planteome" type="text/JSON" method="GET" normalize="false">
253+
<link stern="http://browser.planteome.org/api/search/annotation?" aft=""></link>
254+
<fields>
255+
<field op="=">bioentity</field>
256+
</fields>
257+
</database>
258+
259+
Use new query funtion
260+
^^^^^^^^^^^^^^^^^^^^^
261+
Use the :py:func:`~pyrice.multi_query.MultiQuery.query_new_databse` function in the :py:class:`~pyrice.multi_query.MultiQuery` class::
262+
263+
>>> from pyrice.multi_query import MultiQuery
264+
265+
>>> query = MultiQuery()
266+
>>> result = query.query_new_database(atts=['AT4G32150'], number_process= 4,
267+
multi_processing=True,multi_threading=True,dbs=['planteome'])
268+
269+
270+
This function returns a :py:class:`dictionary`.::
271+
272+
>>> print("Output database:",result)
273+
Output database:
274+
{'AT4G32150': {
275+
'planteome': {
276+
'service': '/api/search/annotation',
277+
'status': 'success.',
278+
'arguments': '{}',
279+
'comments': ['Results found for: annotation; queries: ; filters: '],
280+
'data': [{...}]
281+
...},
282+
...}
283+
}
284+
285+
To save the result, package uses the :py:func:`~pyrice.multi_query.MultiQuery.save` function in the :py:class:`~pyrice.multi_query.MultiQuery` with different types of file html, pkl, json, csv.::
286+
287+
>>> query.save(result, save_path="./result/",
288+
format=["csv", "html", "json", "pkl"], hyper_link=False)
289+
290+
.. note:: With APIs return results with HTML and Javascript format, it might have some problems due to the difference of GUI (Javascript) or tag (HTML).
291+
So, we are working to simplize the package on those two formats to make it easier for updating new databases.

pyrice/database_description.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
<field>MSU</field>
189189
</fields>
190190
</database>
191+
191192
<database dbname="snpseek" type="text/JSON" method="GET" normalize="false">
192193
<link stern="https://snp-seek.irri.org/ws/genomics/gene/osnippo/" aft=""/>
193194
<fields>
@@ -196,7 +197,6 @@
196197
<field op="=">end</field>
197198
<field op="=">model</field>
198199
</fields>
199-
<data_struct indicator="div" identifier="id" identification_string="subcontent" line_separator="tr" cell_separator="td"/>
200200
</database>
201201

202202
<!--cell_separator="b"-->

0 commit comments

Comments
 (0)