-
Notifications
You must be signed in to change notification settings - Fork 0
/
01_PreprocessNormals.sh
executable file
·74 lines (57 loc) · 2.1 KB
/
01_PreprocessNormals.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# ------------------------------------------------------------------------------
# Author: Kei Enomoto
# Contact: Rameen Beroukhim, [email protected]
# Description: Code to perform linear transformation and singular value
# decomposition (SVD) on reference plane.
# License: GNU GPL2, Copyright (C) 2023 Dana-Farber Cancer Institute
# ------------------------------------------------------------------------------
DefaultWorkingDir=$(pwd)
usage() {
echo "usage: 01_PreprocessNormals.sh -d <WorkingDir> -s <SIF> -n <NormalsMatrix>"
echo " WorkingDir: Working directory. 'output' directory is automatically generated under this directory."
echo " SIF: Sample information file."
echo " NormalsMatrix: Normal sample signal matrix file with the values in log2(Relative Copy Number) format."
}
##### -------------------- Step 1 (Linear transformation of male chrX signal) -------------------- #####
while getopts :d:s:n: option; do
case "${option}" in
d) WorkingDir=${OPTARG};;
s) SIF=${OPTARG};;
n) NormalsMatrix=${OPTARG};;
\?)
echo "Unknown options:"
usage
exit 1;;
:)
echo "Missing required options:"
usage
exit 1;;
h|*)
usage
exit 1;;
esac
done
if [ -z ${SIF} ] || [ -z ${NormalsMatrix} ]; then
echo "Key arguments (Sample information file, ) not present."
echo "Exiting..."
exit 1
else
SIF_Absolute=$(realpath ${SIF})
NormalsMatrix_Absolute=$(realpath ${NormalsMatrix})
fi
if [ -z ${WorkingDir} ]; then
WorkingDir=${DefaultWorkingDir}
WorkingDir_Absolute=$(realpath ${WorkingDir})
echo "Working directory not set. Using "${WorkingDir_Absolute}" instead."
else
WorkingDir_Absolute=$(realpath ${WorkingDir})
echo "Working directory = "${WorkingDir_Absolute}
fi
echo -e "\nRunning linear transformation...\n"
Rscript --slave ./module/01_LinearTransformation.R \
-d ${WorkingDir_Absolute} -s ${SIF_Absolute} -n ${NormalsMatrix_Absolute}
##### -------------------- Step 2 (SVD on autosomes & chrX) -------------------- #####
echo -e "\nRunning SVD...\n"
Rscript --slave ./module/02_SVD.R \
-d ${WorkingDir_Absolute} -s ${SIF_Absolute}