Data Downloader

This tutorial reviews ASPIRE’s data downloading utility.

Data Downloader Introduction

ASPIRE provides a data downloading utility for downloading and caching some common example datasets. When applicable, the data will be loaded as an appropriate ASPIRE data type, such a as a Volume, Image, or ImageSource instance.

Below we take a look at the current list of datasets available for download. sphinx_gallery_start_ignore flake8: noqa sphinx_gallery_end_ignore

from aspire import downloader

downloader.available_downloads()
['emdb_2660', 'emdb_8012', 'emdb_2984', 'emdb_8511', 'emdb_3645', 'emdb_4905', 'emdb_10835', 'emdb_5778', 'emdb_6287', 'emdb_2824', 'emdb_14621', 'emdb_2484', 'emdb_6458', 'simulated_channelspin']

Data Caching

By default, the data downloader selects an appropriate cache directory based on the user operating system. Usually, the locations will be the following:

Default Cache Locations

OS

Cache Location

Mac

~/Library/Caches/ASPIRE-data

Linux

~/.cache/ASPIRE-data

Windows

C:\Users\<user>\AppData\Local\<AppAuthor>\ASPIRE-data\Cache

The cache location is configurable and can be overridden by creating a custom config.yaml. For example, to change the cache folder to /tmp/ASPIRE-data create $HOME/.config/ASPIRE/config.yaml with the following contents:

common:
  cache_dir: /tmp/ASPIRE-data

See the ASPIRE Conguration tutorial for more details on customizing your config.

Note

All downloads can be cleared from the cache with the remove_downloads() method:

downloader.remove_downloads()

Download an Example Dataset

Below we will download emdb_2660, a high resolution volume map of the 80s Ribosome which is sourced from EMDB at https://www.ebi.ac.uk/emdb/EMD-2660. This volume map will load as an instance of ASPIRE’s Volume class.

vol = downloader.emdb_2660()
vol
1 float32 volumes arranged as a (1,) stack each of size 360x360x360 with pixel_size=1.340000033378601 angstroms.

View the Data

We can take a peek at this data by viewing some projections of the volume.

import numpy as np

from aspire.utils import Rotation

rots = Rotation.about_axis("y", [0, np.pi / 2])
projection = vol.project(rots)
projection.show()
data downloader

Total running time of the script: (0 minutes 3.594 seconds)

Gallery generated by Sphinx-Gallery