-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblast.pl
81 lines (67 loc) · 1.99 KB
/
blast.pl
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
# !/usr/bin/perl
######## FuzzyAPP #####################
# Developed by SARAVANAN VIJAYAKUMAR
# Centre for Bioinformatics, Pondicherry University
# Date: 14-2-2013
#
######Required Modules
use List::Util qw[max];
#use CGI qw(:standard);
#use CGI::Carp qw(fatalsToBrowser);
use MIME::Lite; #To be installed
use List::Util qw(first max min);
#Enter BLAST EXECUTABLE Path below###########
$path_to_blastp = ''; #Please enter the full path of your blsat executable here!
$PATH_EXE = "/home/user/Documents/Softwares/FuzzyApp-master/";
if($path_to_blastp == ''){ print "\n BlastP executable path not set!"; exit;}
# Sequence In from argument
my $Seq_In = @ARGV[0];
$Seq_In=~s/\s//g;
###Ends!
###File generation
$Xtreme_File = $PATH_EXE.&generate_random_string(8);
open(TTT,">$Xtreme_File");
print TTT "\>query\n".$Seq_In;
close(TTT);
####Ends!
$Full_cmd = $path_to_blastp."blastp -db ".$PATH_EXE."MEMESeq -query ".$Xtreme_File;
###BLAST
print &BLAST_SIMILARITY("$Full_cmd");
#unlink($Xtreme_File);
####Ends!
############Subroutine
sub BLAST_SIMILARITY{#Parses the blast out put for query seq; Parameter -- balst query cmd; returns similarity percentage;
my $query_cmd = $_[0];
$xtr = `$query_cmd`;
if($xtr!~/No hits found/gi){
$xtr =~m/Length\=(.*)/g;
$Bp_Len = $1;
$xtr =~m/Identities \=(.*) Pos/;
$xtr = $1;
$xtr =~m/ (.*)\//g;
$r = $1;
if($Bp_Len != 0){
$Similarity = ($r/$Bp_Len);
return $Similarity;
}else{ return 0;}
}else{
return 0;
}
}
#Random Fiel name generator
sub generate_random_string
{
my $length_of_randomstring=shift;# the length of
# the random string to generate
my @chars=('a'..'z','A'..'Z','0'..'9');
my $random_string;
foreach (1..$length_of_randomstring)
{
# rand @chars will generate a random
# number between 0 and scalar @chars
$random_string.=$chars[rand @chars];
}
return $random_string;
}
####Ends!