Add bulk export action to download a set of samplesheets
acknowledged
E
Exclusive Dragonfly
The most recent version. I ended up having seqera ai help me b/c I was getting a 404 error from
w datasets list -w brentlab/Doering-lab \
| awk 'NR>5 {print $3}' \
| while read -r id;do tw datasets download -w brentlab/Doering-lab -n $id > doering_lab_samplesheets/$id.csv;done
It came up with:
#!/bin/bash
# Download all datasets from a Seqera Platform workspace using the API directly.
# Works around a bug in tw CLI 0.14.0-A0 where `tw datasets download` returns 404.
#
# Usage: ./download_seqera_datasets.sh [workspace_id] [output_dir]
# workspace_id - numeric workspace ID (default: Doering-lab 24615593658600)
# output_dir - destination directory (default: doering_lab_samplesheets)
#
# Requires: TOWER_ACCESS_TOKEN environment variable
set -euo pipefail
TOKEN="${TOWER_ACCESS_TOKEN:?Set TOWER_ACCESS_TOKEN before running this script}"
WORKSPACE_ID="${1:-24615593658600}"
OUTDIR="${2:-doering_lab_samplesheets}"
mkdir -p "$OUTDIR"
curl -s -H "Authorization: Bearer $TOKEN" \
"https://cloud.seqera.io/api/workspaces/${WORKSPACE_ID}/datasets" \
| python3 -c "
import json, sys
data = json.load(sys.stdin)
for ds in data['datasets']:
print(ds['id'], ds['name'])
" | while read -r id name; do
url=$(curl -s -H "Authorization: Bearer $TOKEN" \
"https://cloud.seqera.io/api/workspaces/${WORKSPACE_ID}/datasets/${id}/versions" \
| python3 -c "
import json, sys
data = json.load(sys.stdin)
versions = data.get('versions', [])
if versions:
print(versions[-1]['url'])
" 2>/dev/null)
if [ -n "$url" ]; then
curl -s -H "Authorization: Bearer $TOKEN" "$url" > "${OUTDIR}/${name}.csv"
echo "Downloaded: ${name}.csv"
else
echo "SKIPPED (no versions): ${name}"
fi
done
which does work
Rob Newman
Hi Exclusive Dragonfly - thank you for this feature request. To clarify your request: datasets in Seqera Platform are versioned, so if you bulk exported a set of samplesheets would you expect to download only the most recent (current) version of each samplesheet, or all versions of the selected samplesheets?
Rob Newman
updated the status to
acknowledged