-
Notifications
You must be signed in to change notification settings - Fork 1
/
seqimp2html
executable file
·133 lines (122 loc) · 3.22 KB
/
seqimp2html
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
# Tommaso Leonardi, 2013
#
# 05/08/13 - v0.1
# Make a folder with all QC plots from seqimp and an index.html file with links
# Check proper number of arguments
if [ ! $# == 3 ]
then
echo "
Usage: make_html_dir.sh analysis_folder description.txt output_dir
analysis folder: path to the analysis folder created by SequenceImp
description.txt: description file submitted to SequenceImp
output_dir: path to the directory where to save output
"
exit
fi
# Check if the analysis directory exists
if [ ! -d $1 ]
then
echo "$1: doesn't exist or is not a directory"
echo "Please provide a valid path to the analysis directory"
exit 1
fi
ANALYSIS_DIR=$1
# Check if the description file exists
if [ ! -f $2 ]
then
echo "$2: No such file"
echo "Please provide a valid description file"
exit 1
fi
DESCRIPTION_FILE=$2
#Load file names in array
FILES=($(awk 'NR>1{printf("%s ",$1)}' $DESCRIPTION_FILE ))
# Check that result dirs exist
for i in "${FILES[@]}"; do
if [ ! -d $ANALYSIS_DIR/$i ]
then
echo "$ANALYSIS_DIR: No such directory"
echo "Please make sure that all files described in $2 have a corresponding results directory"
exit 1
fi
done;
# Check that OUTDIR doesn't exist
if [ -d $3 ]
then
echo "$3: directory already exists"
exit 1
fi
OUTDIR=$3
mkdir $OUTDIR
# Initialise HTML file
echo -e "<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
</head>
<p style=\"text-align: center;font-size: 22px;\">Seqimp QC</p>
<br>
<table id=\"tab\">
<thead>
<th>Sample name</th>
<th>Reaper</th>
<th>Processed</th>
<th>Bowtie</th>
</thead>
<tbody>
" > $OUTDIR/index.html
for a in $(seq 0 $(expr ${#FILES[@]} - 1)); do
i=${FILES[a]}
mkdir $OUTDIR/$i
cp $ANALYSIS_DIR/$i/QC/${i}_Reaper_qc.pdf $OUTDIR/$i
cp $ANALYSIS_DIR/$i/QC/${i}_Processed_reads_qc.pdf $OUTDIR/$i
cp $ANALYSIS_DIR/$i/QC/${i}_Bowtie_qc.pdf $OUTDIR/$i
echo -e "<tr>" >> $OUTDIR/index.html
echo -e "<td>$i</td>" >> $OUTDIR/index.html
echo -e "<td><a href=\"$i/${i}_Reaper_qc.pdf\" target=\"_blank\">Reaper</a></td>" >> $OUTDIR/index.html
echo -e "<td><a href=\"$i/${i}_Processed_reads_qc.pdf\" target=\"_blank\">Processed</a></td>" >> $OUTDIR/index.html
echo -e "<td><a href=\"$i/${i}_Bowtie_qc.pdf\" target=\"_blank\">Bowtie</a></td>" >> $OUTDIR/index.html
echo -e "</tr>" >> $OUTDIR/index.html
done;
echo -e "</tbody></table></html>" >> $OUTDIR/index.html
# Make style file
echo -e "<style type=\"text/css\">
#tab {
background-color: whiteSmoke;
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
margin-left: auto;
margin-right: auto;
}
#tab th {
color: #333;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 16px;
font-style: normal;
font-weight: normal;
text-align: left;
padding: 0 20px;
}
#tab td {
padding: 0 20px;
line-height: 20px;
color: #0084B4;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 14px;
border-bottom: 1px solid #fff;
border-top: 1px solid #fff;
}
#tab td:hover {
background-color: #fff;
}
p {
color: #333;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 16px;
font-style: normal;
font-weight: normal;
text-align: left;
}
</style>
" > $OUTDIR/style.css