80
|
1 #!/bin/bash
|
85
|
2
|
|
3 #TOOLDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
80
|
4
|
|
5 echo "Started FALCO calling"
|
|
6
|
|
7 ## ----------
|
|
8 ## Variables setup ($1 contains the bash config file path)
|
|
9 ## ----------
|
|
10 source $1
|
85
|
11 TOOLDIR=$2
|
80
|
12
|
|
13 ## ----------
|
|
14 ## make sure all is ok
|
|
15 ## ----------
|
|
16 #if [ ! -f $REF_FILE".fai" ]
|
|
17 #then
|
|
18 # echo "No FAI index (fai) found for reference fasta [$REF_FILE]"
|
|
19 # exit "No FAI index (fai) found for reference fasta [$REF_FILE]"
|
|
20 #fi
|
|
21
|
|
22 ## ----------
|
|
23 ## set params
|
|
24 ## ----------
|
|
25 if [[ $vcf2_file != 'None' && $vcf2_file != '' ]] # Galaxy default is "None" for some reason
|
|
26 then
|
|
27 VCF2_PARAM=" --vcfOther "$vcf2_file
|
|
28 else
|
|
29 VCF2_PARAM=""
|
|
30 fi
|
|
31
|
|
32 # if [[ $manifest_file != 'None' && $manifest_file != 'None' ]] # Galaxy default is "None" for some reason
|
|
33 # then
|
|
34 # MANIFEST_PARAM=" --manifest "$manifest_file
|
|
35 # else
|
|
36 # MANIFEST_PARAM=""
|
|
37 # fi
|
|
38
|
|
39 ## name of file in galaxy not always set so will use a user-set job_name instead
|
|
40 #bam_base=`echo $bam_name | sed 's#.bam$##' - `
|
|
41 vcf_base=$job_name
|
|
42 sample_html_file=$vcf_base'.html'
|
|
43
|
|
44 ## ----------
|
|
45 ## Status / debug
|
|
46 ## ----------
|
|
47 DEBUG=1
|
|
48 # if [ $DEBUG ]
|
|
49 # then
|
|
50 # DBS="[INFO] "
|
|
51 # echo $DBS"FILTER: "$filter_file
|
|
52 # echo $DBS"MANIFEST: "$manifest_file
|
|
53 # echo $DBS"REF FILE: "$REF_FILE
|
|
54 # echo $DBS"DB KEY: "$DB_KEY
|
|
55 # echo $DBS"REF SRC: "$REF_SOURCE
|
|
56 # echo $DBS"BAM FILE: "$bam_file
|
|
57 # echo $DBS"BAM NAME: "$bam_name
|
|
58 # echo $DBS"BAM BASE: "$bam_base
|
|
59 # echo $DBS"OUT PATH: "$out_path
|
|
60 # fi
|
|
61
|
|
62 ## ----------
|
|
63 ## create output files dir
|
|
64 ## ----------
|
|
65 mkdir $out_path
|
|
66
|
|
67 ## ----------
|
|
68 ## running analysis
|
|
69 ## ----------
|
|
70 echo "[INFO] Starting FALCO reporting"
|
|
71 CMD_STRING="$TOOLDIR/falco/bin/falco-filter-report --vcf $vcf_file --output $vcf_base --qc_ann_qual_txt $qc_ann_qual_file --qc2_ann_txt $qc2_ann_txt_file --qc_targets_txt $qc_targets_txt_file $VCF2_PARAM"
|
|
72 echo "[INFO] "$CMD_STRING
|
|
73 perl $CMD_STRING
|
|
74 echo "[INFO] done with FALCO reporting"
|
|
75
|
|
76
|
|
77 ## ----------
|
|
78 ## create index html for main galaxy output
|
|
79 ## ----------
|
|
80 echo "<!DOCTYPE html>" >> $html_out
|
|
81 echo "<html>" >> $html_out
|
|
82 echo "<head>" >> $html_out
|
|
83 echo "<style>" >> $html_out
|
|
84 echo " body{ padding: 0px 20px; }" >> $html_out
|
|
85 echo " h1{ color: red; }" >> $html_out
|
|
86 echo " table{ border: 1px solid black; padding: 5px }" >> $html_out
|
|
87 echo "</style>" >> $html_out
|
|
88 echo "</head>" >> $html_out
|
|
89 echo "<body>" >> $html_out
|
|
90 echo " <h1>FALCO</h1>" >> $html_out
|
|
91 echo " <a href=\"$sample_html_file\">RESULTS</a>" >> $html_out
|
|
92 #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
|
|
93 #echo " <a href=\"index.html\">HTML</a>" >> $html_out
|
|
94 #echo " <table><tbody>" >> $html_out
|
|
95 #for file in *.vcf *.txt *stderr *stdout
|
|
96 #for file in *
|
|
97 #do
|
|
98 # lineCount=`wc -l $file | cut -f 1 -d " "`
|
|
99 # echo " <tr><td><a href=\"$file\">$file</a> has $lineCount lines</td></tr>" >> $html_out
|
|
100 # echo " <tr><td> --> " `head -1 $file` "</td></tr>" >> $html_out
|
|
101 #done
|
|
102 #echo " </tbody></table>" >> $html_out
|
|
103 echo "</body>" >> $html_out
|
|
104 echo "</html>" >> $html_out
|
|
105
|
|
106 ## ----------
|
|
107 ## creating galaxy history outputs
|
|
108 ## ----------
|
|
109 #cp 'index.html' $html_out # this is the overview of samples html
|
|
110 cp $sample_html_file $out_path # this is the sample html
|
|
111 #cp $vcf_base'.html' $html_out # this is the sample html
|
|
112
|
|
113 ## ----------
|
|
114 ## copy files to keep to output path
|
|
115 ## ----------
|
|
116 #cp -r ./$bam_base/*png $out_path/$bam_base/
|
|
117 cp -r ./* $out_path
|
|
118 #cp *.vcf $out_path; cp *.txt $out_path; cp *_std* $out_path
|
|
119
|
|
120 ## ----------
|
|
121 echo "END falco sh"
|
|
122 exit 0
|