Mercurial > repos > davidvanzessen > mutation_analysis
comparison wrapper.sh @ 19:c518cf0d4adb draft
Uploaded
| author | davidvanzessen | 
|---|---|
| date | Wed, 01 Apr 2015 05:09:59 -0400 | 
| parents | 2bb24ebbbc38 | 
| children | 850857bc8605 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 18:9dd557f17153 | 19:c518cf0d4adb | 
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash | 
| 2 set -e | 2 set -e | 
| 3 dir="$(cd "$(dirname "$0")" && pwd)" | 3 dir="$(cd "$(dirname "$0")" && pwd)" | 
| 4 input=$1 | 4 input=$1 | 
| 5 output=$2 | 5 method=$2 | 
| 6 outdir=$3 | 6 output=$3 | 
| 7 title=$4 | 7 outdir=$4 | 
| 8 title=$5 | |
| 8 mkdir $outdir | 9 mkdir $outdir | 
| 9 | 10 | 
| 10 unzip $input -d $PWD/files/ > $PWD/unziplog.log | 11 unzip $input -d $PWD/files/ > $PWD/unziplog.log | 
| 11 cat $PWD/files/*/1_* > $PWD/summary.txt | 12 cat $PWD/files/*/1_* > $PWD/summary.txt | 
| 12 cat $PWD/files/*/7_* > $PWD/mutationanalysis.txt | 13 cat $PWD/files/*/7_* > $PWD/mutationanalysis.txt | 
| 13 cat $PWD/files/*/8_* > $PWD/mutationstats.txt | 14 cat $PWD/files/*/8_* > $PWD/mutationstats.txt | 
| 14 cat $PWD/files/*/10_* > $PWD/hotspots.txt | 15 cat $PWD/files/*/10_* > $PWD/hotspots.txt | 
| 15 | 16 | 
| 16 echo "${BLASTN}" | 17 BLASTN_DIR="/home/galaxy/tmp/blast/ncbi-blast-2.2.30+/bin" | 
| 18 | |
| 19 echo "${BLASTN_DIR}" | |
| 17 | 20 | 
| 18 | 21 | 
| 19 echo "identification" | 22 | 
| 20 python $dir/gene_identification.py --input $PWD/summary.txt --output $outdir/annotatedsummary.txt | 23 | 
| 24 echo "identification ($method)" | |
| 25 | |
| 26 if [[ "${method}" == "custom" ]] ; then | |
| 27 python $dir/gene_identification.py --input $PWD/summary.txt --output $outdir/identified_genes.txt | |
| 28 else | |
| 29 ID_index=$(cat $PWD/summary.txt | grep -o -P ".+Sequence ID" | grep -o -P "\t" | wc -l) | |
| 30 ID_index=$((ID_index+1)) | |
| 31 sequence_index=$(cat $PWD/summary.txt | grep -o -P ".+\tSequence" | grep -o -P "\t" | wc -l) | |
| 32 sequence_index=$((sequence_index+1)) | |
| 33 | |
| 34 echo "$ID_index ${sequence_index}" | |
| 35 | |
| 36 cat $PWD/summary.txt | tail -n+2 | cut -f ${ID_index},${sequence_index} | awk '{print ">" $1 "\n" $2}' > $PWD/sequences.fasta | |
| 37 | |
| 38 echo -e "qseqid\tsseqid\tpident\tlength\tmismatch\tgapopen\tqstart\tqend\tsstart\tsend\tevalue\tbitscore" > $outdir/identified_genes.txt | |
| 39 ${BLASTN_DIR}/blastn -task blastn -db $dir/subclass_definition.db -query $PWD/sequences.fasta -outfmt 6 >> $outdir/identified_genes.txt | |
| 40 fi | |
| 41 | |
| 42 | |
| 43 | |
| 21 echo "merging" | 44 echo "merging" | 
| 22 Rscript $dir/merge_and_filter.r $outdir/annotatedsummary.txt $PWD/mutationanalysis.txt $PWD/mutationstats.txt $PWD/hotspots.txt $outdir/merged.txt $outdir/unmatched.txt | 45 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 | 
| 23 | 46 | 
| 24 genes="ca,ca1,ca2,cg,cg1,cg2,cg3,cg4,cm" | 47 genes="ca,ca1,ca2,cg,cg1,cg2,cg3,cg4,cm" | 
| 25 echo "R mutation analysis" | 48 echo "R mutation analysis" | 
| 26 Rscript $dir/mutation_analysis.r $outdir/merged.txt $genes $outdir 2>&1 | 49 Rscript $dir/mutation_analysis.r $outdir/merged.txt $genes $outdir 2>&1 | 
| 27 echo "python mutation analysis" | 50 echo "python mutation analysis" | 
