How to use the pyensembl.ensembl_release.EnsemblRelease.cached function in pyensembl

To help you get started, we’ve selected a few pyensembl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openvax / pyensembl / pyensembl / reference_name.py View on Github external
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)
github openvax / pyensembl / pyensembl / ensembl_release.py View on Github external
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)
github openvax / pyensembl / pyensembl / reference_name.py View on Github external
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)