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