Skip to content

Commit 5d58e17

Browse files
committed
Gets all PFAM IDs associated with a gene ID for a given organism
1 parent 863d44a commit 5d58e17

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

getPFAM.pl

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/perl
2+
# Script: getPFAM.pl
3+
# Description: Gets all PFAM IDs associated with a gene ID for a given organism
4+
# Author: Steven Ahrendt
5+
6+
# Date: 04.04.2014
7+
##################################
8+
use warnings;
9+
use strict;
10+
use lib '/rhome/sahrendt/Scripts';
11+
use Getopt::Long;
12+
use BCModules;
13+
use Data::Dumper;
14+
15+
#####-----Global Variables-----#####
16+
my $input;
17+
my ($help,$verb);
18+
my (%pfam,$pfamFile,$spec);
19+
20+
GetOptions ('i|input=s' => \$input,
21+
'h|help' => \$help,
22+
'v|verbose' => \$verb);
23+
my $usage = "Usage: getPFAM.pl -i input\n";
24+
die $usage if $help;
25+
die "No input.\n$usage" if (!$input);
26+
27+
#####-----Main-----#####
28+
$spec = (split(/\./,$input))[0];
29+
$pfamFile = "$spec\_pfam_to_genes.txt";
30+
%pfam = indexPFAM($pfamFile);
31+
open(my $fh, "<", $input) or die "Can't open $input: $!\n";
32+
while(my $line = <$fh>)
33+
{
34+
chomp $line;
35+
print $line,"\t";
36+
my $id = (split(/\|/,$line))[1];
37+
$id =~ s/T\d$//;
38+
if(exists $pfam{$id})
39+
{
40+
for(my $i=0;$i < scalar @{$pfam{$id}{PFAM_ACC}}; $i++)
41+
{
42+
print @{$pfam{$id}{PFAM_ACC}}[$i],";";
43+
}
44+
}
45+
print "\n";
46+
}
47+
close($fh);
48+
#print Dumper \%pfam;
49+
50+
warn "Done.\n";
51+
exit(0);
52+
53+
#####-----Subroutines-----#####

0 commit comments

Comments
 (0)