comparison wrapper.sh @ 120:613278c1bde0 draft

Uploaded
author davidvanzessen
date Tue, 16 Aug 2016 09:10:50 -0400
parents 626a956f3811
children 31cca6d3722a
comparison
equal deleted inserted replaced
119:626a956f3811 120:613278c1bde0
43 cat `find $PWD/files/ -name "6_*"` > $PWD/junction.txt 43 cat `find $PWD/files/ -name "6_*"` > $PWD/junction.txt
44 cat `find $PWD/files/ -name "7_*"` > $PWD/mutationanalysis.txt 44 cat `find $PWD/files/ -name "7_*"` > $PWD/mutationanalysis.txt
45 cat `find $PWD/files/ -name "8_*"` > $PWD/mutationstats.txt 45 cat `find $PWD/files/ -name "8_*"` > $PWD/mutationstats.txt
46 cat `find $PWD/files/ -name "10_*"` > $PWD/hotspots.txt 46 cat `find $PWD/files/ -name "10_*"` > $PWD/hotspots.txt
47 47
48 #cat $PWD/files/*/1_* > $PWD/summary.txt
49 #cat $PWD/files/*/3_* > $PWD/sequences.txt
50 #cat $PWD/files/*/5_* > $PWD/aa.txt
51 #cat $PWD/files/*/6_* > $PWD/junction.txt
52 #cat $PWD/files/*/7_* > $PWD/mutationanalysis.txt
53 #cat $PWD/files/*/8_* > $PWD/mutationstats.txt
54 #cat $PWD/files/*/10_* > $PWD/hotspots.txt
55
56 if [[ ${#BLASTN_DIR} -ge 5 ]] ; then 48 if [[ ${#BLASTN_DIR} -ge 5 ]] ; then
57 echo "On server, using BLASTN_DIR env: ${BLASTN_DIR}" 49 echo "On server, using BLASTN_DIR env: ${BLASTN_DIR}"
58 else 50 else
59 BLASTN_DIR="/home/galaxy/Downloads/ncbi-blast-2.4.0+/bin" 51 BLASTN_DIR="/home/galaxy/Downloads/ncbi-blast-2.4.0+/bin"
60 echo "Dev Galaxy set BLASTN_DIR to: ${BLASTN_DIR}" 52 echo "Dev Galaxy set BLASTN_DIR to: ${BLASTN_DIR}"
64 echo "---------------- identification ($method) ----------------<br />" >> $log 56 echo "---------------- identification ($method) ----------------<br />" >> $log
65 57
66 if [[ "${method}" == "custom" ]] ; then 58 if [[ "${method}" == "custom" ]] ; then
67 python $dir/gene_identification.py --input $PWD/summary.txt --output $outdir/identified_genes.txt 59 python $dir/gene_identification.py --input $PWD/summary.txt --output $outdir/identified_genes.txt
68 else 60 else
69 #ID_index=$(cat $PWD/summary.txt | grep -o -P ".+Sequence ID" | grep -o -P "\t" | wc -l)
70 #ID_index=$((ID_index+1))
71 #sequence_index=$(cat $PWD/summary.txt | grep -o -P ".+\tSequence" | grep -o -P "\t" | wc -l)
72 #sequence_index=$((sequence_index+1))
73
74 #echo "${ID_index}, ${sequence_index}"
75
76 #cat $PWD/summary.txt | tail -n+2 | cut -f ${ID_index},${sequence_index} | awk '{print ">" $1 "\n" $2}' > $PWD/sequences.tmp
77 #cat $PWD/summary.txt | tail -n+2 | awk -v id="${ID_index}" -v seq="${sequence_index}" 'BEGIN{FS="\t"} if(NF>10 && length($seq) > 0) {print ">" $id "\n" $seq} {}' > $PWD/sequences.fasta
78
79 #cat $PWD/sequences.tmp | grep -B1 -vE ">.*|^$" | grep -v "^\-\-$" > sequences.fasta #filter out empty sequences
80
81 echo "---------------- summary_to_fasta.py ----------------" 61 echo "---------------- summary_to_fasta.py ----------------"
82 echo "---------------- summary_to_fasta.py ----------------<br />" >> $log 62 echo "---------------- summary_to_fasta.py ----------------<br />" >> $log
83 63
84 python $dir/summary_to_fasta.py --input $PWD/summary.txt --fasta $PWD/sequences.fasta 64 python $dir/summary_to_fasta.py --input $PWD/summary.txt --fasta $PWD/sequences.fasta
85
86 #rm $PWD/sequences.tmp
87 65
88 echo -e "qseqid\tsseqid\tpident\tlength\tmismatch\tgapopen\tqstart\tqend\tsstart\tsend\tevalue\tbitscore" > $outdir/identified_genes.txt 66 echo -e "qseqid\tsseqid\tpident\tlength\tmismatch\tgapopen\tqstart\tqend\tsstart\tsend\tevalue\tbitscore" > $outdir/identified_genes.txt
89 ${BLASTN_DIR}/blastn -task blastn -db $dir/subclass_definition.db -query $PWD/sequences.fasta -outfmt 6 >> $outdir/identified_genes.txt 67 ${BLASTN_DIR}/blastn -task blastn -db $dir/subclass_definition.db -query $PWD/sequences.fasta -outfmt 6 >> $outdir/identified_genes.txt
90 fi 68 fi
91 69
395 echo "<tr><td>Baseline ca data</td><td><a href='baseline_ca.txt'>Download</a></td></tr>" >> $output 373 echo "<tr><td>Baseline ca data</td><td><a href='baseline_ca.txt'>Download</a></td></tr>" >> $output
396 echo "<tr><td>Baseline cg PDF</td><td><a href='baseline_cg.pdf'>Download</a></td></tr>" >> $output 374 echo "<tr><td>Baseline cg PDF</td><td><a href='baseline_cg.pdf'>Download</a></td></tr>" >> $output
397 echo "<tr><td>Baseline cg data</td><td><a href='baseline_cg.txt'>Download</a></td></tr>" >> $output 375 echo "<tr><td>Baseline cg data</td><td><a href='baseline_cg.txt'>Download</a></td></tr>" >> $output
398 echo "<tr><td>Baseline cm PDF</td><td><a href='baseline_cm.pdf'>Download</a></td></tr>" >> $output 376 echo "<tr><td>Baseline cm PDF</td><td><a href='baseline_cm.pdf'>Download</a></td></tr>" >> $output
399 echo "<tr><td>Baseline cm data</td><td><a href='baseline_cm.txt'>Download</a></td></tr>" >> $output 377 echo "<tr><td>Baseline cm data</td><td><a href='baseline_cm.txt'>Download</a></td></tr>" >> $output
400 #echo "<tr><td></td><td><a href='IgAT.zip'>IgAT zip</a></td></tr>" >> $output
401 #echo "<tr><td></td><td><a href='IgAT_ca.zip'>IgAT ca zip</a></td></tr>" >> $output
402 #echo "<tr><td></td><td><a href='IgAT_cg.zip'>IgAT cg zip</a></td></tr>" >> $output
403 #echo "<tr><td></td><td><a href='IgAT_cm.zip'>IgAT cm zip</a></td></tr>" >> $output
404 echo "<tr><td>An IMGT archive with just the matched and filtered sequences</td><td><a href='new_IMGT.txz'>Download</a></td></tr>" >> $output 378 echo "<tr><td>An IMGT archive with just the matched and filtered sequences</td><td><a href='new_IMGT.txz'>Download</a></td></tr>" >> $output
405 echo "<tr><td>An IMGT archive with just the matched and filtered ca sequences</td><td><a href='new_IMGT_ca.txz'>Download</a></td></tr>" >> $output 379 echo "<tr><td>An IMGT archive with just the matched and filtered ca sequences</td><td><a href='new_IMGT_ca.txz'>Download</a></td></tr>" >> $output
406 echo "<tr><td>An IMGT archive with just the matched and filtered ca1 sequences</td><td><a href='new_IMGT_ca1.txz'>Download</a></td></tr>" >> $output 380 echo "<tr><td>An IMGT archive with just the matched and filtered ca1 sequences</td><td><a href='new_IMGT_ca1.txz'>Download</a></td></tr>" >> $output
407 echo "<tr><td>An IMGT archive with just the matched and filtered ca2 sequences</td><td><a href='new_IMGT_ca2.txz'>Download</a></td></tr>" >> $output 381 echo "<tr><td>An IMGT archive with just the matched and filtered ca2 sequences</td><td><a href='new_IMGT_ca2.txz'>Download</a></td></tr>" >> $output
408 echo "<tr><td>An IMGT archive with just the matched and filtered cg sequences</td><td><a href='new_IMGT_cg.txz'>Download</a></td></tr>" >> $output 382 echo "<tr><td>An IMGT archive with just the matched and filtered cg sequences</td><td><a href='new_IMGT_cg.txz'>Download</a></td></tr>" >> $output
409 echo "<tr><td>An IMGT archive with just the matched and filtered cg1 sequences</td><td><a href='new_IMGT_cg1.txz'>Download</a></td></tr>" >> $output 383 echo "<tr><td>An IMGT archive with just the matched and filtered cg1 sequences</td><td><a href='new_IMGT_cg1.txz'>Download</a></td></tr>" >> $output
410 echo "<tr><td>An IMGT archive with just the matched and filtered cg2 sequences</td><td><a href='new_IMGT_cg2.txz'>Download</a></td></tr>" >> $output 384 echo "<tr><td>An IMGT archive with just the matched and filtered cg2 sequences</td><td><a href='new_IMGT_cg2.txz'>Download</a></td></tr>" >> $output
411 echo "<tr><td>An IMGT archive with just the matched and filtered cg3 sequences</td><td><a href='new_IMGT_cg3.txz'>Download</a></td></tr>" >> $output 385 echo "<tr><td>An IMGT archive with just the matched and filtered cg3 sequences</td><td><a href='new_IMGT_cg3.txz'>Download</a></td></tr>" >> $output
412 echo "<tr><td>An IMGT archive with just the matched and filtered cg4 sequences</td><td><a href='new_IMGT_cg4.txz'>Download</a></td></tr>" >> $output 386 echo "<tr><td>An IMGT archive with just the matched and filtered cg4 sequences</td><td><a href='new_IMGT_cg4.txz'>Download</a></td></tr>" >> $output
413 echo "<tr><td>An IMGT archive with just the matched and filtered cm sequences</td><td><a href='new_IMGT_cm.txz'>Download</a></td></tr>" >> $output 387 echo "<tr><td>An IMGT archive with just the matched and filtered cm sequences</td><td><a href='new_IMGT_cm.txz'>Download</a></td></tr>" >> $output
388 echo "<tr><td>The Change-O DB file with defined clones</td><td><a href='change_o/change-o-db-defined_clones.txt'>Download</a></td></tr>" >> $output
389 echo "<tr><td>The Change-O DB defined clones summary file</td><td><a href='change_o/change-o-defined_clones-summary.txt'>Download</a></td></tr>" >> $output
414 echo "</table>" >> $output 390 echo "</table>" >> $output
415 391
416 echo "</div>" >> $output #downloads tab end 392 echo "</div>" >> $output #downloads tab end
417 393
418 echo "</div>" >> $output #tabs end 394 echo "</div>" >> $output #tabs end
463 echo "---------------- naive_output.r ----------------" 439 echo "---------------- naive_output.r ----------------"
464 echo "---------------- naive_output.r ----------------<br />" >> $log 440 echo "---------------- naive_output.r ----------------<br />" >> $log
465 441
466 if [[ "$naive_output" != "None" ]] 442 if [[ "$naive_output" != "None" ]]
467 then 443 then
468 #echo "---------------- imgt_loader.r ----------------"
469 #echo "---------------- imgt_loader.r ----------------<br />" >> $log
470 #python $dir/imgt_loader.py --summ $PWD/summary.txt --aa $PWD/aa.txt --junction $PWD/junction.txt --output $naive_output
471 #Rscript --verbose $dir/imgt_loader.r $PWD/summary.txt $PWD/aa.txt $PWD/junction.txt $outdir/loader_output.txt 2>&1
472
473 #echo "---------------- naive_output.r ----------------"
474 #echo "---------------- naive_output.r ----------------<br />" >> $log
475 #Rscript $dir/naive_output.r $outdir/loader_output.txt $outdir/merged.txt ${naive_output_ca} ${naive_output_cg} ${naive_output_cm} $outdir/ntoverview.txt $outdir/ntsum.txt 2>&1
476
477 cp $outdir/new_IMGT_ca.txz ${naive_output_ca} 444 cp $outdir/new_IMGT_ca.txz ${naive_output_ca}
478 cp $outdir/new_IMGT_cg.txz ${naive_output_cg} 445 cp $outdir/new_IMGT_cg.txz ${naive_output_cg}
479 cp $outdir/new_IMGT_cm.txz ${naive_output_cm} 446 cp $outdir/new_IMGT_cm.txz ${naive_output_cm}
480 fi 447 fi
481 448
482 echo "</table>" >> $outdir/base_overview.html 449 echo "</table>" >> $outdir/base_overview.html
450
451 echo "---------------- change-o MakeDB ----------------"
452 echo "---------------- change-o MakeDB ----------------<br />" >> $log
453
454 mkdir $outdir/change_o
455
456 tmp="$PWD"
457
458 cd $outdir/change_o
459
460 bash $dir/change_o/makedb.sh $input false false false $outdir/change_o/change-o-db.txt
461
462 echo "---------------- change-o DefineClones ----------------"
463 echo "---------------- change-o DefineClones ----------------<br />" >> $log
464
465 bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones.txt $outdir/change_o/change-o-defined_clones-summary.txt
466
467 PWD="$tmp"
483 468
484 mv $log $outdir/log.html 469 mv $log $outdir/log.html
485 470
486 echo "<html><center><h1><a href='index.html'>Click here for the results</a></h1>Tip: Open it in a new tab (middle mouse button or right mouse button -> 'open in new tab' on the link above)<br />" > $log 471 echo "<html><center><h1><a href='index.html'>Click here for the results</a></h1>Tip: Open it in a new tab (middle mouse button or right mouse button -> 'open in new tab' on the link above)<br />" > $log
487 echo "<table border = 1>" >> $log 472 echo "<table border = 1>" >> $log