25
|
1 #!/bin/bash
|
|
2 TOOLDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
3
|
39
|
4 echo "Started FALCO calling"
|
25
|
5
|
|
6 ## ----------
|
|
7 ## Variables setup
|
|
8 ## ----------
|
|
9 source $1
|
|
10
|
|
11 bam_base=`echo $bam_name | sed 's#.bam$##' - `
|
|
12
|
|
13 ## ----------
|
|
14 ## Create extra init script
|
|
15 ## ----------
|
39
|
16 if [[ $filter_file != 'None' && $filter_file != '' ]] # Galaxy default somehow is "None"
|
25
|
17 then
|
39
|
18 FILTER_PARAM=" --filter "$filter_file
|
25
|
19 else
|
39
|
20 FILTER_PARAM=""
|
25
|
21 fi
|
|
22
|
39
|
23 if [[ $manifest_file != 'None' && $manifest_file != 'None' ]] # Galaxy default is "None"
|
|
24 then
|
|
25 MANIFEST_PARAM=" --manifest "$manifest_file
|
|
26 else
|
|
27 MANIFEST_PARAM=""
|
|
28 fi
|
25
|
29
|
|
30 ## ----------
|
|
31 ## Status / debug
|
|
32 ## ----------
|
39
|
33 DEBUG=1
|
|
34 if [ $DEBUG ]
|
|
35 then
|
|
36 DBS="[INFO] "
|
|
37 echo $DBS"FILTER: "$filter_file
|
|
38 echo $DBS"MANIFES: "$manifest_file
|
|
39 echo $DBS"REFFILE: "$REF_FILE
|
|
40 echo $DBS"DB_KEY: "$DB_KEY
|
|
41 echo $DBS"REF_SRC: "$REF_SOURCE
|
|
42 echo $DBS"BAMFILE: "$bam_file
|
|
43 echo $DBS"BAMNAME: "$bam_name
|
|
44 echo $DBS"BAMBASE: "$bam_base
|
|
45 echo $DBS"OUTPATH: "$out_path
|
|
46 fi
|
25
|
47
|
|
48 ## ----------
|
|
49 ## create output files dir
|
|
50 ## ----------
|
38
|
51 mkdir $out_path
|
25
|
52
|
|
53 ## ----------
|
|
54 ## running analysis
|
|
55 ## ----------
|
39
|
56 echo "Starting variant calling"
|
|
57 CALL_STRING="$TOOLDIR/falco/bin/falco --bam $bam_file --output $bam_base --ref $REF_FILE $FILTER_PARAM $MANIFEST_PARAM"
|
|
58 echo "[INFO] "$CALL_STRING
|
|
59 perl $CALL_STRING
|
|
60 echo "...done with variant calling"
|
25
|
61
|
|
62
|
|
63 ## ----------
|
|
64 ## create index html for main galaxy output
|
|
65 ## ----------
|
38
|
66 echo "<!DOCTYPE html>" >> $html_out
|
|
67 echo "<html>" >> $html_out
|
|
68 echo "<head>" >> $html_out
|
|
69 echo "<style>" >> $html_out
|
|
70 echo " body{ padding: 0px 20px; }" >> $html_out
|
|
71 echo " h1{ color: red; }" >> $html_out
|
|
72 echo " table{ border: 1px solid black; padding: 5px }" >> $html_out
|
|
73 echo "</style>" >> $html_out
|
|
74 echo "</head>" >> $html_out
|
|
75 echo "<body>" >> $html_out
|
|
76 echo " <h1>FALCO</h1>" >> $html_out
|
39
|
77 echo " <p>This page is way to get output files that are not implemented in galaxy history, it is not intended to be a user-friendly way of displaying anything ;)</p>" >> $html_out
|
|
78 #echo " <a href=\"index.html\">HTML</a>" >> $html_out
|
38
|
79 echo " <table><tbody>" >> $html_out
|
39
|
80 for file in *.vcf *.txt *stderr *stdout
|
|
81 #for file in *
|
38
|
82 do
|
|
83 lineCount=`wc -l $file | cut -f 1 -d " "`
|
|
84 echo " <tr><td><a href=\"$file\">$file</a> has $lineCount lines</td></tr>" >> $html_out
|
39
|
85 echo " <tr><td> --> " `head -1 $file` "</td></tr>" >> $html_out
|
38
|
86 done
|
|
87 echo " </tbody></table>" >> $html_out
|
|
88 echo "</body>" >> $html_out
|
|
89 echo "</html>" >> $html_out
|
25
|
90
|
|
91 ## ----------
|
|
92 ## creating galaxy history outputs
|
|
93 ## ----------
|
|
94 #cp 'index.html' $html_out # this is the overview of samples html
|
|
95 #cp $bam_base'.html' $out_path/'out.html' # this is the sample html
|
39
|
96 cp $bam_base'.falco.vcf' $vcf_out
|
25
|
97
|
|
98 ## ----------
|
|
99 ## copy files to keep to output path
|
|
100 ## ----------
|
|
101 #cp -r ./$bam_base/*png $out_path/$bam_base/
|
|
102 #cp -r ./* $out_path
|
39
|
103 cp *.vcf $out_path; cp *.txt $out_path; cp *_std* $out_path
|
25
|
104
|
|
105 ## ----------
|
|
106 echo "END falco sh"
|
|
107 exit 0 |