-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_folder.sh
89 lines (82 loc) · 2.42 KB
/
create_folder.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
#!/bin/bash
if [ $# != 1 ]
then
echo "Usage: wrapper to create folder structure\n <run info file>"
else
echo `date`
run_info=$1
tool=$( cat $run_info | grep -w '^TYPE' | cut -d '=' -f2|tr "[A-Z]" "[a-z]")
analysis=$( cat $run_info | grep -w '^ANALYSIS' | cut -d '=' -f2 | tr "[A-Z]" "[a-z]" )
output=$( cat $run_info | grep -w '^BASE_OUTPUT_DIR' | cut -d '=' -f2)
PI=$( cat $run_info | grep -w '^PI' | cut -d '=' -f2)
tool=$( cat $run_info | grep -w '^TYPE' | cut -d '=' -f2|tr "[A-Z]" "[a-z]")
run_num=$( cat $run_info | grep -w '^OUTPUT_FOLDER' | cut -d '=' -f2)
if [ -d $output/$PI ]
then
echo "WARNING : $PI folder exists"
else
mkdir -p $output/$PI
fi
if [ -d $output/$PI/$tool ]
then
echo "WARNING : $tool analysis folder exists"
else
mkdir -p $output/$PI/$tool
fi
if [ -d $output/$PI/$tool/$run_num ]
then
echo "ERROR : $run_num folder exists"
touch $output/$PI/$tool/$run_num/folder_exist.log
exit 1;
else
mkdir -p $output/$PI/$tool/$run_num
output_dir=$output/$PI/$tool/$run_num
fi
mkdir -p $output_dir/logs
mkdir -p $output_dir/size
mkdir -p $output_dir/config
if [[ $analysis != "annotation" && $analysis != "ontarget" ]]
then
if [ $analysis == "external" -o $analysis == "mayo" -o $analysis == "alignment" ]
then
mkdir -p $output_dir/fastq
mkdir -p $output_dir/fastqc
fi
if [[ $analysis != "variant" ]]
then
mkdir -p $output_dir/alignment
fi
mkdir -p $output_dir/IGV_BAM
if [ $analysis != "alignment" ]
then
if [[ $analysis != "annotation" && $analysis != "ontarget" ]]
then
mkdir -p $output_dir/realign
fi
if [ $analysis != "annotation" ]
then
mkdir -p $output_dir/variants
fi
if [ $tool == "whole_genome" ]
then
mkdir -p $output_dir/cnv
mkdir -p $output_dir/struct
mkdir -p $output_dir/circos
fi
fi
fi
if [ $analysis != "alignment" ]
then
mkdir -p $output_dir/OnTarget
mkdir -p $output_dir/annotation
output_annot=$output_dir/annotation
mkdir -p $output_annot/SIFT
mkdir -p $output_annot/SNPEFF
mkdir -p $output_annot/POLYPHEN
mkdir -p $output_dir/TempReports
mkdir -p $output_dir/Reports_per_Sample
mkdir -p $output_dir/Reports
fi
mkdir -p $output_dir/numbers
echo `date`
fi