3_make_blast.sh 1.85 KB
Newer Older
mcariou's avatar
mcariou committed
1
2
#!/bin/bash

mcariou's avatar
mcariou committed
3
echo "USAGE: ./3_make_blast.sh \$1=blast_db \$2=gene_query \$3=out_path"
mcariou's avatar
mcariou committed
4
5
6
7
echo "--------------------------------------------------"

##################################################################################################################
### En local 
mcariou's avatar
mcariou committed
8
#./make_blast.sh /home/adminmarie/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/blastdb/cdslegio /home/adminmarie/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/genes/lp0952.fasta /home/adminmarie/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/out_blastn
mcariou's avatar
mcariou committed
9

mcariou's avatar
mcariou committed
10
### PSMN
mcariou's avatar
mcariou committed
11
#./make_blast.sh /Xnfs/ciridb/shared_data/Databases/legio_cds/blastdb_ncbi/cdslegio ~/2021_legio/genes/lp0952.fasta ~/2021_legio/out_blastn
mcariou's avatar
mcariou committed
12
13
14
##################################################################################################################

# variable
mcariou's avatar
mcariou committed
15
16
17
18
REP_DB=$1
gene=`echo $2 | sed 's/.fasta//g'`
REP_OUT=$3
gene_name=`echo $gene | awk -F "/" '{print $NF}'`
mcariou's avatar
mcariou committed
19
20
21
22
23

# Check argument
if [[ -s $gene.fasta ]] ; then
echo "Gene exists:$gene" 
else
mcariou's avatar
mcariou committed
24
echo "Missing or wrong gene argument: $2" 
mcariou's avatar
mcariou committed
25
exit 1
mcariou's avatar
mcariou committed
26
fi ;
mcariou's avatar
mcariou committed
27
28
29

mkdir -p $REP_OUT

mcariou's avatar
mcariou committed
30
31
32
if [[ -s $REP_OUT ]] ; then
echo "Out repertory exists: $REP_OUT" 
else
mcariou's avatar
mcariou committed
33
echo "Missing or wrong out repertory argument: $3"
mcariou's avatar
mcariou committed
34
35
36
exit 1 
fi ;

mcariou's avatar
mcariou committed
37
echo "--------------------------------------------------"
mcariou's avatar
update    
mcariou committed
38

mcariou's avatar
mcariou committed
39
echo "make db if not available:"
mcariou's avatar
update    
mcariou committed
40

mcariou's avatar
mcariou committed
41
42
43
44
if [[ -s $REP_DB.nal ]] ; then 
echo "$REP_DB.nal exists" 
else 
echo "$REP_DB.nal doesn't exist" 
mcariou's avatar
mcariou committed
45
origdb=`echo x{00..31}`
mcariou's avatar
mcariou committed
46
47
48
49
50
51
52
echo $origdb
blastdb_aliastool -dbtype nucl -dblist "$origdb" -out $REP_DB -title "blastdb with ncbi legionella cds"
fi ;

echo "--------------------------------------------------"


mcariou's avatar
mcariou committed
53
blastn -db $REP_DB -query ${gene}.fasta -evalue 10 \
mcariou's avatar
mcariou committed
54
-outfmt "7 qseqid qlen sseqid slen length pident evalue nident mismatch gapopen qstart qend qseq bitscrore score sstart send sseq sstrand" \
mcariou's avatar
mcariou committed
55
-out $REP_OUT/${gene_name}.blastn -max_target_seqs 5000 
mcariou's avatar
mcariou committed
56
57
58

echo "program done!"