From 5ff70749a8b1ab3f07a9eb090a610616e83a2ea4 Mon Sep 17 00:00:00 2001 From: Graeme-Smith Date: Mon, 19 Feb 2024 18:41:47 +0000 Subject: [PATCH 1/2] Add bash script to help in manual upload of Quiagen TSO samples --- README.md | 8 ++++++++ tso_upload_helper.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tso_upload_helper.sh diff --git a/README.md b/README.md index 41e44e9..2d7907a 100644 --- a/README.md +++ b/README.md @@ -54,3 +54,11 @@ This is a static webpage that can be used to automate the download of multiple U - The files will be downloaded one by one. If you are prompted for permission to download multiple files try adjusting the download delay in the HTML file which is currently set at 1 second. ![image](./bulkUploader.png) + +### tso_upload_helper.sh + +If run with the name of a TSO project in DNA nexus as an argument, this script will partly populate the command required to upload the zip files to Quiagen: + +```bash tso_upload.sh 002_240216_A01229_0290_AHNL5GDMXY_TSO24006``` + +The resulting command will be sent to std out with just the APP_ID and MOKAGUYS_AUTH_TOKEN needing to be added to each line, this can be done using find & replace. IMPORTANT: HD200 and NTC samp6es (HD200 or 00000_00000 in sample name) should have their lines removed manually as these should not be uploaded. \ No newline at end of file diff --git a/tso_upload_helper.sh b/tso_upload_helper.sh new file mode 100644 index 0000000..316877c --- /dev/null +++ b/tso_upload_helper.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Check if a project name is provided +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Assign the first argument to a variable +project_name="$1" + +# Capture the output from dx find into a variable +table_output=$(dx find data --name "*.zip" --json --path "${project_name}":results | jq -r ' + ["ID", "Name", "State", "Folder", "Modified", "Size"] as $headers + | ["---", "---", "---", "---", "---", "---"] as $separator + | [$headers, $separator] + + (map([.id, .describe.name, .describe.state, .describe.folder, (.describe.modified / 1000 | todate), .describe.size])) + | .[] + | @tsv' | column -t) + +# Define APP_ID and MOKAGUYS_AUTH_TOKEN +APP_ID="APP_ID" +MOKAGUYS_AUTH_TOKEN="MOKAGUYS_AUTH_TOKEN" + +# Now you can manipulate $table_output with awk or any other tool. +# Iterate over the table row by row +while IFS= read -r line; do + # Skip the header and separator lines + if [[ "$line" == ID* ]] || [[ "$line" == "---"* ]]; then + continue + fi + + # Extract the Name, Folder, and ID using awk + FILE_NAME=$(echo "$line" | awk '{print $2}') + FOLDER=$(echo "$line" | awk '{print $4}') + ID=$(echo "$line" | awk '{print $1}') + + FILE_ID="${FOLDER}/${FILE_NAME}" + SAMPLE_NAME="${FILE_NAME%.zip}" + + # Print the dx run command + echo "dx run project-ByfFPz00jy1fk6PjpZ95F27J:$APP_ID --priority high -y --name=$SAMPLE_NAME -isample_name=$SAMPLE_NAME -isample_zip_folder=$project_name:$FILE_ID --project=$project_name --auth $MOKAGUYS_AUTH_TOKEN" + + done <<< "$table_output" \ No newline at end of file From 590a098b52d580cbea69c81d8c86b821a1baf322 Mon Sep 17 00:00:00 2001 From: Graeme Date: Mon, 19 Feb 2024 18:45:39 +0000 Subject: [PATCH 2/2] Update README.md Fixed typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2d7907a..9349e18 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ This is a static webpage that can be used to automate the download of multiple U ### tso_upload_helper.sh -If run with the name of a TSO project in DNA nexus as an argument, this script will partly populate the command required to upload the zip files to Quiagen: +If run with the name of a TSO related project in DNA nexus as an argument, this script will partly populate the command required to upload the zip files to Qiagen: ```bash tso_upload.sh 002_240216_A01229_0290_AHNL5GDMXY_TSO24006``` -The resulting command will be sent to std out with just the APP_ID and MOKAGUYS_AUTH_TOKEN needing to be added to each line, this can be done using find & replace. IMPORTANT: HD200 and NTC samp6es (HD200 or 00000_00000 in sample name) should have their lines removed manually as these should not be uploaded. \ No newline at end of file +The resulting command will be sent to std out with just the APP_ID and MOKAGUYS_AUTH_TOKEN needing to be added to each line, this can be done using find & replace. IMPORTANT: HD200 and NTC samples (HD200 or 00000_00000 in sample name) should have their lines removed manually as these should not be uploaded.