From ee1d7827c39676cf773fafecd1136185334f99a6 Mon Sep 17 00:00:00 2001
From: ameyner2 <alison.meynert@igmm.ed.ac.uk>
Date: Fri, 18 Jun 2021 11:38:22 +0100
Subject: [PATCH] Using version/base project id to group output

---
 submit_trio_wes_checksums.sh        | 6 ++++--
 submit_trio_wes_cram_compression.sh | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/submit_trio_wes_checksums.sh b/submit_trio_wes_checksums.sh
index d91b877..b67cba4 100755
--- a/submit_trio_wes_checksums.sh
+++ b/submit_trio_wes_checksums.sh
@@ -25,9 +25,11 @@ source $CONFIG_SH
 
 FAMILY_ID=`head -n $PBS_ARRAY_INDEX $PARAMS_DIR/$PROJECT_ID.family_ids.txt | tail -n 1`
 
-# This assumes that ${PROJECT_ID}_${FAMILY_ID} is unique, and it should be - if there was
+BASE_PROJECT_ID=`echo $PROJECT_ID | cut -f 1 -d '_'`
+
+# This assumes that ${VERSION}_${PROJECT_ID}_${FAMILY_ID} is unique, and it should be - if there was
 # a re-run of a family, it should have a new project id.
-cd $OUTPUT_DIR/*${VERSION}_${PROJECT_ID}_${FAMILY_ID}*
+cd $OUTPUT_DIR/${VERSION}_${BASE_PROJECT_ID}/*${VERSION}_${PROJECT_ID}_${FAMILY_ID}*
 
 rm md5sum.txt 2> /dev/null
 
diff --git a/submit_trio_wes_cram_compression.sh b/submit_trio_wes_cram_compression.sh
index 467bcff..b0e8498 100755
--- a/submit_trio_wes_cram_compression.sh
+++ b/submit_trio_wes_cram_compression.sh
@@ -25,9 +25,11 @@ source $CONFIG_SH
 
 FAMILY_ID=`head -n $PBS_ARRAY_INDEX $PARAMS_DIR/$PROJECT_ID.family_ids.txt | tail -n 1`
 
-# This assumes that ${PROJECT_ID}_${FAMILY_ID} is unique, and it should be - if there was
+BASE_PROJECT_ID=`echo $PROJECT_ID | cut -f 1 -d '_'`
+
+# This assumes that ${VERSION}_${PROJECT_ID}_${FAMILY_ID} is unique, and it should be - if there was
 # a re-run of a family, it should have a new project id.
-cd $OUTPUT_DIR/*${VERSION}_${PROJECT_ID}_${FAMILY_ID}*
+cd $OUTPUT_DIR/${VERSION}_${BASE_PROJECT_ID}/*${VERSION}_${PROJECT_ID}_${FAMILY_ID}*
 
 for BAM in */*.bam
 do
-- 
GitLab