-
Notifications
You must be signed in to change notification settings - Fork 7
/
stage_rnaseq_delivery.sh
executable file
·55 lines (39 loc) · 1.77 KB
/
stage_rnaseq_delivery.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# A helper script to stage deliveries for NF-core RNA-seq BP analysis results
set -e
PROJECT=$1
#Check if project given else print usage
if [ "$#" -ne 1 ]
then
echo "Usage: stage_rnaseq_delivery.sh <PROJECT_NAME>"
exit 1
fi
STAGING_ROOT='/proj/ngi2016001/nobackup/NGI/DELIVERY'
ANALYSIS_ROOT='/proj/ngi2016001/nobackup/NGI/ANALYSIS'
STAGING_DIR="${STAGING_ROOT}/${PROJECT}"
ANALYSIS_DIR="${ANALYSIS_ROOT}/${PROJECT}"
README_LOCATION='/proj/ngi2016001/nobackup/NGI/DELIVERY/README'
README_NAME='RNASEQ_README.md'
#The location of the multiqc report in ANALYSIS_DIR, copied to seqsummaries
REPORT_REL_LOCATION='results/MultiQC'
SEQSUM_ROOT='/proj/ngi2016001/incoming/reports'
SEQSUM_DIR="${SEQSUM_ROOT}/${PROJECT}"
echo "Staging $ANALYSIS_DIR into $STAGING_DIR"
# Tar qualimap-files and remove directory or delivery fails
cd "${ANALYSIS_DIR}/results"
tar cvzf qualimap.tar.gz ./qualimap
#Remove qualimap folder
rm -r ./qualimap
# Create staging directory
mkdir "${STAGING_DIR}"
cd "${STAGING_DIR}"
# Link result files
ln -s "${ANALYSIS_DIR}/results" .
#Copy readme (sample_correlation included? check file structure.) Add comment on dirs that may be omitted?
cp "${README_LOCATION}/${README_NAME}" .
# Calculate checksums
echo sbatch -A ngi2016001 -n 8 -t 10:00:00 -J "checksums_$PROJECT" -o "${ANALYSIS_DIR}/logs/checksums.log" -e "${ANALYSIS_DIR}/logs/checksums.log" --wrap "find results/ -type f -exec md5sum {} >> checksums.md5 \;"
sbatch -A ngi2016001 -n 8 -t 10:00:00 -J "checksums_$PROJECT" -o "${ANALYSIS_DIR}/logs/checksums.log" -e "${ANALYSIS_DIR}/logs/checksums.log" --wrap "find results/ -type f -exec md5sum {} >> checksums.md5 \;"
# Link/copy multiqc report to seqsummaries
mkdir -p "${SEQSUM_DIR}"
cp -r "${ANALYSIS_DIR}/${REPORT_REL_LOCATION}/"* "${SEQSUM_DIR}"