diff wrapper.sh @ 19:c518cf0d4adb draft

Uploaded
author davidvanzessen
date Wed, 01 Apr 2015 05:09:59 -0400
parents 2bb24ebbbc38
children 850857bc8605
line wrap: on
line diff
--- a/wrapper.sh	Mon Mar 30 07:58:36 2015 -0400
+++ b/wrapper.sh	Wed Apr 01 05:09:59 2015 -0400
@@ -2,9 +2,10 @@
 set -e
 dir="$(cd "$(dirname "$0")" && pwd)"
 input=$1
-output=$2
-outdir=$3
-title=$4
+method=$2
+output=$3
+outdir=$4
+title=$5
 mkdir $outdir
 
 unzip $input -d $PWD/files/ > $PWD/unziplog.log
@@ -13,13 +14,35 @@
 cat $PWD/files/*/8_* > $PWD/mutationstats.txt
 cat $PWD/files/*/10_* > $PWD/hotspots.txt
 
-echo "${BLASTN}"
+BLASTN_DIR="/home/galaxy/tmp/blast/ncbi-blast-2.2.30+/bin"
+
+echo "${BLASTN_DIR}"
+
+
 
 
-echo "identification"
-python $dir/gene_identification.py --input $PWD/summary.txt --output $outdir/annotatedsummary.txt
+echo "identification ($method)"
+
+if [[ "${method}" == "custom" ]] ; then
+	python $dir/gene_identification.py --input $PWD/summary.txt --output $outdir/identified_genes.txt
+else
+	ID_index=$(cat $PWD/summary.txt | grep -o -P ".+Sequence ID" | grep -o -P "\t" | wc -l)
+	ID_index=$((ID_index+1))
+	sequence_index=$(cat $PWD/summary.txt | grep -o -P ".+\tSequence" | grep -o -P "\t" | wc -l)
+	sequence_index=$((sequence_index+1))
+	
+	echo "$ID_index ${sequence_index}"
+	
+	cat $PWD/summary.txt | tail -n+2 | cut -f ${ID_index},${sequence_index} | awk '{print ">" $1 "\n" $2}' > $PWD/sequences.fasta
+	
+	echo -e "qseqid\tsseqid\tpident\tlength\tmismatch\tgapopen\tqstart\tqend\tsstart\tsend\tevalue\tbitscore" > $outdir/identified_genes.txt
+	${BLASTN_DIR}/blastn -task blastn -db $dir/subclass_definition.db -query $PWD/sequences.fasta -outfmt 6 >> $outdir/identified_genes.txt
+fi
+
+
+
 echo "merging"
-Rscript $dir/merge_and_filter.r $outdir/annotatedsummary.txt $PWD/mutationanalysis.txt $PWD/mutationstats.txt $PWD/hotspots.txt $outdir/merged.txt $outdir/unmatched.txt
+Rscript $dir/merge_and_filter.r $PWD/summary.txt $PWD/mutationanalysis.txt $PWD/mutationstats.txt $PWD/hotspots.txt $outdir/identified_genes.txt $outdir/merged.txt $outdir/unmatched.txt $method
 
 genes="ca,ca1,ca2,cg,cg1,cg2,cg3,cg4,cm"
 echo "R mutation analysis"