-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblastpreport2tbl_ct1.pl
42 lines (36 loc) · 995 Bytes
/
blastpreport2tbl_ct1.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
#!/bin/perl
use strict;
use warnings;
use File::Find;
use Cwd qw(cwd);
my$Drctry = cwd;
my@BlastOutput;
find(\&Wanted, $Drctry);
sub Wanted{
if ($_ =~ m/.rotate.blastp.out/){
push(@BlastOutput, $File::Find::name);
}
}
foreach my$BlastPReport (@BlastOutput){
print "$BlastPReport\n";
my$Tbl = $BlastPReport;
$Tbl =~ s/(\w+).rotate.blastp.out/$1.BLASTP.tbl/;
my$Label = $1;
open(MYFILE, "$BlastPReport") or die "$!";
open(OUTPUT, ">$Tbl");
print OUTPUT ">Feature $Label Table1";
while(defined(my$line = <MYFILE>)){
if($line =~ m/Query= (\w+) \[(\d+) - (\d+)\]/){
print OUTPUT "\n$2\t$3\tCDS";
print OUTPUT "\n\t\t\tprotein_id\tlcl|$1";
}
elsif($line =~ m/\Q***** No hits found *****\E/){
print OUTPUT "\n\t\t\tproduct\thypothetical protein";
print OUTPUT "\n\t\t\tinference\tNo BLASTP hit";
}
elsif($line =~ m/\>(.+\.\d) (.+) \[/){
print OUTPUT "\n\t\t\tproduct\t$2";
print OUTPUT "\n\t\t\tinference\tsimilar to AA sequence:INSD:$1";
}
}
}