|
2
|
1 #!/bin/bash
|
|
|
2 TOOLDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
3
|
|
|
4 echo "Start falco sh"
|
|
|
5
|
|
|
6 ## ----------
|
|
|
7 ## Variables setup
|
|
|
8 ## ----------
|
|
|
9 #bam_file=$1
|
|
|
10 #bam_name=$2
|
|
|
11 #html_out=$3
|
|
|
12 #vcf_out=$4
|
|
|
13 #out_path=$5
|
|
|
14 source $1
|
|
|
15
|
|
|
16 bam_base=`echo $bam_name | sed 's#.bam$##' - `
|
|
|
17
|
|
|
18 ## ----------
|
|
|
19 ## Create extra init script
|
|
|
20 ## ----------
|
|
|
21 #if [ $design_file != 'None' && $design_file != '' ]; then BED_PATH=$design_file; fi
|
|
|
22 #if [ $manifest_file != 'None' && $manifest_file != '' ]; then MAN_PATH=$manifest_file; fi
|
|
|
23 if [ $design_file != 'None' ] # Galaxy default is "None"
|
|
|
24 then
|
|
|
25 BED_PATH=$design_file
|
|
|
26 else
|
|
|
27 BED_PATH="$TOOLDIR/tool-data/GALAXY_TSACP.bed"
|
|
|
28 fi
|
|
|
29
|
|
|
30 if [ $manifest_file != 'None' ] # Galaxy default is "None"
|
|
|
31 then
|
|
|
32 MAN_PATH=$manifest_file
|
|
|
33 else
|
|
|
34 MAN_PATH="$TOOLDIR/tool-data/GALAXY_TruSeq_Amplicon_Cancer_Panel_Manifest_AFP1_PN15032433.txt"
|
|
|
35 fi
|
|
|
36
|
|
|
37 echo "BED:"$design_file
|
|
|
38 echo "MAN:"$manifest_file
|
|
|
39 echo "BED chosen:"$BED_PATH
|
|
|
40 echo "MAN chosen:"$MAN_PATH
|
|
|
41
|
|
|
42 init_file="galaxy_init.sh"
|
|
|
43 echo '#!/bin/bash' > $init_file
|
|
|
44
|
|
|
45 ## executables
|
|
|
46 #echo "snpEff=/ccagc/lib/snpEff/snpEff_v3_4" >> $init_file
|
|
|
47 echo "snpEff=$SNPEFF_JAR_PATH/" >> $init_file
|
|
|
48 #echo "snpSift=/ccagc/lib/SnpSift" >> $init_file
|
|
|
49 echo "snpSift=$SNPEFF_JAR_PATH/" >> $init_file
|
|
|
50 #echo "varscan=/ccagc/lib/VarScan/VarScan.v2.2.11.jar" >> $init_file
|
|
|
51 echo "varscan=$JAVA_JAR_PATH/VarScan.v2.3.5.jar" >> $init_file
|
|
|
52
|
|
|
53 ## files
|
|
|
54 echo "targetBed=$BED_PATH" >> $init_file
|
|
|
55 echo "manifest=$MAN_PATH" >> $init_file
|
|
|
56
|
|
|
57 ## ----------
|
|
|
58 ## Status / debug
|
|
|
59 ## ----------
|
|
|
60 echo "BAM: "$bam_file
|
|
|
61 echo "OUT: "$bam_name
|
|
|
62 echo "BAMBASE: "$bam_base
|
|
|
63 echo "OUTPATH: "$out_path
|
|
|
64 echo "HTMLOUT: "$html_out
|
|
|
65 echo "VCFOUT : "$vcf_out
|
|
|
66 echo "INIT : "$init_file
|
|
|
67
|
|
|
68 ## ----------
|
|
|
69 ## create output files dir
|
|
|
70 ## ----------
|
|
|
71 mkdir $out_path
|
|
|
72 mkdir $out_path/$bam_base
|
|
|
73
|
|
|
74 ## ----------
|
|
|
75 ## running analysis
|
|
|
76 ## ----------
|
|
|
77 echo "Starting VcAn"
|
|
3
|
78 $TOOLDIR/falco/amplicon-VcAn-TSACP.sh $bam_file $bam_base
|
|
2
|
79 #$TOOLDIR/falco/amplicon-AlVcAn-TSACP.sh ## this contains more
|
|
|
80
|
|
|
81 echo "Starting amplicon-Report"
|
|
3
|
82 $TOOLDIR/falco/amplicon-Report.sh $bam_base
|
|
2
|
83
|
|
|
84 echo "Starting QC"
|
|
3
|
85 $TOOLDIR/falco/amplicon-QC.sh $bam_file
|
|
2
|
86
|
|
|
87 #echo "Starting plots.R"
|
|
|
88 #$TOOLDIR/falco/misc/plots.R $bam_base.qc.ann.txt $bam_base.qc.targets.txt $bam_base.pdf
|
|
|
89
|
|
|
90 echo "Starting mkHtmlReport"
|
|
3
|
91 $TOOLDIR/falco/misc/mkHtmlReport.pl ./ ./
|
|
2
|
92
|
|
|
93
|
|
|
94
|
|
|
95 ## ----------
|
|
|
96 ## create index html for main galaxy output
|
|
|
97 ## ----------
|
|
|
98 echo "<!DOCTYPE html>" >> $html_out
|
|
|
99 echo "<html>" >> $html_out
|
|
|
100 echo "<head>" >> $html_out
|
|
|
101 echo "<style>" >> $html_out
|
|
|
102 echo " body{ padding: 0px 20px; }" >> $html_out
|
|
|
103 echo " h1{ color: red; }" >> $html_out
|
|
|
104 echo " table{ border: 1px solid black; padding: 5px }" >> $html_out
|
|
|
105 echo "</style>" >> $html_out
|
|
|
106 echo "</head>" >> $html_out
|
|
|
107 echo "<body>" >> $html_out
|
|
|
108 echo " <h1>FALCO</h1>" >> $html_out
|
|
|
109 echo " <a href=\"index.html\">HTML</a>" >> $html_out
|
|
|
110 echo " <table><tbody>" >> $html_out
|
|
|
111 #for file in *.vcf *.txt *.tsv
|
|
|
112 for file in *
|
|
|
113 do
|
|
|
114 lineCount=`wc -l $file | cut -f 1 -d " "`
|
|
|
115 echo " <tr><td><a href=\"$file\">$file</a> has $lineCount lines</td></tr>" >> $html_out
|
|
|
116 #echo " <tr><td> HEAD: " `head $file` "</td></tr>" >> $html_out
|
|
|
117 done
|
|
|
118 echo " </tbody></table>" >> $html_out
|
|
|
119 echo "</body>" >> $html_out
|
|
|
120 echo "</html>" >> $html_out
|
|
|
121
|
|
|
122 ## ----------
|
|
|
123 ## creating galaxy history outputs
|
|
|
124 ## ----------
|
|
|
125 #cp 'index.html' $html_out # this is the overview of samples html
|
|
|
126 cp $bam_base'.html' $out_path/'out.html' # this is the sample html
|
|
|
127 cp $bam_base'.vcf' $vcf_out
|
|
|
128
|
|
|
129 ## ----------
|
|
|
130 ## copy files to keep to output path
|
|
|
131 ## ----------
|
|
|
132 cp -r ./$bam_base/*png $out_path/$bam_base/
|
|
|
133 cp -r ./* $out_path
|
|
|
134 #cp *.vcf $out_path; cp *.tsv $out_path; cp *.txt $out_path; cp *.html $out_path
|
|
|
135
|
|
|
136 ## ----------
|
|
|
137 echo "END falco sh"
|
|
|
138 exit 0 |