Downloads

All of the code snippets shown in these docs are part of tcrdist3’s suite of integration tests. If you want to re-run any of these snippets with the same input data files:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from tcrdist.setup_tests import list_available_zip_files  
list_available_zip_files()
"""
['dash.zip',
'human_T_alpha_beta_sim200K.zip',
'vdjDB_PMID28636592.zip',
'sant.csv.zip',
'bulk.csv.zip',
'wiraninha_sampler.zip',
'ruggiero_mouse_sampler.zip',
'ruggiero_human_sampler.zip',
'britanova_human_beta_t_cb.tsv.sampler.tsv.zip',
'emerson_human_beta_t_cmvneg.tsv.sampler.tsv.zip',
'ruggiero_human_alpha_t.tsv.sampler.tsv.zip',
'ruggiero_human_beta_t.tsv.sampler.tsv.zip']
"""
from tcrdist.setup_tests import download_and_extract_zip_file
"""
Get dash.zip contents
"""
download_and_extract_zip_file( 'dash.zip', source = "dropbox", dest = ".")
"""
Assert that file has been downloaded
"""
import os
assert os.path.isfile("dash.zip")
"""
Assert that individual files of successively been inflated
"""
assert os.path.isfile("dash.csv")
assert os.path.isfile("dash2.csv")
assert os.path.isfile("dash_human.csv")
assert os.path.isfile("dash_beta_airr.csv")
tcrdist.setup_tests.list_available_zip_files()

List all available zip files downloadable from tcrdist3.

Returns:
Return type:List of zipfile names that can be passed to zipfile argument in download_and_extract_zip_file()
tcrdist.setup_tests.download_and_extract_zip_file(zipfile=None, source='dropbox', dest='/home/docs/checkouts/readthedocs.org/user_builds/tcrdist3/checkouts/latest')

Downloads and extracts a zip file to destination folder. Uses functions from requests and Zipfile, part of the Python Standard Library, to avoid the platform independent use of wget, curl, gunzip, etc.

Parameters:
  • zipfile (str) – Name of zip file see (list_available_zip_files() for current list)
  • source (str) – The host source name where the file will be downloaded from. Currently ‘dropbox’ is the only aviable option but ‘aws’ will be available on release >= 1.0.0
  • dest (str) – path where the files to be saved and unzipped