-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Use the new JSON-API #8 * Add docstring * Add __init__.py to tests * Add test_download_pathway_archive.py to tests * Refactor download_pathway_archive.py to use new JSON-API endpoint
- Loading branch information
Showing
4 changed files
with
60 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
from .utilities import * | ||
import requests | ||
|
||
def list_organisms(): | ||
res = wikipathways_get('listOrganisms', {'format': 'json'}) | ||
return res['organisms'] | ||
"""List Organisms. | ||
Retrieve the list of organisms supported by WikiPathways | ||
Returns: | ||
list: A list of organisms | ||
Example: | ||
>>> list_organisms() | ||
""" | ||
res = requests.get("https://www.wikipathways.org/json/listOrganisms.json") | ||
res.raise_for_status() | ||
return res.json()['organisms'] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
from pywikipathways.download_pathway_archive import * | ||
|
||
def test_successful_download(): | ||
filename = download_pathway_archive(date='current', organism='Mus musculus', format='gpml') | ||
assert filename == 'wikipathways-20240910-gpml-Mus_musculus.zip' | ||
|
||
filename = download_pathway_archive(date='current', organism='Mus musculus', format='gmt') | ||
assert filename == 'wikipathways-20240910-gmt-Mus_musculus.gmt' | ||
|
||
filename = download_pathway_archive(date='current', organism='Mus musculus', format='svg') | ||
assert filename == 'wikipathways-20240910-svg-Mus_musculus.zip' | ||
|