mstransfer 0.2.2__tar.gz → 0.2.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 (54) hide show
  1. {mstransfer-0.2.2 → mstransfer-0.2.3}/.github/workflows/test.yml +7 -0
  2. {mstransfer-0.2.2 → mstransfer-0.2.3}/.pre-commit-config.yaml +1 -0
  3. {mstransfer-0.2.2 → mstransfer-0.2.3}/PKG-INFO +1 -1
  4. mstransfer-0.2.3/benchmark/.env.example +22 -0
  5. mstransfer-0.2.3/benchmark/.gitignore +11 -0
  6. mstransfer-0.2.3/benchmark/Dockerfile.thermorawfileparser +12 -0
  7. mstransfer-0.2.3/benchmark/Makefile +15 -0
  8. mstransfer-0.2.3/benchmark/README.md +71 -0
  9. mstransfer-0.2.3/benchmark/benchmark.sh +304 -0
  10. mstransfer-0.2.3/benchmark/datasets.txt +14 -0
  11. mstransfer-0.2.3/benchmark/download.sh +89 -0
  12. mstransfer-0.2.3/benchmark/plot.py +352 -0
  13. mstransfer-0.2.3/benchmark/pyproject.toml +13 -0
  14. mstransfer-0.2.3/benchmark/uv.lock +879 -0
  15. {mstransfer-0.2.2 → mstransfer-0.2.3}/pyproject.toml +6 -1
  16. {mstransfer-0.2.2 → mstransfer-0.2.3}/src/mstransfer/__init__.py +1 -1
  17. {mstransfer-0.2.2 → mstransfer-0.2.3}/src/mstransfer/cli.py +40 -21
  18. mstransfer-0.2.3/src/mstransfer/client/__init__.py +25 -0
  19. mstransfer-0.2.3/src/mstransfer/client/downloader.py +421 -0
  20. mstransfer-0.2.3/src/mstransfer/client/sender.py +301 -0
  21. mstransfer-0.2.3/src/mstransfer/client/utils.py +154 -0
  22. mstransfer-0.2.3/src/mstransfer/server/state.py +86 -0
  23. mstransfer-0.2.3/tests/__init__.py +0 -0
  24. {mstransfer-0.2.2 → mstransfer-0.2.3}/tests/test_cli.py +16 -12
  25. {mstransfer-0.2.2 → mstransfer-0.2.3}/tests/test_client.py +207 -72
  26. {mstransfer-0.2.2 → mstransfer-0.2.3}/tests/test_downloader.py +321 -8
  27. {mstransfer-0.2.2 → mstransfer-0.2.3}/tests/test_server.py +48 -19
  28. {mstransfer-0.2.2 → mstransfer-0.2.3}/uv.lock +1 -1
  29. mstransfer-0.2.2/src/mstransfer/client/__init__.py +0 -10
  30. mstransfer-0.2.2/src/mstransfer/client/downloader.py +0 -287
  31. mstransfer-0.2.2/src/mstransfer/client/sender.py +0 -309
  32. mstransfer-0.2.2/src/mstransfer/server/state.py +0 -78
  33. {mstransfer-0.2.2 → mstransfer-0.2.3}/.github/dependabot.yml +0 -0
  34. {mstransfer-0.2.2 → mstransfer-0.2.3}/.github/workflows/docker.yml +0 -0
  35. {mstransfer-0.2.2 → mstransfer-0.2.3}/.github/workflows/publish.yml +0 -0
  36. {mstransfer-0.2.2 → mstransfer-0.2.3}/.gitignore +0 -0
  37. {mstransfer-0.2.2 → mstransfer-0.2.3}/.python-version +0 -0
  38. {mstransfer-0.2.2 → mstransfer-0.2.3}/.vscode/settings.json +0 -0
  39. {mstransfer-0.2.2 → mstransfer-0.2.3}/Dockerfile +0 -0
  40. {mstransfer-0.2.2 → mstransfer-0.2.3}/README.md +0 -0
  41. {mstransfer-0.2.2 → mstransfer-0.2.3}/src/mstransfer/__main__.py +0 -0
  42. {mstransfer-0.2.2 → mstransfer-0.2.3}/src/mstransfer/log.py +0 -0
  43. /mstransfer-0.2.2/src/mstransfer/server/__init__.py → /mstransfer-0.2.3/src/mstransfer/py.typed +0 -0
  44. {mstransfer-0.2.2/tests → mstransfer-0.2.3/src/mstransfer/server}/__init__.py +0 -0
  45. {mstransfer-0.2.2 → mstransfer-0.2.3}/src/mstransfer/server/app.py +0 -0
  46. {mstransfer-0.2.2 → mstransfer-0.2.3}/src/mstransfer/server/auth.py +0 -0
  47. {mstransfer-0.2.2 → mstransfer-0.2.3}/src/mstransfer/server/fileprovider.py +0 -0
  48. {mstransfer-0.2.2 → mstransfer-0.2.3}/src/mstransfer/server/models.py +0 -0
  49. {mstransfer-0.2.2 → mstransfer-0.2.3}/src/mstransfer/server/routes.py +0 -0
  50. {mstransfer-0.2.2 → mstransfer-0.2.3}/tests/conftest.py +0 -0
  51. {mstransfer-0.2.2 → mstransfer-0.2.3}/tests/data/test.msz +0 -0
  52. {mstransfer-0.2.2 → mstransfer-0.2.3}/tests/data/test.mzML +0 -0
  53. {mstransfer-0.2.2 → mstransfer-0.2.3}/tests/test_auth.py +0 -0
  54. {mstransfer-0.2.2 → mstransfer-0.2.3}/tests/test_include_router.py +0 -0
@@ -31,6 +31,13 @@ jobs:
31
31
  - name: Type check (mypy)
32
32
  run: uv run mypy src/
33
33
 
34
+ - name: Verify py.typed (PEP 561)
35
+ run: |
36
+ uv build
37
+ uv pip install dist/*.whl
38
+ echo 'import mstransfer' > /tmp/check_typed.py
39
+ uv run mypy --strict /tmp/check_typed.py
40
+
34
41
  - name: Run tests with coverage
35
42
  run: uv run pytest --cov=mstransfer --cov-report=term-missing --cov-report=xml
36
43
 
@@ -1,3 +1,4 @@
1
+ exclude: ^benchmark/
1
2
  repos:
2
3
  - repo: https://github.com/astral-sh/ruff-pre-commit
3
4
  rev: v0.9.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mstransfer
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Transfer mass spectrometry files (mzML/MSZ) between endpoints using mscompress
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: aiofiles
@@ -0,0 +1,22 @@
1
+ # --- Benchmark mode ---
2
+ # "per-file" = time each file individually, "batch" = time all files as one batch
3
+ BENCHMARK_MODE=per-file
4
+
5
+ # --- mstransfer ---
6
+ MSTRANSFER_HOST=http://localhost:1319
7
+ MSTRANSFER_API_KEY= # optional, leave blank if no auth
8
+
9
+ # --- SFTP ---
10
+ SFTP_HOST=example.com
11
+ SFTP_PORT=22
12
+ SFTP_USER=username
13
+ SFTP_KEY_PATH=~/.ssh/id_rsa # path to private key
14
+ SFTP_DEST_DIR=/upload # remote directory
15
+
16
+ # --- S3 ---
17
+ AWS_ACCESS_KEY_ID=
18
+ AWS_SECRET_ACCESS_KEY=
19
+ AWS_REGION=us-east-1
20
+ S3_ENDPOINT_URL= # custom endpoint for MinIO, etc. (e.g. http://localhost:9000)
21
+ S3_BUCKET=my-bucket
22
+ S3_PREFIX=benchmark/ # optional prefix/folder in bucket
@@ -0,0 +1,11 @@
1
+ # Downloaded datasets
2
+ data/
3
+
4
+ # Secrets
5
+ .env
6
+
7
+ # Benchmark results
8
+ results/
9
+
10
+ # Generated plots
11
+ plots/
@@ -0,0 +1,12 @@
1
+ FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/aspnet:8.0
2
+
3
+ RUN apt-get update \
4
+ && apt-get install -y --no-install-recommends wget unzip \
5
+ && wget -q https://github.com/CompOmics/ThermoRawFileParser/releases/download/v.2.0.0-dev/ThermoRawFileParser-v.2.0.0-dev-net8.zip -O /tmp/trfp.zip \
6
+ && unzip /tmp/trfp.zip -d /opt/ThermoRawFileParser \
7
+ && rm /tmp/trfp.zip \
8
+ && apt-get purge -y wget unzip \
9
+ && apt-get autoremove -y \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ ENTRYPOINT ["dotnet", "/opt/ThermoRawFileParser/ThermoRawFileParser.dll"]
@@ -0,0 +1,15 @@
1
+ .PHONY: all download benchmark plot
2
+
3
+ all: download benchmark plot
4
+
5
+ download:
6
+ ./download.sh
7
+
8
+ benchmark:
9
+ ./benchmark.sh -b 40
10
+ ./benchmark.sh -b 100
11
+ ./benchmark.sh -b 1000
12
+ ./benchmark.sh
13
+
14
+ plot:
15
+ uv run plot.py
@@ -0,0 +1,71 @@
1
+ # MSTransfer Benchmarks
2
+
3
+ Compares upload throughput of `mstransfer` against `sftp` and `aws s3 cp` using
4
+ real mass-spectrometry `.mzML` files, optionally under a throttled network.
5
+
6
+ ## What's here
7
+
8
+ - `download.sh` — fetches RAW files listed in `datasets.txt` from PRIDE and
9
+ converts them to `.mzML` via a ThermoRawFileParser Docker image. Output goes
10
+ to `data/`.
11
+ - `benchmark.sh` — uploads every `.mzML` in `data/` to each target, timing
12
+ each transfer and writing one CSV per run to `results/`.
13
+ - `plot.py` — reads CSVs from `results/` and renders comparison plots into
14
+ `plots/` (throughput per file, aggregate throughput, speedup vs. bandwidth).
15
+ - `Makefile` — runs the full pipeline at 40 / 100 / 1000 mbit/s and unthrottled.
16
+
17
+ ## Setup
18
+
19
+ 1. Install CLIs for the targets you plan to test: `mstransfer`, `sftp`,
20
+ `aws`. Docker is required for `download.sh`. `tc` (iproute2) is required
21
+ if you want to throttle bandwidth.
22
+ 2. Configure endpoints and credentials:
23
+ ```
24
+ cp .env.example .env
25
+ # then edit .env
26
+ ```
27
+ 3. Install the plotting deps (managed by `uv`):
28
+ ```
29
+ uv sync
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ Fetch and convert datasets:
35
+ ```
36
+ ./download.sh
37
+ ```
38
+
39
+ Run all targets, no throttling:
40
+ ```
41
+ ./benchmark.sh
42
+ ```
43
+
44
+ Run specific targets, throttled to 100 mbit/s:
45
+ ```
46
+ ./benchmark.sh -b 100 mstransfer s3
47
+ ```
48
+
49
+ Run the full sweep (40/100/1000 mbit + unthrottled) and regenerate plots:
50
+ ```
51
+ make all
52
+ ```
53
+
54
+ ## Output
55
+
56
+ Each `benchmark.sh` invocation writes one CSV to `results/`, named by
57
+ bandwidth and timestamp (e.g. `results_100mbit_20260415_170454.csv`).
58
+ Columns: `target,file,size_bytes,duration_s,throughput_mbps`.
59
+
60
+ `plot.py` consumes every CSV in `results/` to generate the figures in `plots/`.
61
+
62
+ ## Modes
63
+
64
+ `BENCHMARK_MODE` in `.env` selects:
65
+ - `per-file` (default) — times each file individually; one CSV row per file.
66
+ - `batch` — times all files as a single upload; one CSV row per target.
67
+
68
+ ## Throttling
69
+
70
+ `-b <mbit>` applies a `tc tbf` qdisc to the default outbound interface for the
71
+ duration of the run and tears it down on exit. Requires `sudo`.
@@ -0,0 +1,304 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ DATA_DIR="$SCRIPT_DIR/data"
6
+ ALL_TARGETS=(mstransfer sftp s3)
7
+ BANDWIDTH=""
8
+
9
+ usage() {
10
+ echo "Usage: $(basename "$0") [options] [target ...]"
11
+ echo ""
12
+ echo "Options:"
13
+ echo " -b, --bandwidth <mbit> Throttle upload bandwidth using tc (in mbit/s)"
14
+ echo " -h, --help Show this help message"
15
+ echo ""
16
+ echo "Targets: mstransfer, sftp, s3 (default: all)"
17
+ echo ""
18
+ echo "Examples:"
19
+ echo " $(basename "$0") # run all targets"
20
+ echo " $(basename "$0") mstransfer # mstransfer only"
21
+ echo " $(basename "$0") -b 100 sftp s3 # sftp and s3, throttled to 100 mbit/s"
22
+ echo " $(basename "$0") -b 1000 mstransfer # mstransfer at 1 gbit/s"
23
+ exit 0
24
+ }
25
+
26
+ # Parse options
27
+ while [[ $# -gt 0 ]]; do
28
+ case "$1" in
29
+ -h|--help) usage ;;
30
+ -b|--bandwidth)
31
+ BANDWIDTH="$2"
32
+ shift 2
33
+ ;;
34
+ *) break ;;
35
+ esac
36
+ done
37
+
38
+ # ── Helpers ──────────────────────────────────────────────────────────────────
39
+
40
+ # Cross-platform high-resolution timestamp (seconds with decimals)
41
+ # Detect once whether date supports %N (GNU coreutils) or we need perl (macOS)
42
+ if date +%s.%N 2>/dev/null | grep -qv '\.N'; then
43
+ now() { date +%s.%N; }
44
+ else
45
+ now() { perl -MTime::HiRes -e 'printf "%.3f\n", Time::HiRes::time()'; }
46
+ fi
47
+
48
+ # Cross-platform file size in bytes
49
+ file_size() {
50
+ if stat -f%z "$1" &>/dev/null; then
51
+ stat -f%z "$1" # macOS
52
+ else
53
+ stat -c%s "$1" # Linux
54
+ fi
55
+ }
56
+
57
+ # Compute throughput: args <size_bytes> <duration_seconds>
58
+ throughput() {
59
+ local size_bytes=$1 duration=$2
60
+ awk "BEGIN { printf \"%.2f\", $size_bytes / 1000000 / $duration }"
61
+ }
62
+
63
+ # Format bytes as MB with 1 decimal
64
+ fmt_mb() {
65
+ awk "BEGIN { printf \"%.1f\", $1 / 1000000 }"
66
+ }
67
+
68
+ # ── Bandwidth throttling via tc ──────────────────────────────────────────────
69
+
70
+ NET_IFACE=""
71
+
72
+ tc_setup() {
73
+ # Detect the default outbound interface
74
+ NET_IFACE=$(ip route get 1.1.1.1 2>/dev/null | awk '{for(i=1;i<=NF;i++) if($i=="dev") print $(i+1); exit}')
75
+ if [[ -z "$NET_IFACE" ]]; then
76
+ echo "ERROR: Could not detect network interface for tc throttling."
77
+ exit 1
78
+ fi
79
+ echo "Throttling upload bandwidth to ${BANDWIDTH}mbit on $NET_IFACE"
80
+ sudo tc qdisc replace dev "$NET_IFACE" root tbf rate "${BANDWIDTH}mbit" burst 32kbit latency 50ms
81
+ }
82
+
83
+ tc_teardown() {
84
+ if [[ -n "$NET_IFACE" ]]; then
85
+ sudo tc qdisc del dev "$NET_IFACE" root 2>/dev/null || true
86
+ fi
87
+ }
88
+
89
+ if [[ -n "$BANDWIDTH" ]]; then
90
+ if ! command -v tc &>/dev/null; then
91
+ echo "ERROR: 'tc' (iproute2) is required for bandwidth throttling but is not installed."
92
+ exit 1
93
+ fi
94
+ tc_setup
95
+ trap tc_teardown EXIT
96
+ fi
97
+
98
+ # ── Prerequisites ────────────────────────────────────────────────────────────
99
+
100
+ if [[ ! -f "$SCRIPT_DIR/.env" ]]; then
101
+ echo "ERROR: .env file not found."
102
+ echo "Copy .env.example to .env and fill in your values:"
103
+ echo " cp .env.example .env"
104
+ exit 1
105
+ fi
106
+
107
+ # shellcheck source=/dev/null
108
+ source "$SCRIPT_DIR/.env"
109
+
110
+ # Map target name to required CLI command
111
+ target_cmd() {
112
+ case "$1" in
113
+ mstransfer) echo "mstransfer" ;;
114
+ sftp) echo "sftp" ;;
115
+ s3) echo "aws" ;;
116
+ esac
117
+ }
118
+
119
+ FILES=("$DATA_DIR"/*.mzML)
120
+ if [[ ${#FILES[@]} -eq 0 || ! -f "${FILES[0]}" ]]; then
121
+ echo "ERROR: No .mzML files found in $DATA_DIR"
122
+ echo "Run download.sh first to fetch datasets."
123
+ exit 1
124
+ fi
125
+
126
+ FILE_COUNT=${#FILES[@]}
127
+
128
+ # Export AWS credentials so the aws CLI picks them up
129
+ export AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION
130
+
131
+ # Select targets from CLI args, defaulting to all
132
+ if [[ $# -gt 0 ]]; then
133
+ TARGETS=("$@")
134
+ for t in "${TARGETS[@]}"; do
135
+ valid=false
136
+ for v in "${ALL_TARGETS[@]}"; do [[ "$t" == "$v" ]] && valid=true; done
137
+ if ! $valid; then
138
+ echo "ERROR: Unknown target '$t'. Valid targets: ${ALL_TARGETS[*]}"
139
+ exit 1
140
+ fi
141
+ done
142
+ else
143
+ TARGETS=("${ALL_TARGETS[@]}")
144
+ fi
145
+
146
+ # Only check for CLIs needed by selected targets
147
+ for t in "${TARGETS[@]}"; do
148
+ cmd=$(target_cmd "$t")
149
+ if ! command -v "$cmd" &>/dev/null; then
150
+ echo "ERROR: '$cmd' is required for target '$t' but is not installed or not in PATH."
151
+ exit 1
152
+ fi
153
+ done
154
+
155
+ MODE="${BENCHMARK_MODE:-per-file}"
156
+ RESULTS_DIR="$SCRIPT_DIR/results"
157
+ mkdir -p "$RESULTS_DIR"
158
+ if [[ -n "$BANDWIDTH" ]]; then
159
+ CSV_FILE="$RESULTS_DIR/results_${BANDWIDTH}mbit_$(date +%Y%m%d_%H%M%S).csv"
160
+ else
161
+ CSV_FILE="$RESULTS_DIR/results_$(date +%Y%m%d_%H%M%S).csv"
162
+ fi
163
+ echo "target,file,size_bytes,duration_s,throughput_mbps" > "$CSV_FILE"
164
+
165
+ # ── Upload functions (single file) ───────────────────────────────────────────
166
+
167
+ upload_mstransfer() {
168
+ local file=$1
169
+ if [[ -n "${MSTRANSFER_API_KEY:-}" ]]; then
170
+ mstransfer upload "$file" "$MSTRANSFER_HOST" --api-key "$MSTRANSFER_API_KEY"
171
+ else
172
+ mstransfer upload "$file" "$MSTRANSFER_HOST"
173
+ fi
174
+ }
175
+
176
+ upload_sftp() {
177
+ local file=$1
178
+ sftp -P "$SFTP_PORT" -i "$SFTP_KEY_PATH" -b - "$SFTP_USER@$SFTP_HOST" <<< "put $file $SFTP_DEST_DIR/"
179
+ }
180
+
181
+ upload_s3() {
182
+ local file=$1
183
+ aws s3 cp "$file" "s3://$S3_BUCKET/${S3_PREFIX}$(basename "$file")" \
184
+ ${S3_ENDPOINT_URL:+--endpoint-url "$S3_ENDPOINT_URL"}
185
+ }
186
+
187
+ # ── Batch upload functions (all files in one command) ────────────────────────
188
+
189
+ batch_upload_mstransfer() {
190
+ if [[ -n "${MSTRANSFER_API_KEY:-}" ]]; then
191
+ mstransfer upload "${FILES[@]}" "$MSTRANSFER_HOST" --api-key "$MSTRANSFER_API_KEY"
192
+ else
193
+ mstransfer upload "${FILES[@]}" "$MSTRANSFER_HOST"
194
+ fi
195
+ }
196
+
197
+ batch_upload_sftp() {
198
+ local cmds=""
199
+ for file in "${FILES[@]}"; do
200
+ cmds+="put $file $SFTP_DEST_DIR/"$'\n'
201
+ done
202
+ sftp -P "$SFTP_PORT" -i "$SFTP_KEY_PATH" -b - "$SFTP_USER@$SFTP_HOST" <<< "$cmds"
203
+ }
204
+
205
+ batch_upload_s3() {
206
+ for file in "${FILES[@]}"; do
207
+ aws s3 cp "$file" "s3://$S3_BUCKET/${S3_PREFIX}$(basename "$file")" \
208
+ ${S3_ENDPOINT_URL:+--endpoint-url "$S3_ENDPOINT_URL"}
209
+ done
210
+ }
211
+
212
+ # ── Benchmark runners ────────────────────────────────────────────────────────
213
+
214
+ run_per_file() {
215
+ local target=$1
216
+ local upload_fn="upload_$target"
217
+ local total_size=0 total_duration=0
218
+
219
+ echo "=== $target ==="
220
+
221
+ local idx=0
222
+ for file in "${FILES[@]}"; do
223
+ idx=$((idx + 1))
224
+ local fname
225
+ fname=$(basename "$file")
226
+ local size
227
+ size=$(file_size "$file")
228
+ total_size=$((total_size + size))
229
+
230
+ local t0 t1 dur tput
231
+ t0=$(now)
232
+ $upload_fn "$file"
233
+ t1=$(now)
234
+ dur=$(awk "BEGIN { printf \"%.1f\", $t1 - $t0 }")
235
+ tput=$(throughput "$size" "$dur")
236
+
237
+ printf " [%d/%d] %-45s %8s MB %6ss %s MB/s\n" \
238
+ "$idx" "$FILE_COUNT" "$fname" "$(fmt_mb "$size")" "$dur" "$tput"
239
+
240
+ echo "$target,$fname,$size,$dur,$tput" >> "$CSV_FILE"
241
+ done
242
+
243
+ total_duration=$(awk -F, -v t="$target" '$1==t { sum+=$4 } END { printf "%.1f", sum }' "$CSV_FILE")
244
+ local total_tput
245
+ total_tput=$(throughput "$total_size" "$total_duration")
246
+
247
+ printf " Aggregate: %s MB in %ss — %s MB/s\n\n" \
248
+ "$(fmt_mb "$total_size")" "$total_duration" "$total_tput"
249
+ }
250
+
251
+ run_batch() {
252
+ local target=$1
253
+ local total_size=0
254
+
255
+ for file in "${FILES[@]}"; do
256
+ total_size=$((total_size + $(file_size "$file")))
257
+ done
258
+
259
+ echo "=== $target ==="
260
+
261
+ local t0 t1 dur tput
262
+ t0=$(now)
263
+ "batch_upload_$target"
264
+ t1=$(now)
265
+ dur=$(awk "BEGIN { printf \"%.1f\", $t1 - $t0 }")
266
+ tput=$(throughput "$total_size" "$dur")
267
+
268
+ printf " %s MB in %ss — %s MB/s\n\n" \
269
+ "$(fmt_mb "$total_size")" "$dur" "$tput"
270
+
271
+ echo "$target,ALL,$total_size,$dur,$tput" >> "$CSV_FILE"
272
+ }
273
+
274
+ # ── Ensure S3 bucket exists ───────────────────────────────────────────────────
275
+
276
+ for t in "${TARGETS[@]}"; do
277
+ if [[ "$t" == "s3" ]]; then
278
+ if ! aws s3api head-bucket --bucket "$S3_BUCKET" \
279
+ ${S3_ENDPOINT_URL:+--endpoint-url "$S3_ENDPOINT_URL"} 2>/dev/null; then
280
+ echo "Creating S3 bucket: $S3_BUCKET"
281
+ aws s3api create-bucket --bucket "$S3_BUCKET" \
282
+ ${S3_ENDPOINT_URL:+--endpoint-url "$S3_ENDPOINT_URL"}
283
+ fi
284
+ break
285
+ fi
286
+ done
287
+
288
+ # ── Main ─────────────────────────────────────────────────────────────────────
289
+
290
+ echo "Benchmark mode: $MODE"
291
+ echo "Targets: ${TARGETS[*]}"
292
+ echo "Files: $FILE_COUNT mzML files in $DATA_DIR"
293
+ echo "CSV output: $CSV_FILE"
294
+ echo ""
295
+
296
+ for target in "${TARGETS[@]}"; do
297
+ if [[ "$MODE" == "per-file" ]]; then
298
+ run_per_file "$target"
299
+ else
300
+ run_batch "$target"
301
+ fi
302
+ done
303
+
304
+ echo "Results written to $CSV_FILE"
@@ -0,0 +1,14 @@
1
+ # MSTransfer Benchmark - Dataset Manifest
2
+ #
3
+ # One URL per line pointing to a RAW file on PRIDE FTP/HTTPS.
4
+ # Lines starting with '#' and blank lines are ignored.
5
+ # RAW files are downloaded and converted to mzML via msconvert Docker.
6
+ #
7
+ # Example:
8
+ # https://ftp.pride.ebi.ac.uk/pride/data/archive/2024/01/PXD012345/sample.raw
9
+ #
10
+ # Add your dataset URLs below:
11
+ https://ftp.pride.ebi.ac.uk/pride/data/archive/2020/09/PXD016914/MDR_11122019_IMX1770_3_DDA01.raw
12
+ https://ftp.pride.ebi.ac.uk/pride/data/archive/2020/09/PXD021034/m17349ftMASTMTFrac5.raw
13
+ https://ftp.pride.ebi.ac.uk/pride/data/archive/2020/11/PXD016398/L08129.raw
14
+ https://ftp.pride.ebi.ac.uk/pride/data/archive/2020/11/PXD020735/92-70562_PHJ11604X076__0Gy_RepIII40-20626.raw
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ MANIFEST="$SCRIPT_DIR/datasets.txt"
6
+ DATA_DIR="$SCRIPT_DIR/data"
7
+ CONVERTER_IMAGE="thermorawfileparser:local"
8
+ DOCKERFILE="$SCRIPT_DIR/Dockerfile.thermorawfileparser"
9
+
10
+ if [[ ! -f "$MANIFEST" ]]; then
11
+ echo "Error: datasets.txt not found at $MANIFEST"
12
+ exit 1
13
+ fi
14
+
15
+ # Check Docker is available
16
+ if ! command -v docker &>/dev/null; then
17
+ echo "Error: docker is not installed. Install Docker to convert RAW files to mzML."
18
+ exit 1
19
+ fi
20
+ if ! docker info &>/dev/null; then
21
+ echo "Error: Docker daemon is not running. Start Docker and try again."
22
+ exit 1
23
+ fi
24
+
25
+ # Build converter image if it doesn't exist
26
+ if ! docker image inspect "$CONVERTER_IMAGE" &>/dev/null; then
27
+ echo "Building ThermoRawFileParser Docker image..."
28
+ docker build --platform linux/amd64 -t "$CONVERTER_IMAGE" -f "$DOCKERFILE" "$SCRIPT_DIR"
29
+ fi
30
+
31
+ # Read non-comment, non-blank lines (compatible with Bash 3 on macOS)
32
+ URLS=()
33
+ while IFS= read -r line; do
34
+ URLS+=("$line")
35
+ done < <(grep -v '^\s*#' "$MANIFEST" | grep -v '^\s*$')
36
+
37
+ if [[ ${#URLS[@]} -eq 0 ]]; then
38
+ echo "No URLs found in datasets.txt. Add dataset URLs and try again."
39
+ exit 0
40
+ fi
41
+
42
+ mkdir -p "$DATA_DIR"
43
+
44
+ TOTAL=${#URLS[@]}
45
+ COUNT=0
46
+
47
+ for URL in "${URLS[@]}"; do
48
+ COUNT=$((COUNT + 1))
49
+ RAW_FILENAME="$(basename "$URL")"
50
+ MZML_FILENAME="${RAW_FILENAME%.*}.mzML"
51
+ RAW_DEST="$DATA_DIR/$RAW_FILENAME"
52
+ MZML_DEST="$DATA_DIR/$MZML_FILENAME"
53
+
54
+ # Skip if mzML already exists
55
+ if [[ -f "$MZML_DEST" ]]; then
56
+ echo "[$COUNT/$TOTAL] $MZML_FILENAME (already exists, skipping)"
57
+ continue
58
+ fi
59
+
60
+ # Download RAW file
61
+ echo "[$COUNT/$TOTAL] Downloading $RAW_FILENAME..."
62
+ if command -v curl &>/dev/null; then
63
+ curl -fSL --progress-bar -o "$RAW_DEST" "$URL"
64
+ elif command -v wget &>/dev/null; then
65
+ wget -q --show-progress -O "$RAW_DEST" "$URL"
66
+ else
67
+ echo "Error: neither curl nor wget found"
68
+ exit 1
69
+ fi
70
+
71
+ # Convert RAW to mzML via ThermoRawFileParser Docker
72
+ echo "[$COUNT/$TOTAL] Converting $RAW_FILENAME to mzML..."
73
+ docker run --rm --platform linux/amd64 -v "$DATA_DIR:/data" \
74
+ "$CONVERTER_IMAGE" \
75
+ -i "/data/$RAW_FILENAME" -o /data/ -f 2
76
+
77
+ # Verify conversion succeeded
78
+ if [[ ! -f "$MZML_DEST" ]]; then
79
+ echo "Error: conversion failed — $MZML_FILENAME not found after ThermoRawFileParser"
80
+ exit 1
81
+ fi
82
+
83
+ # Clean up RAW file
84
+ rm -f "$RAW_DEST"
85
+ echo "[$COUNT/$TOTAL] $MZML_FILENAME ready (RAW file removed)"
86
+ done
87
+
88
+ echo ""
89
+ echo "Done. $TOTAL dataset(s) processed. mzML files in $DATA_DIR"