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