Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Kpmp 4871 update validate args #12

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -24,7 +24,8 @@ To initialize the `.env` file, copy `wsi-worker/scripts/.env.example` and modify
1. KPMP ID
2. SVS filename without the `.svs` extension
3. Package File ID from the Data Lake
4. [Optional] stain type. Values are 'he', 'pas', 'silver', 'tri', 'frz', 'tol' and 'cr'. Defaults to 'pas'
4. Slide type. Values are 'LM', 'EM', 'IF'.
5. [Optional] stain type. Values are 'he', 'pas', 'silver', 'tri', 'frz', 'tol' and 'cr'. Defaults to 'pas'

#### .env File
1. `ENV_IMAGE`: defaults to `kingstonduo/wsi-worker`
2 changes: 1 addition & 1 deletion docker/wsi-worker/svs2dz
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
source /usr/sbin/svs2dz-functions.sh
assert_no_errors "!!! source load failure"

validate_args $1 $2 $3 $4
validate_args $1 $2 $3 $4 $5
# no assertion needed; validate_args works differently

call_vips $1 $2 $3 $4
14 changes: 9 additions & 5 deletions docker/wsi-worker/svs2dz-functions.sh
Original file line number Diff line number Diff line change
@@ -8,10 +8,10 @@ JOB_OUT_DIR=/data/job/out
print_help() {
cat << EOL
--- Command help
Usage: svs2dz "KPMP_ID" "FILENAME_NO_EXTENSION" "PKG_FILE_ID" ["STAIN_TYPE"]
Usage: svs2dz "KPMP_ID" "FILENAME_NO_EXTENSION" "PKG_FILE_ID" "SLIDE_TYPE" ["STAIN_TYPE"]
All arguments should be enclosed in double-quotes to escape spaces.
Example: svs2dz "KPMP-Ex1" "KPMP-Ex1_TRI_1of1" "b9f7c729-8370-4f8d-9753-4a36e8ae57a4" "TRI"
... The above example creates symlinks at <ENV_WSE_LINK_FROM_DIR>/files_KPMP-Ex1/KPMP-Ex1_TRI_1of1, stain type Trichrome
Example: svs2dz "KPMP-Ex1" "KPMP-Ex1_TRI_1of1" "b9f7c729-8370-4f8d-9753-4a36e8ae57a4" "IF" "TRI"
... The above example creates symlinks at <ENV_WSE_LINK_FROM_DIR>/files_KPMP-Ex1/KPMP-Ex1_TRI_1of1, slide type Immunofluorescence, stain type Trichrome
EOL
}

@@ -53,8 +53,12 @@ validate_args() {
fi

if [[ -z $4 ]]; then
print_error "!!! arg 4 must be slide type"
fi

if [[ -z $5 ]]; then
echo "... optional stain not passed; defaulting to type 'pas'"
4=pas
5=pas
fi

if (( DID_ERROR > 0 )); then
@@ -111,5 +115,5 @@ extract_metadata() {
}

generate_mongo_records() {
node /usr/sbin/generate_mongo_records.js $1 $2 $3 $4 $JOB_OUT_DIR/metadata.json
node /usr/sbin/generate_mongo_records.js $1 $2 $3 $4 $5 $JOB_OUT_DIR/metadata.json
}
5 changes: 3 additions & 2 deletions scripts/run-wsi-worker.sh
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@ mkdir -p ${ENV_LINK_DST_DIR_HOST}
# arg $1 must be KPMP ID
# arg $2 must be input file name (no extension) directly inside $JOB_IN_DIR
# arg $3 must be file ID
# arg $4 is currently optional stain type (defaults to "pas")
# arg $4 must be stain type (LM, EM, IF)
# arg $5 is currently optional stain type (defaults to "pas")

docker run \
--env-file .env \
@@ -18,4 +19,4 @@ docker run \
-v ${ENV_LINK_DST_DIR_HOST}:${ENV_LINK_DST_DIR} \
-v ${ENV_JOB_IN_DIR}:/data/job/in \
-v ${ENV_JOB_OUT_DIR}:/data/job/out \
${ENV_IMAGE} $1 $2 $3 $4
${ENV_IMAGE} $1 $2 $3 $4 $5