-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathgetPFAM.pl
More file actions
executable file
·53 lines (48 loc) · 1.17 KB
/
getPFAM.pl
File metadata and controls
executable file
·53 lines (48 loc) · 1.17 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
#!/usr/bin/perl
# Script: getPFAM.pl
# Description: Gets all PFAM IDs associated with a gene ID for a given organism
# Author: Steven Ahrendt
# email: sahrendt0@gmail.com
# Date: 04.04.2014
##################################
use warnings;
use strict;
use lib '/rhome/sahrendt/Scripts';
use Getopt::Long;
use BCModules;
use Data::Dumper;
#####-----Global Variables-----#####
my $input;
my ($help,$verb);
my (%pfam,$pfamFile,$spec);
GetOptions ('i|input=s' => \$input,
'h|help' => \$help,
'v|verbose' => \$verb);
my $usage = "Usage: getPFAM.pl -i input\n";
die $usage if $help;
die "No input.\n$usage" if (!$input);
#####-----Main-----#####
$spec = (split(/\./,$input))[0];
$pfamFile = "$spec\_pfam_to_genes.txt";
%pfam = indexPFAM($pfamFile);
open(my $fh, "<", $input) or die "Can't open $input: $!\n";
while(my $line = <$fh>)
{
chomp $line;
print $line,"\t";
my $id = (split(/\|/,$line))[1];
$id =~ s/T\d$//;
if(exists $pfam{$id})
{
for(my $i=0;$i < scalar @{$pfam{$id}{PFAM_ACC}}; $i++)
{
print @{$pfam{$id}{PFAM_ACC}}[$i],";";
}
}
print "\n";
}
close($fh);
#print Dumper \%pfam;
warn "Done.\n";
exit(0);
#####-----Subroutines-----#####