API
API Documentation
This package facilitates the download of data from the ENA in fastq format. To use it, you need to provide the accession number of the data you want to download.
cli()
Entry point for the command line interface. This function is called when the package is called from the command line. It uses the argparse package to parse the arguments passed to the command line.
Returns:
Type | Description |
---|---|
None
|
|
Source code in ena_download/__init__.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
download_data(accession, urls, timeout=300)
Download data from the ENA.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
accession |
str
|
The accession number of the data to download. |
required |
urls |
str
|
The URLs of the data to download. |
required |
timeout |
int
|
The timeout in seconds for the download to complete. Default is 300 seconds. |
300
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in ena_download/__init__.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
extract_data_path(accession)
Get the URL of the data to download.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
accession |
str
|
The accession number of the data to download. |
required |
Returns:
Type | Description |
---|---|
str
|
The URLs of the data to download. |
Examples:
>>> extract_data_path("ERR11466368")
['ftp.sra.ebi.ac.uk/vol1/fastq/ERR114/068/ERR11466368/ERR11466368_1.fastq.gz', 'ftp.sra.ebi.ac.uk/vol1/fastq/ERR114/068/ERR11466368/ERR11466368_2.fastq.gz']
Source code in ena_download/__init__.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
handler(signum, frame)
Signal handler for the download timeout.
Source code in ena_download/__init__.py
73 74 75 |
|
is_valid_accession(accession)
Get the URL of the data to download.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
accession |
str
|
The run accession number of the data to download. |
required |
Returns:
Type | Description |
---|---|
str
|
The URL of the data to download. |
Examples:
>>> is_valid_accession("ERR11466368")
True
>>> is_valid_accession("ERR0000000")
Traceback (most recent call last):
ValueError: Invalid accession number: ERR0000000
Source code in ena_download/__init__.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
main(accession, timeout=300)
Function that calls all the other functions to download data from the ENA.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
accession |
str
|
The accession number of the data to download. |
required |
timeout |
int
|
The timeout in seconds for the download to complete. Default is 300 seconds. |
300
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in ena_download/__init__.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|