-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrpsblastreport_to_table1.pl
More file actions
41 lines (35 loc) · 902 Bytes
/
rpsblastreport_to_table1.pl
File metadata and controls
41 lines (35 loc) · 902 Bytes
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
#!/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.AA.rpsblast.out/){
push(@BlastOutput, $File::Find::name);
}
}
foreach my$RPSBlastReport (@BlastOutput){
print "$RPSBlastReport\n";
my$Tbl = $RPSBlastReport;
$Tbl =~ s/(\w+).rotate.AA.rpsblast.out/$1.RPS_TABLE.txt/;
my$Label = $1;
open(MYFILE, "$RPSBlastReport") or die "$!";
open(OUTPUT, ">$Tbl");
while(defined(my$line = <MYFILE>)){
if($line =~ m/Query= ([^\s]+) \[(\d+) - (\d+)\]/){
print OUTPUT "$1\t$2\t$3\t";
}
elsif($line =~ m/\Q***** No hits found *****\E/){
print OUTPUT "HYPO\thypothetical protein\n";
}
elsif($line =~ m/\>(\S+) (\Qcd\E\d+), (\S+), (.+)(\[|\.|\n)/){
print OUTPUT "$2\t$4\n";
}
elsif($line =~ m/\>(\S+) (\S+), (\S+), (.+)(\[|\.|\n)/){
print OUTPUT "$2\t$4\n";
}
}
}