-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19bb01e
commit a46a977
Showing
3 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
tasks/utilities/file_handling/task_transfer_pod5_files.wdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
version 1.0 | ||
|
||
task transfer_pod5_files { | ||
input { | ||
String pod5_bucket_path # Terra bucket path (e.g., "gs://your-terra-bucket/pod5_uploads/") | ||
Int disk_size = 100 | ||
Int memory = 32 | ||
Int cpu = 8 | ||
String docker = "us-docker.pkg.dev/general-theiagen/cloudsdktool/google-cloud-cli:427.0.0-alpine" | ||
} | ||
command <<< | ||
set -euo pipefail | ||
|
||
# Create a directory for downloaded `.pod5` files | ||
mkdir -p pod5_downloads | ||
|
||
echo "Listing and downloading .pod5 files from ~{pod5_bucket_path}" | ||
gcloud storage ls -r "~{pod5_bucket_path}" | grep "\.pod5$" > pod5_files_list.txt | ||
|
||
# Check if any files are found | ||
if [ ! -s pod5_files_list.txt ]; then | ||
echo "ERROR: No POD5 files found in ~{pod5_bucket_path}" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Download all `.pod5` files locally | ||
while read -r file_path; do | ||
local_path="pod5_downloads/$(basename "$file_path")" | ||
gcloud storage cp "$file_path" "$local_path" || { echo "ERROR: Failed to download $file_path"; exit 1; } | ||
echo "$local_path" >> downloaded_pod5_files.txt | ||
done < pod5_files_list.txt | ||
>>> | ||
|
||
output { | ||
Array[File] pod5_file_paths = read_lines("downloaded_pod5_files.txt") # Local paths of downloaded `.pod5` files | ||
} | ||
runtime { | ||
docker: docker | ||
cpu: cpu | ||
memory: "~{memory} GB" | ||
disks: "local-disk ~{disk_size} SSD" | ||
preemptible: 0 | ||
maxRetries: 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters