-
Notifications
You must be signed in to change notification settings - Fork 3
/
blastn.pl
119 lines (109 loc) · 2.72 KB
/
blastn.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/perl
print "File containing sequence names? ";
chomp ($file = <STDIN>);
open (FILEIN,"$file");
open(FILEOUT,">blastn");
while (chomp ($seq = <FILEIN>) )
{$sout=$seq.".html";
print FILEOUT"/home/andrew/bic/blastcl3 -p blastn -d nr -i $seq -o $sout -T\n";
}
#!/usr/bin/perl
#parse blast results
$count=0;
print "the blast file name \n";
$_=<>;
chomp;
open (o,"$_")|| die;
$line=<o>;
chomp $line;
while ($line=<o>)
{
push (@file,$line);
}
for ($i=0;$i<=$#file;$i++)
{
$line=$file[$i];
chomp$line;
$full="";
if ($line=~/Query=/)
{ $i++;
$full=$line.$file[$i++];
chomp $full;
push (@exon,$full);
while($count==0){
$i++;
$line1=$file[$i];
chomp$line1;
if ($line1=~/Sequences/)
{ #print "found";
$i=$i+2;
$line2=$file[$i];
chomp$line2;
push (@hit,$line2);
$count=1;
}
elsif($line1=~/No/)
{
push (@hit,$line1);
$count=1;
}
}
$count=0;
}
}
$num=0;
foreach $exon(@exon)
{
print "$exon:$hit[$num]\n";
$num++;}
#!/usr/bin/perl
use strict;
my $main_file_pattern=shift @ARGV;chomp $main_file_pattern;
open(F,$main_file_pattern)||die "can't open";
my ($w,$c,$line,$snames,@seqname,@seq,$fresall,$seq,$seqname,%match2,%match3,%match4,%matchl1,%matchl2);
while ($line = <F>) {
chomp ($line);
my @temp=split(/\t/,$line);
for($c=0;$c<=$#temp;$c++){
if (@temp[$c] =~ /region of query/){
my @temp2=split(/\s+/,@temp[$c]);
my $l1=@temp2[2]-@temp2[0];
my $l2=@temp2[9]-@temp2[7];
if(@temp2[0]!=@temp2[7] && @temp2[2]!=@temp2[9] && $l1>20 && $l2>20){
#print "@temp2[0]\t@temp2[2]\t@temp2[7]\t@temp2[9]\t$l1\t$l2\n";
$match2{@temp2[0]}=@temp2[2];
$match3{@temp2[0]}=@temp2[7];
$match4{@temp2[0]}=@temp2[9];
$matchl1{@temp2[0]}=$l1;
$matchl2{@temp2[0]}=$l2;
}
}
else {
#$seq=$seq.$line;
}
}
}
foreach $w (sort {$a<=>$b} keys %match2) {
if($w<$match3{$w} && ($matchl1{$w}/$matchl2{$w}>0.9 || $matchl1{$w}/$matchl2{$w}<1.1)){
print "$w - $match2{$w}\t$match3{$w} - $match4{$w}\t$matchl1{$w}\t$matchl2{$w}\n";
}
}
#!/usr/bin/perl
while(<>){chomp;split(/\s+/);$c++;$dictast{length(@_[0])}.=">s.$c\n@_[0]\n";}
foreach $w (sort {$b<=>$a} keys %dictast){
open(FI,">temp.blast.in");
print "Blasting $w length word(s) file\n";
print FI"$dictast{$w}";
close FI;
#system("cp 1T32.A.fas temp.blast.in");
system("blastcl3 -p blastp -d swissprot -i temp.blast.in -o temp.blast.out");
open(FO,"temp.blast.out");
my $c=0;
while(<FO>){
print $_;
if($_=~/^Sequences producing significant/){
close FO;
die;
}
}
}