-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-download complex and family data
- Loading branch information
Showing
3 changed files
with
49 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import requests | ||
import os | ||
from requests.models import Response | ||
|
||
|
||
class SignorDownloader: | ||
@staticmethod | ||
def write_response_content(response: Response, file_basename, destination_dir=None): | ||
if destination_dir is None: | ||
destination_dir = "resources" | ||
file_target = os.path.join(destination_dir, file_basename) | ||
with open(file_target, "wb") as ft: | ||
ft.write(response.content) | ||
return file_target | ||
|
||
@staticmethod | ||
def download_complexes(destination_dir=None): | ||
response = requests.post(url="https://signor.uniroma2.it/download_complexes.php", | ||
data={"submit": "Download complex data"}) | ||
file_basename = "SIGNOR_complexes.csv" | ||
return SignorDownloader.write_response_content(response, file_basename, destination_dir=destination_dir) | ||
|
||
@staticmethod | ||
def download_families(destination_dir=None): | ||
response = requests.post(url="https://signor.uniroma2.it/download_complexes.php", | ||
data={"submit": "Download protein family data"}) | ||
file_basename = "SIGNOR_PF.csv" | ||
return SignorDownloader.write_response_content(response, file_basename, destination_dir=destination_dir) |
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