File: blastp_annot_cmd.sh

package info (click to toggle)
fasta3 36.3.8i.14-Nov-2020-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,008 kB
  • sloc: ansic: 77,269; perl: 10,677; python: 2,461; sh: 432; csh: 86; sql: 55; makefile: 37
file content (100 lines) | stat: -rwxr-xr-x 3,017 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash

################
## blastp_annot_cmd.sh --query=seq/gstm1_human.aa --ann_script=scripts/ann_pfam_sql.pl --q_ann_script=scripts/ann_pfam_sql.pl -db /slib2/bl_dbs/pfam34_qfo78
##
## blastp reseults and intermediate files are saved in the same location as the query file
## annotation scripts must fully qualified
## --html=0 produces domain annotations but no domain graphics
## --html=1 provides exon mapping (if available) and domain graphics
##

cmd="";
DO_HTML=1

PGM='blastp'

for i in "$@"
do
    case $i in
	-p=*|--pgm=*)
	    PGM="${i#*=}"
	    shift # past argument=value
	    ;;
	-o=*|--outname=*)
	    OUTNAME="${i#*=}"
	    shift # past argument=value
	    ;;
	-q=*|--query=*)
	    QUERY="${i#*=}"
	    cmd="$cmd -query $QUERY"
	    shift # past argument=value
	    ;;
	--ann_script=*)
	    ANN_SCRIPT="${i#*=}"
	    shift
	    ;;
	--q_ann_script=*)
	    Q_ANN_SCRIPT="${i#*=}"
	    shift
	    ;;
	--html=*)
	    DO_HTML="${i#*=}"
	    shift
	    ;;
	*)
	    cmd="$cmd $i"
	    ;;
    esac
done

# echo "OUTNAME: " $OUTNAME
# echo "CMD: " $cmd

if [[ $OUTNAME == '' ]]; then
    OUTNAME=${QUERY}_out
fi

#if [[ $ANN_SCRIPT == '' ]]; then
#    ANN_SCRIPT="/seqprg/bin/ann_pfam30.pl --db=pfam31_qfo --host=localhost --neg --vdoms --acc_comment"
#fi

# echo "OUTNAME2: " $OUTNAME

bl_asn="$OUTNAME.asn"
bl0_out="$OUTNAME.html"
bla_out="${OUTNAME}_ann.html"
blm_out="$OUTNAME.msa"
blt_out="$OUTNAME.bl_tab"
blt_ann="$OUTNAME.bl_tab_ann"
blr_out="$OUTNAME.bl_tab_rn"

# echo "tmp_files:"
# echo $bl_asn $bl0_out $blt_out

# echo "OUTFILE = ${OUTNAME}"

#export BLAST_PATH="/ebi/extserv/bin/ncbi-blast+/bin"
export BLAST_PATH="/seqprg/bin"

$BLAST_PATH/$PGM -num_threads=8 -outfmt 11 $cmd > $bl_asn
$BLAST_PATH/blast_formatter -archive $bl_asn -outfmt '7 qseqid qlen sseqid slen pident length mismatch gapopen qstart qend sstart send evalue bitscore score btop' > $blt_out

# annot_cmd="annot_blast_btop2.pl --query $QUERY --raw --have_qslen --dom_info --ann_script "$ANN_SCRIPT" --q_ann_script "$Q_ANN_SCRIPT" $blt_out > $blt_ann"
# echo "# $annot_cmd"
/usr/share/fasta3/scripts/annot_blast_btop2.pl --query $QUERY --raw --have_qslen --dom_info --ann_script "$ANN_SCRIPT" --q_ann_script "$Q_ANN_SCRIPT" $blt_out > $blt_ann

if [[ $DO_HTML == 1 ]]; then
    ## rename_exons.py --have_qslen --dom_info $blt_ann > $blr_out
    $BLAST_PATH/blast_formatter -archive $bl_asn -outfmt 0 -html > $bl0_out
    ## echo "# merge_blast_btab.pl --plot_url=plot_domain6t.cgi --have_qslen --dom_info --btab $blt_out $bl0_out"
    /usr/share/fasta3/scripts/merge_blast_btab.pl --plot_url="plot_domain6t.cgi" --have_qslen --dom_info --btab $blt_ann $bl0_out

else
    $BLAST_PATH/blast_formatter -archive $bl_asn -outfmt 0 > $bl0_out
    merge_cmd="merge_blast_btab.pl --have_qslen --dom_info --btab $blt_ann $bl0_out"
    # echo "# $merge_cmd"
    /usr/share/fasta3/scripts/merge_blast_btab.pl --have_qslen --dom_info --btab $blt_ann $bl0_out
fi

# $BLAST_PATH/blast_formatter -archive $bl_asn -outfmt 2  > $blm_out