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