def retrieve(cls, pdbs, suffix: str, folder: Path, file_suffix: Optional[str] = None, concur_req: int = 20, rate: float = 1.5, ret_res: bool = True, **kwargs): res = UnsyncFetch.multi_tasks(cls.yieldTasks(pdbs, suffix, file_suffix, folder), concur_req=concur_req, rate=rate, ret_res=ret_res, semaphore=kwargs.get('semaphore', None)) return res
def retrieve(cls, suffix: str, params_collection: Iterable[Dict], folder: Union[Path, str], concur_req: int = 20, rate: float = 1.5, ret_res: bool = True, **kwargs): assert suffix in cls.api_set, f"Invalid suffix! Valid set is \n{cls.api_set}" folder = Path(folder) res = UnsyncFetch.multi_tasks(cls.yieldTasks(suffix, params_collection, folder), concur_req=concur_req, rate=rate, ret_res=ret_res, semaphore=kwargs.get('semaphore', None)) return res
def retrieve(cls, unps, folder: Optional[Union[Path, str]] = None, params: Dict = dict(provider='swissmodel'), concur_req: int = 20, rate: float = 1.5, file_format: str = 'json', ret_res: bool = True, **kwargs): assert file_format in ('json', 'pdb'), "Invalid file format" res = UnsyncFetch.multi_tasks( cls.yieldTasks(unps, params, file_format, cls.folder if folder is None else folder), cls.process, concur_req=concur_req, rate=rate, ret_res=ret_res, semaphore=kwargs.get('semaphore', cls.web_semaphore)) return res
def retrieve(cls, pdbs: Union[Iterable, Iterator], suffix: str, method: str, folder: Union[str, Path], chunksize: int = 20, concur_req: int = 20, rate: float = 1.5, task_id: int = 0, ret_res: bool = True, **kwargs): # t0 = time.perf_counter() res = UnsyncFetch.multi_tasks(cls.yieldTasks(pdbs, suffix, method, folder, chunksize, task_id), cls.process, concur_req=concur_req, rate=rate, ret_res=ret_res, semaphore=kwargs.get('semaphore', None)) # elapsed = time.perf_counter() - t0 # cls.logger.info('{} ids downloaded in {:.2f}s'.format(len(res), elapsed)) return res
def retrieve_all_meta(cls, dataset: str = 'complete', suffix: str = 'user_data/{organism}/download/{dataset}/'): tasks = [cls.task_unit(cls.folder, f'{suffix.format(organism=organism, dataset=dataset)}interactions.dat', '.tsv', f'{organism}_{dataset}_interactions') for organism in cls.organisms] return UnsyncFetch.multi_tasks(tasks, semaphore=cls.get_web_semaphore())