diff falco-call.sh @ 39:a793ffd0cd04 draft

Uploaded
author stef
date Tue, 23 Dec 2014 11:26:33 -0500
parents f1b32c09deaf
children b4e2b4efae61
line wrap: on
line diff
--- a/falco-call.sh	Fri Oct 10 11:28:57 2014 -0400
+++ b/falco-call.sh	Tue Dec 23 11:26:33 2014 -0500
@@ -1,7 +1,7 @@
 #!/bin/bash
 TOOLDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 
-echo "Start falco sh"
+echo "Started FALCO calling"
 
 ## ----------
 ## Variables setup
@@ -13,105 +13,51 @@
 ## ----------
 ## Create extra init script
 ## ----------
-if [ $design_file != 'None' ] # Galaxy default is "None"
+if [[ $filter_file != 'None' && $filter_file != '' ]] # Galaxy default somehow is "None"
 then 
-	BED_PATH=$design_file
+	FILTER_PARAM=" --filter "$filter_file
 else
-	BED_PATH="$TOOLDIR/tool-data/GALAXY_TSACP.bed"
-fi
-
-if [ $manifest_file != 'None' ] # Galaxy default is "None"
-then 
-	MAN_PATH=$manifest_file
-else
-	MAN_PATH="$TOOLDIR/tool-data/GALAXY_TruSeq_Amplicon_Cancer_Panel_Manifest_AFP1_PN15032433.txt"	
+	FILTER_PARAM=""
 fi
 
-echo "BED:"$design_file
-echo "MAN:"$manifest_file
-echo "BED chosen:"$BED_PATH
-echo "MAN chosen:"$MAN_PATH
-#echo "VARSCAN_PATH1:"$SNPEFF_JAR_PATH
-#echo "VARSCAN_PATH2:"\$SNPEFF_JAR_PATH
-
-init_file="galaxy_init.sh"
-echo '#!/bin/bash' > $init_file
-
-## executables
-#echo "snpEff=/ccagc/lib/snpEff/snpEff_v3_4" >> $init_file
-#echo "snpEff=\$SNPEFF_JAR_PATH/" >> $init_file
-#echo "snpSift=/ccagc/lib/SnpSift" >> $init_file
-#echo "snpSift=\$SNPEFF_JAR_PATH/" >> $init_file
-#echo "varscan=/ccagc/lib/VarScan/VarScan.v2.2.11.jar" >> $init_file
-#echo "varscan=\$JAVA_JAR_PATH/VarScan.v2.3.5.jar" >> $init_file
-echo "samtools=samtools" >> $init_file
-echo "bcftools=bcftools" >> $init_file
-
-## files
-echo "targetBed=$BED_PATH" >> $init_file
-echo "manifest=$MAN_PATH" >> $init_file
+if [[ $manifest_file != 'None' && $manifest_file != 'None' ]] # Galaxy default is "None"
+then 
+	MANIFEST_PARAM=" --manifest "$manifest_file
+else
+	MANIFEST_PARAM=""
+fi
 
 ## ----------
 ## Status / debug
 ## ----------
-echo "BAM: "$bam_file
-echo "OUT: "$bam_name
-echo "BAMBASE: "$bam_base
-#echo "OUTPATH: "$out_path
-#echo "HTMLOUT: "$html_out
-echo "VCFOUT : "$vcf_out
-echo "INIT   : "$init_file
-
-echo "------ sourcing init_file"
-source $init_file
-
-#echo "------ --- ------"
-#echo "------ sam ------"
-#echo "------ --- ------"
-#$samtools
-#echo "------ --- ------"
-#echo "------ bcf ------"
-#echo "------ --- ------"
-#$bcftools
-#echo "--- snpsift ---"
-#java -jar $snpSift/SnpSift.jar
-#echo "--- snpeff ---"
-#java -jar $snpEff/snpeff.jar
-#echo "--- varscan ---"
-#java -jar $varScan
-
-
-
+DEBUG=1
+if [ $DEBUG ]
+then
+	DBS="[INFO] "
+	echo $DBS"FILTER:  "$filter_file
+	echo $DBS"MANIFES: "$manifest_file
+	echo $DBS"REFFILE: "$REF_FILE
+	echo $DBS"DB_KEY:  "$DB_KEY
+	echo $DBS"REF_SRC: "$REF_SOURCE
+	echo $DBS"BAMFILE: "$bam_file
+	echo $DBS"BAMNAME: "$bam_name
+	echo $DBS"BAMBASE: "$bam_base
+	echo $DBS"OUTPATH: "$out_path
+fi
 
 ## ----------
 ## create output files dir
 ## ----------
 mkdir $out_path
-mkdir $out_path/$bam_base
 
 ## ----------
 ## running analysis
 ## ----------
-
-## DEBUG
-#exit 0
-echo "Starting VcAn"
-$TOOLDIR/falco/amplicon-VcAn-TSACP.sh $bam_file $bam_base
-echo "...done with VcAn"
-#$TOOLDIR/falco/amplicon-AlVcAn-TSACP.sh ## this contains more
-
-#echo "Starting amplicon-Report"
-#$TOOLDIR/falco/amplicon-Report.sh $bam_base
-
-#echo "Starting QC"
-#$TOOLDIR/falco/amplicon-QC.sh $bam_file
-
-#echo "Starting plots.R"
-#$TOOLDIR/falco/misc/plots.R $bam_base.qc.ann.txt $bam_base.qc.targets.txt $bam_base.pdf
-
-#echo "Starting mkHtmlReport"
-#$TOOLDIR/falco/misc/mkHtmlReport.pl ./ ./
-
+echo "Starting variant calling"
+CALL_STRING="$TOOLDIR/falco/bin/falco --bam $bam_file --output $bam_base --ref $REF_FILE $FILTER_PARAM $MANIFEST_PARAM"
+echo "[INFO] "$CALL_STRING
+perl $CALL_STRING
+echo "...done with variant calling"
 
 
 ## ----------
@@ -128,14 +74,15 @@
 echo "</head>" >> $html_out
 echo "<body>" >> $html_out
 echo "	<h1>FALCO</h1>" >> $html_out
-echo "	<a href=\"index.html\">HTML</a>" >> $html_out
+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
+#echo "	<a href=\"index.html\">HTML</a>" >> $html_out
 echo "	<table><tbody>" >> $html_out
-#for file in *.vcf *.txt *.tsv
-for file in *
+for file in *.vcf *.txt *stderr *stdout
+#for file in *
 do
 	lineCount=`wc -l $file | cut -f 1 -d " "`
 	echo "	<tr><td><a href=\"$file\">$file</a> has $lineCount lines</td></tr>" >> $html_out
-	#echo "  <tr><td> HEAD: " `head $file` "</td></tr>" >> $html_out
+	echo "  <tr><td> --> " `head -1 $file` "</td></tr>" >> $html_out
 done
 echo "	</tbody></table>" >> $html_out
 echo "</body>" >> $html_out
@@ -146,14 +93,14 @@
 ## ----------
 #cp 'index.html' $html_out # this is the overview of samples html
 #cp $bam_base'.html' $out_path/'out.html' # this is the sample html
-cp $bam_base'.vcf' $vcf_out
+cp $bam_base'.falco.vcf' $vcf_out
 
 ## ----------
 ## copy files to keep to output path
 ## ----------
 #cp -r ./$bam_base/*png $out_path/$bam_base/
 #cp -r ./* $out_path
-#cp *.vcf $out_path; cp *.tsv $out_path; cp *.txt $out_path; cp *.html $out_path
+cp *.vcf $out_path; cp *.txt $out_path; cp *_std* $out_path
 
 ## ----------
 echo "END falco sh"