diff --git a/submit_bcbio_trio_wes.sh b/submit_bcbio_trio_wes.sh index 9b096b38bb3b86880e4591733eb0c1d75b90c9d7..7d20d950563637046fce23dcbee200cd42c3580d 100755 --- a/submit_bcbio_trio_wes.sh +++ b/submit_bcbio_trio_wes.sh @@ -34,19 +34,19 @@ cd $WORK_DIR/$FAMILY_ID bcbio_nextgen.py $CONFIG_FILE -n $SLURM_CPUS_PER_TASK -t local -exit +DATE=$(basename `tail log/bcbio-nextgen.log | grep 'Storing in local filesystem' | tail -n 1 | awk '{ print $6 }' | perl -pe "s/_${SHORT_PROJECT_ID}.+//"`) -DATE=$(basename `tail log/bcbio-nextgen.log | grep 'Storing in local filesystem' | tail -n 1 | awk '{ print $6 }' | perl -pe "s/_${PROJECT_ID}.+//"`) +FAMILY_DIR=${DATE}_${SHORT_PROJECT_ID}_${VERSION}_${FAMILY_ID} -if [ -e $OUTPUT_DIR/${DATE}_${SHORT_PROJECT_ID}_${FAMILY_ID} ] +if [ -e $OUTPUT_DIR/$FAMILY_DIR ] then for INDV in `cut -f 2 $OUTPUT_DIR/${SHORT_PROJECT_ID}_${VERSION}/params/${PROJECT_ID}_${FAMILY_ID}.ped` do - mv $OUTPUT_DIR/$INDV $OUTPUT_DIR/${DATE}_${PROJECT_ID}_${FAMILY_ID}/ + mv $OUTPUT_DIR/$INDV $OUTPUT_DIR/$FAMILY_DIR/ done #Â fix VCF output file names - cd $OUTPUT_DIR/${DATE}_${PROJECT_ID}_${FAMILY_ID} + cd $OUTPUT_DIR/$FAMILY_DIR if [ ! -e ${FAMILY_ID}-gatk-haplotype-annotated.vcf.gz ] then PREFIX=`echo $FAMILY_ID | cut -d '_' -f 1` @@ -55,6 +55,10 @@ then mv ${PREFIX}${SUFFIX}-gatk-haplotype-annotated.vcf.gz.tbi ${FAMILY_ID}-gatk-haplotype-annotated.vcf.gz.tbi fi + cd $OUTPUT_DIR + mkdir -p ${SHORT_PROJECT_ID}_${VERSION}/families + mv $FAMILY_DIR ${SHORT_PROJECT_ID}_${VERSION}/families/ + else echo $OUTPUT_DIR/${DATE}_${PROJECT_ID}_${FAMILY_ID} does not exist. fi