-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixSamples.sh
executable file
·90 lines (66 loc) · 2.91 KB
/
fixSamples.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
cnvkit="/home/ccurnin/custom-cnvkit/cnvkit.py"
udn="/oak/stanford/groups/euan/cnvkit/"
if [[ $* == *--WGS* ]]
then
output="/oak/stanford/groups/euan/cnvkit/WGSCNR/"
antitargetPath="/oak/stanford/groups/euan/cnvkit/empty.antitargetcoverage.cnn"
if [[ $* = *--male* ]]
then
echo "male"
list="/home/ccurnin/cnv/cnvkit/categories/male.txt"
reference="/home/ccurnin/cnv/cnvkit/references/WGS/maleUnaffected.cnn"
else
echo "female"
list="/home/ccurnin/cnv/cnvkit/categories/female.txt"
reference="/home/ccurnin/cnv/cnvkit/references/WGS/femaleUnaffected.cnn"
fi
grep -f "$list" <(ls /oak/stanford/groups/euan/cnvkit/otherWGS/{un,}affected/target/* /oak/stanford/groups/euan/cnvkit/StanfordWGS/target/*) | while read -r targetPath
do
targetName=$(basename "$targetPath")
UDN_ID=$(sed "s|\..*||" <<< "$targetName")
executable="/home/ccurnin/cnv/cnvkit/slurm/fix${UDN_ID}.sh"
outputFile="${output}${UDN_ID}.cnr"
echo "#!/bin/bash" > "$executable"
if [[ $* == *--male* ]]
then
echo "${cnvkit} fix ${targetPath} ${antitargetPath} ${reference} -o ${outputFile}" >> "$executable"
else
echo "${cnvkit} fix ${targetPath} ${antitargetPath} ${reference} -o ${outputFile}" >> "$executable"
fi
echo "$executable"
echo "$targetPath"
echo "$antitargetPath"
sbatch -p owners "$executable"
done
else
output="/oak/stanford/groups/euan/cnvkit/WESCNR/"
if [[ $* = *--male* ]]
then
list="/home/ccurnin/cnv/cnvkit/categories/male.txt"
reference="/home/ccurnin/cnv/cnvkit/references/WES/maleUnaffected.cnn"
else
list="/home/ccurnin/cnv/cnvkit/categories/female.txt"
reference="/home/ccurnin/cnv/cnvkit/references/WES/femaleUnaffected.cnn"
fi
grep -f "$list" <(ls /oak/stanford/groups/euan/cnvkit/otherWES/{un,}affected/target/* /oak/stanford/groups/euan/cnvkit/StanfordWES/target/*) | while read -r targetPath
do
targetName=$(basename "$targetPath")
UDN_ID=$(sed "s|\..*||" <<< "$targetName")
antitargetName="${UDN_ID}.antitargetcoverage.cnn"
antitargetPath=$(find "$udn" -name "$antitargetName")
executable="/home/ccurnin/cnv/cnvkit/slurm/fix${UDN_ID}.sh"
outputFile="${output}${UDN_ID}.cnr"
echo "#!/bin/bash" > "$executable"
if [[ $* == *--male* ]]
then
echo "${cnvkit} fix ${targetPath} ${antitargetPath} ${reference} -o ${outputFile}" >> "$executable"
else
echo "${cnvkit} fix ${targetPath} ${antitargetPath} ${reference} -o ${outputFile}" >> "$executable"
fi
echo "$executable"
echo "$targetPath"
echo "$antitargetPath"
sbatch -p owners "$executable"
done
fi