Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
If `allow_older_downloaded_release` is True, and some older releases have
been downloaded, then return the most recent locally available release.
Otherwise, return the newest release of Ensembl (even if its data hasn't
already been downloaded).
"""
reference_name = normalize_reference_name(reference_name)
species = find_species_by_reference(reference_name)
(min_ensembl_release, max_ensembl_release) = \
species.reference_assemblies[reference_name]
if allow_older_downloaded_release:
# go through candidate releases in descending order
for release in reversed(range(min_ensembl_release, max_ensembl_release + 1)):
# check if release has been locally downloaded
candidate = EnsemblRelease.cached(release=release, species=species)
if candidate.required_local_files_exist():
return candidate
# see if any of the releases between [max, min] are already locally
# available
return EnsemblRelease.cached(release=max_ensembl_release, species=species)
def cached_release(release, species="human"):
"""
Create an EnsemblRelease instance only if it's hasn't already been made,
otherwise returns the old instance.
Keeping this function for backwards compatibility but this functionality
has been moving into the cached method of EnsemblRelease.
"""
return EnsemblRelease.cached(release=release, species=species)
already been downloaded).
"""
reference_name = normalize_reference_name(reference_name)
species = find_species_by_reference(reference_name)
(min_ensembl_release, max_ensembl_release) = \
species.reference_assemblies[reference_name]
if allow_older_downloaded_release:
# go through candidate releases in descending order
for release in reversed(range(min_ensembl_release, max_ensembl_release + 1)):
# check if release has been locally downloaded
candidate = EnsemblRelease.cached(release=release, species=species)
if candidate.required_local_files_exist():
return candidate
# see if any of the releases between [max, min] are already locally
# available
return EnsemblRelease.cached(release=max_ensembl_release, species=species)