-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse_pfam_descriptions.pl
executable file
·47 lines (35 loc) · 1.1 KB
/
parse_pfam_descriptions.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
#!/usr/bin/perl
# Anne de Jong, October 2016
# - Get PFAM descriptions
#
use lib "/usr/molgentools/lib";
use anne_files ;
my $pfam_folder = '/usr/bagel4/Pfam-A';
my $db_name = 'Pfam-A.hmm' ;
my $usage = "Options
-s pfam folder [default=$pfam_folder]
-db database name [default=$db_name]
e.g. /usr/molgentools/gsea_pro/parse_pfam_descriptions.pl -s /usr/bagel4/Pfam-A -db Pfam-A.hmm";
parseparam() ;
my @lines = anne_files::read_lines("$pfam_folder/$db_name");
my @result = "ACC\tNAME\tDescription";
my $NAME ;
my $ACC ;
foreach my $line (@lines) {
$NAME = $1 if ($line =~ m/^NAME\s+(.*)/) ;
$ACC = $1 if ($line =~ m/^ACC\s+(.*)\.\d+/) ;
if ($line =~ m/^DESC\s+(.*)/) { push @result, $ACC."\t".$NAME."\t".$1; }
}
print scalar @result ;
print " descriptions found\n";
anne_files::write_lines("$pfam_folder/$db_name.descriptions", @result);
sub parseparam {
my $var ;
my @arg = @ARGV ;
while(@arg) {
$var = shift(@arg) ;
die $usage if ($var eq '-h' or $var eq '--help') ;
$pfam_folder = shift(@arg) if($var eq '-s') ;
$db_name = shift(@arg) if($var eq '-db') ;
}
}