In [9]: rgc = RefGenConf(filepath="genomes.yaml")
In [10]: rgc.genome_server
Out[10]:
['http://refgenomes.databio.org',
'http://staging.refgenomes.databio.org',
'http://0.0.0.0:80']
In [11]: rgc.pull_asset("rCRSd","fasta","default")
Replace existing (/Users/mstolarczyk/Desktop/testing/test_genomes_new/rCRSd/fasta/default)? [y/N] y
rCRSd/fasta:default: 16.4kB [00:00, 871kB/s]
Out[11]:
(['rCRSd', 'fasta', 'default'],
{'asset_path': 'fasta',
'seek_keys': {'fasta': 'rCRSd.fa',
'fai': 'rCRSd.fa.fai',
'chrom_sizes': 'rCRSd.chrom.sizes'},
'archive_digest': '93e0b97572fb218aa69434e40975c8a6',
'archive_size': '8.6KB',
'asset_size': '38.7KB',
'asset_parents': [],
'asset_children': ['star_index:default',
'bwa_index:default',
'bowtie2_index:default',
'bismark_bt1_index:default',
'bismark_bt2_index:default',
'hisat2_index:default'],
'asset_digest': '4eb430296bc02ed7e4006624f1d5ac53'})
In [12]: rgc.genome_server
Out[12]: 'http://refgenomes.databio.org'
In [13]: rgc.pull_asset("rCRSd","fasta","default")
---------------------------------------------------------------------------
MissingSchema Traceback (most recent call last)
<ipython-input-13-c840b49930e7> in <module>
----> 1 rgc.pull_asset("rCRSd","fasta","default")
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/refgenconf/refgenconf.py in pull_asset(self, genome, asset, tag, unpack, force, get_json_url, build_signal_handler)
489 continue
490
--> 491 url_attrs = get_json_url(self.genome_server, API_ID_ASSET_ATTRS).format(genome=genome, asset=asset)
492 url_archive = get_json_url(self.genome_server, API_ID_ARCHIVE).format(genome=genome, asset=asset)
493
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/refgenconf/refgenconf.py in <lambda>(server, operation_id)
442
443 def pull_asset(self, genome, asset, tag, unpack=True, force=None,
--> 444 get_json_url=lambda server, operation_id: construct_request_url(server, operation_id),
445 build_signal_handler=_handle_sigint):
446 """
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/refgenconf/refgenconf.py in construct_request_url(server_url, operation_id)
1162 """
1163 try:
-> 1164 return server_url + _get_server_endpoints_mapping(server_url)[operation_id]
1165 except KeyError as e:
1166 _LOGGER.error("'{}' is not a compatible refgenieserver instance. "
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/refgenconf/refgenconf.py in _get_server_endpoints_mapping(url)
1176 :return dict: endpoints mapped by their operationIds
1177 """
-> 1178 json = _download_json(url + "/openapi.json")
1179 return _map_paths_by_id(asciify_json_dict(json) if sys.version_info[0] == 2 else json)
1180
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/refgenconf/refgenconf.py in _download_json(url, params)
899 import requests
900 _LOGGER.debug("Downloading JSON data; querying URL: '{}'".format(url))
--> 901 resp = requests.get(url, params=params)
902 if resp.ok:
903 return resp.json()
~/Library/Python/3.6/lib/python/site-packages/requests/api.py in get(url, params, **kwargs)
73
74 kwargs.setdefault('allow_redirects', True)
---> 75 return request('get', url, params=params, **kwargs)
76
77
~/Library/Python/3.6/lib/python/site-packages/requests/api.py in request(method, url, **kwargs)
58 # cases, and look like a memory leak in others.
59 with sessions.Session() as session:
---> 60 return session.request(method=method, url=url, **kwargs)
61
62
~/Library/Python/3.6/lib/python/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
517 hooks=hooks,
518 )
--> 519 prep = self.prepare_request(req)
520
521 proxies = proxies or {}
~/Library/Python/3.6/lib/python/site-packages/requests/sessions.py in prepare_request(self, request)
460 auth=merge_setting(auth, self.auth),
461 cookies=merged_cookies,
--> 462 hooks=merge_hooks(request.hooks, self.hooks),
463 )
464 return p
~/Library/Python/3.6/lib/python/site-packages/requests/models.py in prepare(self, method, url, headers, files, data, params, auth, cookies, hooks, json)
311
312 self.prepare_method(method)
--> 313 self.prepare_url(url, params)
314 self.prepare_headers(headers)
315 self.prepare_cookies(cookies)
~/Library/Python/3.6/lib/python/site-packages/requests/models.py in prepare_url(self, url, params)
385 error = error.format(to_native_string(url, 'utf8'))
386
--> 387 raise MissingSchema(error)
388
389 if not host:
MissingSchema: Invalid URL 'h/openapi.json': No schema supplied. Perhaps you meant http://h/openapi.json?