-
Notifications
You must be signed in to change notification settings - Fork 0
/
02_TangentXY.sh
executable file
·70 lines (59 loc) · 2.64 KB
/
02_TangentXY.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
#!/bin/bash
# ------------------------------------------------------------------------------
# Author: Kei Enomoto
# Contact: Rameen Beroukhim, [email protected]
# Description: Code to perform TangentXY on tumor samples.
# License: GNU GPL2, Copyright (C) 2023 Dana-Farber Cancer Institute
# ------------------------------------------------------------------------------
DefaultWorkingDir=$(pwd)
usage() {
echo "usage: 02_TangentXY.sh -d <WorkingDir> -s <SIF> -n <NormalsMatrix> -p <NormalsTransformedMatrix> -t <TumorMatrix> -l <LatentFactorNum>"
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."
echo " NormalsTransformedMatrix: RData file generated by 01_PreprocessNormals.sh."
echo " TumorMatrix: Tumor sample signal matrix file with the values in log2(Relative Copy Number) format."
echo " LatentFactorNum: The number of latent factors to reconstruct a normal subspace. Need to be less than or equal to the number of normal samples in the normal sample signal matrix."
}
while getopts :d:s:n:p:t:l: option; do
case "${option}" in
d) WorkingDir=${OPTARG};;
s) SIF=${OPTARG};;
n) NormalsMatrix=${OPTARG};;
p) NormalsTransformedMatrix=${OPTARG};;
t) TumorsMatrix=${OPTARG};;
l) LatentFactorNum=${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} ] || [ -z ${NormalsTransformedMatrix} ] || [ -z ${TumorsMatrix} ] || [ -z ${LatentFactorNum} ]; then
echo "Key arguments (Sample information file, Normal samples matrix, Normal samples transformed matrix, Tumor samples matrix, Number of latentfactors) not present."
usage
exit 1
else
SIF_Absolute=$(realpath ${SIF})
NormalsMatrix_Absolute=$(realpath ${NormalsMatrix})
NormalsTransformedMatrix_Absolute=$(realpath ${NormalsTransformedMatrix})
TumorsMatrix_Absolute=$(realpath ${TumorsMatrix})
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 TangentXY...\n"
Rscript --slave ./module/03_TangentXY.R \
-d ${WorkingDir_Absolute} -s ${SIF_Absolute} -n ${NormalsMatrix_Absolute} -p ${NormalsTransformedMatrix_Absolute} -t ${TumorsMatrix_Absolute} -l ${LatentFactorNum}