-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathK-blastnative2tab-v1.0.pl
More file actions
executable file
·54 lines (37 loc) · 1.32 KB
/
K-blastnative2tab-v1.0.pl
File metadata and controls
executable file
·54 lines (37 loc) · 1.32 KB
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
#!/usr/bin/perl -w
use strict;
use warnings;
use Bio::Seq;
use Bio::SeqIO;
use Bio::SearchIO;
use Getopt::Long;
my ($filein, $fileout);
GetOptions(
'i|input:s' => \$filein,
'o|output:s' => \$fileout,
# 'e|evalue:s' => \$evalue,
);
open (FILEOUT1, ">", $fileout) or die "Cannot open output file $fileout";
my $in = Bio::SearchIO->new (-format => 'blast',
-file => $filein);
while( my $result = $in->next_result ) {
# print $result, "\n";
while( my $hit = $result->next_hit ) {
while( my $hsp = $hit->next_hsp ) {
# print $result->query_description, "\n";
print FILEOUT1 $result->query_description, "\t", #query name
$hit->name, "\t", #subject name
$hsp->percent_identity, "\t", #percent identity
$hsp->hsp_length, "\t", #alignment length
($hsp->hsp_length - $hsp->gaps - $hsp->num_identical), "\t", #mismatches
$hsp->gaps, "\t", #gaps
$hsp->start('query'), "\t", #query start
$hsp->end('query'), "\t", #query end
$hsp->start('hit'), "\t", #subject start
$hsp-> end('hit'), "\t", #subject end
$hsp->evalue, "\t", #e-value
$hsp->bits, "\n", #bit score
}
}
}
close FILEOUT1;