adaptiseq 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. adaptiseq-0.1.3/LICENSE +21 -0
  2. adaptiseq-0.1.3/MANIFEST.in +10 -0
  3. adaptiseq-0.1.3/PKG-INFO +400 -0
  4. adaptiseq-0.1.3/README.md +367 -0
  5. adaptiseq-0.1.3/adaptiseq/__init__.py +244 -0
  6. adaptiseq-0.1.3/adaptiseq/__main__.py +10 -0
  7. adaptiseq-0.1.3/adaptiseq/_async.py +49 -0
  8. adaptiseq-0.1.3/adaptiseq/accession.py +94 -0
  9. adaptiseq-0.1.3/adaptiseq/aspera.py +272 -0
  10. adaptiseq-0.1.3/adaptiseq/batch.py +556 -0
  11. adaptiseq-0.1.3/adaptiseq/cli.py +396 -0
  12. adaptiseq-0.1.3/adaptiseq/console.py +112 -0
  13. adaptiseq-0.1.3/adaptiseq/convert.py +97 -0
  14. adaptiseq-0.1.3/adaptiseq/core.py +402 -0
  15. adaptiseq-0.1.3/adaptiseq/engine/__init__.py +21 -0
  16. adaptiseq-0.1.3/adaptiseq/engine/classic.py +224 -0
  17. adaptiseq-0.1.3/adaptiseq/engine/ftp.py +316 -0
  18. adaptiseq-0.1.3/adaptiseq/engine/gate.py +48 -0
  19. adaptiseq-0.1.3/adaptiseq/engine/optimize.py +137 -0
  20. adaptiseq-0.1.3/adaptiseq/engine/ratelimit.py +177 -0
  21. adaptiseq-0.1.3/adaptiseq/engine/seam.py +204 -0
  22. adaptiseq-0.1.3/adaptiseq/engine/segmented.py +597 -0
  23. adaptiseq-0.1.3/adaptiseq/engine/throughput.py +155 -0
  24. adaptiseq-0.1.3/adaptiseq/errors.py +52 -0
  25. adaptiseq-0.1.3/adaptiseq/integrity.py +260 -0
  26. adaptiseq-0.1.3/adaptiseq/logs.py +61 -0
  27. adaptiseq-0.1.3/adaptiseq/merge.py +314 -0
  28. adaptiseq-0.1.3/adaptiseq/metadata.py +295 -0
  29. adaptiseq-0.1.3/adaptiseq/net.py +105 -0
  30. adaptiseq-0.1.3/adaptiseq/options.py +168 -0
  31. adaptiseq-0.1.3/adaptiseq/preflight.py +75 -0
  32. adaptiseq-0.1.3/adaptiseq/progress.py +81 -0
  33. adaptiseq-0.1.3/adaptiseq/py.typed +0 -0
  34. adaptiseq-0.1.3/adaptiseq/ratelimits.py +106 -0
  35. adaptiseq-0.1.3/adaptiseq/resolve.py +395 -0
  36. adaptiseq-0.1.3/adaptiseq/routing.py +71 -0
  37. adaptiseq-0.1.3/adaptiseq.egg-info/PKG-INFO +400 -0
  38. adaptiseq-0.1.3/adaptiseq.egg-info/SOURCES.txt +73 -0
  39. adaptiseq-0.1.3/adaptiseq.egg-info/dependency_links.txt +1 -0
  40. adaptiseq-0.1.3/adaptiseq.egg-info/entry_points.txt +2 -0
  41. adaptiseq-0.1.3/adaptiseq.egg-info/requires.txt +9 -0
  42. adaptiseq-0.1.3/adaptiseq.egg-info/top_level.txt +1 -0
  43. adaptiseq-0.1.3/pyproject.toml +75 -0
  44. adaptiseq-0.1.3/setup.cfg +4 -0
  45. adaptiseq-0.1.3/tests/__init__.py +0 -0
  46. adaptiseq-0.1.3/tests/conftest.py +44 -0
  47. adaptiseq-0.1.3/tests/fixtures/CRR311377/CRR311377.metadata.csv +2 -0
  48. adaptiseq-0.1.3/tests/fixtures/CRR311377/expected.json +35 -0
  49. adaptiseq-0.1.3/tests/fixtures/SRR7706354/SRR7706354.metadata.tsv +2 -0
  50. adaptiseq-0.1.3/tests/fixtures/SRR7706354/expected.json +66 -0
  51. adaptiseq-0.1.3/tests/harness.py +96 -0
  52. adaptiseq-0.1.3/tests/servers.py +176 -0
  53. adaptiseq-0.1.3/tests/test_accession.py +49 -0
  54. adaptiseq-0.1.3/tests/test_api_drift.py +38 -0
  55. adaptiseq-0.1.3/tests/test_aspera.py +184 -0
  56. adaptiseq-0.1.3/tests/test_aspera_live.py +72 -0
  57. adaptiseq-0.1.3/tests/test_async_loop.py +51 -0
  58. adaptiseq-0.1.3/tests/test_batch.py +395 -0
  59. adaptiseq-0.1.3/tests/test_classic_engine.py +147 -0
  60. adaptiseq-0.1.3/tests/test_cli.py +115 -0
  61. adaptiseq-0.1.3/tests/test_differential.py +112 -0
  62. adaptiseq-0.1.3/tests/test_ftp_segmented.py +100 -0
  63. adaptiseq-0.1.3/tests/test_logs_integrity.py +77 -0
  64. adaptiseq-0.1.3/tests/test_merge.py +105 -0
  65. adaptiseq-0.1.3/tests/test_metadata_parse.py +26 -0
  66. adaptiseq-0.1.3/tests/test_meter_gate.py +46 -0
  67. adaptiseq-0.1.3/tests/test_optimize.py +102 -0
  68. adaptiseq-0.1.3/tests/test_phaseb_present.py +102 -0
  69. adaptiseq-0.1.3/tests/test_preflight_lazy.py +72 -0
  70. adaptiseq-0.1.3/tests/test_progress.py +60 -0
  71. adaptiseq-0.1.3/tests/test_resolution.py +79 -0
  72. adaptiseq-0.1.3/tests/test_routing.py +45 -0
  73. adaptiseq-0.1.3/tests/test_segmented.py +372 -0
  74. adaptiseq-0.1.3/tests/test_segmented_finalize.py +28 -0
  75. adaptiseq-0.1.3/tests/test_segmented_live.py +63 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 swargo98
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ include LICENSE
2
+ include README.md
3
+ include pyproject.toml
4
+
5
+ # Ship the full test tree (fixtures, conftest, local servers) so the sdist is
6
+ # self-testable, not the half tree distutils' legacy test*.py auto-include leaves.
7
+ graft tests
8
+
9
+ # Never ship compiled artifacts.
10
+ global-exclude *.py[cod]
@@ -0,0 +1,400 @@
1
+ Metadata-Version: 2.4
2
+ Name: adaptiseq
3
+ Version: 0.1.3
4
+ Summary: Fast, importable downloader for public sequencing data (GSA/SRA/ENA/DDBJ/GEO) with a segmented, resumable, self-tuning batch engine.
5
+ Author: swargo98
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/swargo98/adaptiSeq
8
+ Project-URL: Documentation, https://swargo98.github.io/adaptiSeq/
9
+ Project-URL: Repository, https://github.com/swargo98/adaptiSeq
10
+ Project-URL: Issues, https://github.com/swargo98/adaptiSeq/issues
11
+ Keywords: bioinformatics,sequencing,SRA,ENA,GSA,DDBJ,GEO,download,fastq,aspera
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: aiohttp>=3.8
26
+ Requires-Dist: aioftp>=0.21
27
+ Requires-Dist: numpy>=1.21
28
+ Provides-Extra: test
29
+ Requires-Dist: pytest>=7.0; extra == "test"
30
+ Provides-Extra: docs
31
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
32
+ Dynamic: license-file
33
+
34
+ <h1 align="center">
35
+ <img src="https://raw.githubusercontent.com/swargo98/adaptiSeq/main/adaptiseq/assets/logo.png" alt="adaptiSeq" width="480">
36
+ </h1>
37
+
38
+ <p align="center"><b>An adaptive tool to fetch public sequencing data</b></p>
39
+
40
+ <p align="center">
41
+ <a href="https://github.com/swargo98/adaptiSeq/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
42
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+"></a>
43
+ <a href="https://pypi.org/project/adaptiseq/"><img src="https://img.shields.io/pypi/v/adaptiseq.svg" alt="PyPI version"></a>
44
+ <a href="https://github.com/swargo98/adaptiSeq/actions/workflows/ci.yml"><img src="https://github.com/swargo98/adaptiSeq/actions/workflows/ci.yml/badge.svg" alt="CI status"></a>
45
+ <a href="https://swargo98.github.io/adaptiSeq/"><img src="https://img.shields.io/badge/docs-online-0a6b6b" alt="Documentation"></a>
46
+ </p>
47
+
48
+ <p align="center">
49
+ <a href="https://swargo98.github.io/adaptiSeq/"><b>📖 Documentation</b></a>
50
+ &nbsp;·&nbsp;
51
+ <a href="#installation">Installation</a>
52
+ &nbsp;·&nbsp;
53
+ <a href="#usage">Usage</a>
54
+ &nbsp;·&nbsp;
55
+ <a href="#related-tools">Comparison</a>
56
+ </p>
57
+
58
+ <!-- PyPI/bioconda badges resolve once the package is published; until then see Installation. -->
59
+
60
+ ## Description
61
+
62
+ **adaptiSeq** is a fast, importable Python tool that downloads sequencing data and
63
+ metadata from **[GSA](https://ngdc.cncb.ac.cn/gsa/)**,
64
+ **[SRA](https://www.ncbi.nlm.nih.gov/sra/)**,
65
+ **[ENA](https://www.ebi.ac.uk/ena/)**,
66
+ **[DDBJ](https://www.ddbj.nig.ac.jp/)**, and
67
+ **[GEO](https://www.ncbi.nlm.nih.gov/geo/)**. It is built for the workload real
68
+ pipelines actually have: **lists of accessions**, downloaded in parallel, with a
69
+ **segmented, resumable, self-tuning** engine and a **real Python API**.
70
+
71
+ > **Important**
72
+ > To use adaptiSeq your system must be **connected to the network** and able to
73
+ > reach the databases over **HTTP, HTTPS, and (optionally) FTP / Aspera**.
74
+
75
+ ## Update Notes
76
+
77
+ ### 0.1.3
78
+ - **Fix**: a segmented download whose `.part` file is missing at finalize (e.g.
79
+ every segment's connection was refused) now fails cleanly and retries, instead
80
+ of raising a confusing `FileNotFoundError` from an unguarded `.part` rename.
81
+
82
+ ### 0.1.2
83
+ - **Fix**: the notebook event-loop handling from 0.1.1 now also works when
84
+ `nest_asyncio` is active (it previously hung/errored on batch downloads). The
85
+ API detects a re-entrant loop and drives the coroutine on it directly; plain
86
+ Jupyter still uses a worker thread. Works with or without `nest_asyncio`.
87
+
88
+ ### 0.1.1
89
+ - **Fix**: the Python API (`fetch`/`resolve`) now works inside a running asyncio
90
+ event loop (Jupyter / Google Colab / IPython), where it previously raised
91
+ `asyncio.run() cannot be called from a running event loop`. The CLI was
92
+ unaffected.
93
+
94
+ ### 0.1.0 (initial release)
95
+ - First public release: segmented engine + adaptive batch pool + parallel
96
+ metadata resolution + adaptive Aspera + Python API.
97
+ - Validated against the **real ENA Aspera** endpoint with a genuine IBM `ascp`.
98
+ - Offline test suite (fixtures, engine, batch, adaptive) green; CI on Python
99
+ 3.10–3.12.
100
+
101
+ <details>
102
+ <summary>Design highlights</summary>
103
+
104
+ - **Segmented, resumable HTTP(S)/FTP engine** (the default) with `.part`/`.part.meta`
105
+ resume — interrupt and re-run to continue, not restart.
106
+ - **Batch-parallel download** of accession lists through an asyncio worker pool.
107
+ - **Adaptive concurrency**: an adaptive controller (top-down knee search by
108
+ default) tunes how many downloads run at once from measured throughput.
109
+ - **Parallel metadata resolution** under polite per-endpoint rate limits.
110
+ - **Adaptive parallel Aspera** via an efficiency-hysteresis controller.
111
+ - **Python API** (`fetch`, `resolve`, `get_metadata`) that returns values and
112
+ raises typed exceptions.
113
+ - Correctly downloads **3-file runs** (orphan/barcode + `_1` + `_2`) that iSeq
114
+ mishandles.
115
+
116
+ </details>
117
+
118
+ ## Features
119
+ - **Multiple database support**: GSA / SRA / ENA / DDBJ / GEO.
120
+ - **Multiple input formats**: Project, Study, BioSample, Sample, Experiment, or
121
+ Run accession — single, or a file of many (mixed databases allowed).
122
+ - **Metadata download**: per-accession sample metadata (`-m`).
123
+ <details>
124
+ <summary>More features</summary>
125
+
126
+ - **File-format selection**: direct gzip FASTQ (`-g`) or SRA→FASTQ conversion (`-q`).
127
+ - **Multi-threaded conversion/compression** (`-t`).
128
+ - **File merging** per Experiment/Sample/Study (`-e`).
129
+ - **Batch-parallel download** of accession lists (`-j`), with **adaptive**
130
+ concurrency (`--adaptive`) and **parallel metadata resolution** (`--meta-jobs`).
131
+ - **Segmented, resumable transfers** with HTTPS-first transport selection.
132
+ - **Aspera high-speed download** for GSA/ENA (`-a`), adaptive for ENA.
133
+ - **Automatic retry** (up to three rounds) and **md5 / `vdb-validate` verification**.
134
+ - **Importable Python API** with typed exceptions and `py.typed`.
135
+ - **Error handling**: clear, actionable messages with suggested solutions.
136
+
137
+ </details>
138
+
139
+ ## Installation
140
+
141
+ ### 1. From PyPI (once published)
142
+ ```bash
143
+ pip install adaptiseq # not yet on PyPI — see "From source" below
144
+ ```
145
+
146
+ ### 2. From source
147
+ ```bash
148
+ git clone https://github.com/swargo98/adaptiSeq.git
149
+ cd adaptiSeq
150
+ pip install -e .
151
+ adaptiseq --version
152
+ ```
153
+
154
+ ### 3. Conda environment
155
+ ```bash
156
+ conda env create -f environment.yml && conda activate adaptiseq
157
+ ```
158
+
159
+ External tools: `wget` (always), `sra-tools`, `pigz`, `md5sum`,
160
+ `axel` (classic `-p`), and IBM `ascp` (`-a`). adaptiSeq requires each **only when a
161
+ run actually needs it**. Full detail: **[docs/installation.md](docs/installation.md)**.
162
+
163
+ ## Example
164
+
165
+ 1. Download all Runs and metadata for an accession.
166
+ ```bash
167
+ adaptiseq -i PRJNA211801
168
+ ```
169
+
170
+ 2. Batch download a list, directly as gzip FASTQ, through the adaptive pool.
171
+ ```bash
172
+ adaptiseq -i SRR_Acc_List.txt -g
173
+ ```
174
+
175
+ See **[docs/examples.md](docs/examples.md)** for more.
176
+
177
+ ## Usage
178
+
179
+ ```
180
+ $ adaptiseq --help
181
+
182
+ Usage:
183
+ adaptiseq -i accession [options]
184
+
185
+ Required option:
186
+ -i, --input [text|file] Single accession or a file containing multiple accessions.
187
+ Note: only one accession per line in the file.
188
+
189
+ Optional options:
190
+ -m, --metadata Skip the sequencing data downloads and only fetch metadata.
191
+ -g, --gzip Download FASTQ files in gzip format directly (*.fastq.gz).
192
+ -q, --fastq Convert SRA files to FASTQ format.
193
+ -t, --threads int Threads for SRA->FASTQ / compression (default: 8).
194
+ -e, --merge [ex|sa|st] Merge fastq files per Experiment, Sample, or Study.
195
+ -d, --database [ena|sra] Force database for SRA data (default: auto-detect).
196
+ -p, --parallel int axel connection count (classic engine only), e.g. -p 10.
197
+ -a, --aspera Use Aspera (ascp); GSA/ENA only.
198
+ -s, --speed int Download speed limit (MB/s) (default: 1000).
199
+ -k, --skip-md5 Skip the md5 check for downloaded files.
200
+ -r, --protocol [ftp|https] ENA transport (default: auto, HTTPS-first).
201
+ -Q, --quiet Suppress download progress bars.
202
+ -o, --output text Output directory (created if missing; default: cwd).
203
+ --engine [segmented|classic] Download engine (default: segmented).
204
+ --segment-size int Target segment size in MB (default: 512).
205
+ --max-segments int Max connections per file (default: 8).
206
+ --max-conns-per-host int Global cap on connections to one host (default: 8).
207
+ -j, --jobs int Max worker-pool size for batch download (default: 20).
208
+ --adaptive / --no-adaptive Gradient adaptive-concurrency controller (default: on).
209
+ --probe-window int Adaptive probe window in seconds (default: 5).
210
+ --cc-penalty float Worker-cost penalty K (default: 1.01).
211
+ --meta-jobs int Parallelism for metadata/URL resolution (default: 3).
212
+ --aspera-efficiency float Keep an extra ascp worker only above this efficiency (0.70).
213
+ -h, --help Show the help information.
214
+ -v, --version Show the program version.
215
+ ```
216
+
217
+ ### 1. `-i`, `--input`
218
+
219
+ Input the accession to download, or a **file** with one accession per line
220
+ (databases may be mixed). adaptiSeq retrieves the accession's metadata, then
221
+ downloads each Run it contains.
222
+
223
+ ```bash
224
+ adaptiseq -i PRJNA211801
225
+ adaptiseq -i accessions.txt # batch
226
+ ```
227
+
228
+ Currently **supports 6 accession formats** across **5 databases**:
229
+
230
+ | Databases | BioProject | Study | BioSample | Sample | Experiment | Run |
231
+ | --------- | ---------- | ----- | --------- | ------ | ---------- | ---- |
232
+ | **GSA** | PRJC | CRA | SAMC | \ | CRX | CRR |
233
+ | **SRA** | PRJNA | SRP | SAMN | SRS | SRX | SRR |
234
+ | **ENA** | PRJEB | ERP | SAME | ERS | ERX | ERR |
235
+ | **DDBJ** | PRJDB | DRP | SAMD | DRS | DRX | DRR |
236
+ | **GEO** | GSE | \ | GSM | \ | \ | \ |
237
+
238
+ GEO `GSE/GSM` accessions are resolved to their associated `PRJNA/SAMN` and then
239
+ downloaded from SRA. Every contained Run is **md5-checked**; on mismatch adaptiSeq
240
+ retries up to **three rounds**, recording results in `success.log` / `fail.log`.
241
+
242
+ ### 2. `-m`, `--metadata`
243
+
244
+ Download only the sample metadata and skip the sequence data.
245
+
246
+ ```bash
247
+ adaptiseq -i PRJNA211801 -m
248
+ adaptiseq -i CRR343031 -m
249
+ ```
250
+
251
+ ENA → TSV (`${accession}.metadata.tsv`); GSA → CSV + project XLSX
252
+ (`${accession}.metadata.csv`, `CRA*.metadata.xlsx`). Details:
253
+ **[docs/usage/metadata.md](docs/usage/metadata.md)**.
254
+
255
+ ### 3. `-g`, `--gzip`
256
+
257
+ Download FASTQ directly in gzip format; if unavailable on ENA, download the `.sra`
258
+ and convert with `fasterq-dump` + `pigz`.
259
+
260
+ ```bash
261
+ adaptiseq -i SRR1178105 -g
262
+ ```
263
+
264
+ ### 4. `-q`, `--fastq`
265
+
266
+ Convert the downloaded `.sra` into FASTQ (single-cell friendly: `I1/R1/R2/R3`).
267
+
268
+ ```bash
269
+ adaptiseq -i SRR1178105 -q -t 10
270
+ ```
271
+
272
+ ### 5. `-e`, `--merge`
273
+
274
+ Merge a group of Runs into one FASTQ per Experiment (`ex`), Sample (`sa`), or
275
+ Study (`st`).
276
+
277
+ ```bash
278
+ adaptiseq -i SRX003906 -g -e ex
279
+ ```
280
+
281
+ ### 6. `-d` / `-r` / `-p` / `-s` / `-k` / `-Q`
282
+
283
+ Force database (`-d ena|sra`), ENA transport (`-r https|ftp`, default auto
284
+ HTTPS-first), classic-engine axel connections (`-p`, with `--engine classic`),
285
+ speed cap (`-s` MB/s), skip md5 (`-k`), and quiet (`-Q`). See
286
+ **[docs/usage/download.md](docs/usage/download.md)**.
287
+
288
+ ### 7. Batch & adaptive (`-j`, `--adaptive`, `--meta-jobs`)
289
+
290
+ For accession lists, adaptiSeq resolves in parallel (`--meta-jobs`) then downloads
291
+ through an asyncio worker pool (`-j`) whose active size the adaptive controller
292
+ tunes (`--adaptive`; `topdown` by default, `ASEQ_ADAPTIVE_MODE=bottomup` for the
293
+ gradient controller — see `docs/ADAPTIVE_CONTROLLER.md`).
294
+
295
+ ```bash
296
+ adaptiseq -i accessions.txt -g -j 8
297
+ adaptiseq -i accessions.txt -g --no-adaptive
298
+ ```
299
+
300
+ Full detail: **[docs/usage/batch.md](docs/usage/batch.md)**.
301
+
302
+ ### 8. `-a`, `--aspera`
303
+
304
+ Use IBM Aspera (`ascp`); **GSA/ENA only**. ENA uses an **adaptive** parallel pool
305
+ (efficiency hysteresis); GSA is sequential, best-effort (Huawei-Cloud preferred).
306
+
307
+ ```bash
308
+ adaptiseq -i PRJNA211801 -a -g
309
+ ```
310
+
311
+ Detail: **[docs/usage/aspera.md](docs/usage/aspera.md)**.
312
+
313
+ ### 9. Python API
314
+
315
+ ```python
316
+ from adaptiseq import fetch, resolve, get_metadata
317
+
318
+ rows = get_metadata("SRR7706354") # parsed metadata rows
319
+ urls = resolve("SRR7706354", database="ena") # resolved URLs (no download)
320
+ result = fetch("accessions.txt", outdir="data/", gzip=True, jobs=20, adaptive=True)
321
+ print(result.success_ids, result.fail_ids, result.failed)
322
+ ```
323
+
324
+ The API never calls `sys.exit` and never prints colour codes; it raises the typed
325
+ exceptions in `adaptiseq.errors`. Full reference:
326
+ **[docs/usage/python-api.md](docs/usage/python-api.md)**.
327
+
328
+ ## Output
329
+
330
+ - **SRA / ENA / DDBJ / GEO** accessions:
331
+
332
+ | Output | Description |
333
+ | ------------- | ----------- |
334
+ | SRA files | Convert to FASTQ with `-q` |
335
+ | `.metadata.tsv` | Metadata for the query accession |
336
+ | `success.log` | Runs downloaded successfully |
337
+ | `fail.log` | Runs that failed |
338
+
339
+ - **GSA** accessions:
340
+
341
+ | Output | Description |
342
+ | -------------- | ----------- |
343
+ | GSA files | Mostly `*.gz` (a few bam/tar/bz2) |
344
+ | `.metadata.csv` | Metadata for the query accession |
345
+ | `.metadata.xlsx` | Project metadata (xlsx) for the accession |
346
+ | `success.log` | Runs downloaded successfully |
347
+ | `fail.log` | Runs that failed |
348
+
349
+ ## Documentation
350
+
351
+ Full documentation lives in **[`docs/`](docs/README.md)**:
352
+ [Installation](docs/installation.md) ·
353
+ [Usage overview](docs/usage/README.md) ·
354
+ [Downloading](docs/usage/download.md) ·
355
+ [Metadata](docs/usage/metadata.md) ·
356
+ [Merging](docs/usage/merge.md) ·
357
+ [Batch & adaptive](docs/usage/batch.md) ·
358
+ [Aspera](docs/usage/aspera.md) ·
359
+ [Python API](docs/usage/python-api.md) ·
360
+ [Method details](docs/methods.md) ·
361
+ [Examples](docs/examples.md) ·
362
+ [FAQ](docs/faq.md).
363
+
364
+ ## Related tools
365
+
366
+ adaptiSeq sits among other downloaders for public sequencing data —
367
+ [iSeq](https://github.com/BioOmics/iSeq),
368
+ [fastq-dl](https://github.com/rpetit3/fastq-dl),
369
+ [fetchngs](https://github.com/nf-core/fetchngs),
370
+ [pysradb](https://github.com/saketkc/pysradb), and
371
+ [Kingfisher](https://github.com/wwood/kingfisher-download). A comparison:
372
+
373
+ | Software | Languages | Databases | Accessions | Formats | Methods | Metadata | MD5 | Resumable | Parallel | Merge | Skip done | Conda |
374
+ | -------- | --------- | --------- | ---------- | ------- | ------- | :------: | :-: | :-------: | :------: | :---: | :-------: | :---: |
375
+ | **adaptiSeq** | Python | GSA, SRA, ENA, DDBJ, GEO | All | fq, fq.gz, sra, bam | segmented http(s)/ftp, aspera, wget/axel | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | TBD (pip ✔) |
376
+ | [iSeq](https://github.com/BioOmics/iSeq) | Shell | GSA, SRA, ENA, DDBJ, GEO | All | fq, fq.gz, sra, bam | wget, axel, aspera | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
377
+ | [SRA Toolkit](https://github.com/ncbi/sra-tools) | C | SRA, ENA, DDBJ | All except Run | fq, fq.gz, sra | prefetch | ❌ | ✔ | ✔ | ❌ | ❌ | ✔ | ✔ |
378
+ | [enaBrowserTools](https://github.com/enasequence/enaBrowserTools) | Python | SRA, ENA, DDBJ | All except GSA/GEO | fq, fq.gz, sra | urllib, aspera | ✔ | ✔ | ✔ | ❌ | ❌ | ✔ | ✔ |
379
+ | [fastq-dl](https://github.com/rpetit3/fastq-dl) | Python | SRA, ENA, DDBJ | All except GSA/GEO | fq, fq.gz, sra | wget | ✔ | ✔ | ❌ | ❌ | ✔ | ✔ | ✔ |
380
+ | [fetchngs](https://github.com/nf-core/fetchngs) | Python | SRA, ENA, DDBJ, GEO | All except GSA | fq, fq.gz | wget, aspera, prefetch | ✔ | ✔ | ✔ | ❌ | ❌ | ✔ | ❌ |
381
+ | [pysradb](https://github.com/saketkc/pysradb) | Python | SRA, ENA, DDBJ, GEO | All except GSA | fq, fq.gz, sra, bam | requests, aspera | ✔ | ✔ | ✔ | ❌ | ❌ | ✔ | ✔ |
382
+ | [Kingfisher](https://github.com/wwood/kingfisher-download) | Python | SRA, ENA, DDBJ | All except GSA/GEO | fq, fq.gz, sra | curl, aria2c, aspera | ✔ | ✔ | ❌ | ✔ | ❌ | ✔ | ✔ |
383
+
384
+ Beyond this matrix, adaptiSeq adds what the single-shot downloaders do not: an
385
+ **adaptive, batch-parallel** download path, **parallel metadata resolution**, a
386
+ **segmented resumable** engine, and an importable **Python API**.
387
+
388
+ ## Contributing
389
+
390
+ Contributions are welcome — please open an issue for bugs/suggestions, or fork,
391
+ branch, and submit a pull request. The offline test suite runs with
392
+ `python -m pytest`.
393
+
394
+ ## Cite us
395
+
396
+ TBD (manuscript in preparation).
397
+
398
+ ## License
399
+
400
+ This project is licensed under the [MIT License](LICENSE).