[Bio] / FigKernelPackages / raelib.pm Repository:
ViewVC logotype

Annotation of /FigKernelPackages/raelib.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : redwards 1.1 # -*- perl -*-
2 :    
3 :     =pod
4 :    
5 :     =head1
6 :    
7 :     Some routines and things that Rob uses. Please feel free to use at will and incorporate into
8 :     your own code or move them into FIG.pm or elsewhere.
9 :    
10 :     =cut
11 :    
12 :     package raelib;
13 :     use strict;
14 :     use FIG;
15 :     my $fig=new FIG;
16 :    
17 :     =head2 pirsfcorrespondance
18 :    
19 :     Generate the pirsf->fig id correspondance. This is only done once and the correspondance file is written.
20 :     This is so that we can easily go back and forth.
21 :    
22 :     The correspondance has PIR ID \t FIG ID\n, and is probably based on ftp://ftp.pir.georgetown.edu/pir_databases/pirsf/data/pirsfinfo.dat
23 :    
24 :     =cut
25 :    
26 :     sub pirsfcorrespondance {
27 :     my ($self, $from, $to)=@_;
28 :     die "File $from does not exist as called in $0" unless (-e $from);
29 :     open (IN, $from) || die "Can't open $from";
30 :     open (OUT, ">$to") || die "Can't write tot $to";
31 :     while (<IN>) {
32 :     if (/^>/) {print OUT; next}
33 :     chomp;
34 :     my $done;
35 :     foreach my $peg ($fig->by_alias($_)) {
36 :     print OUT $_, "\t", $peg, "\n";
37 :     $done=1;
38 :     }
39 :     unless ($done) {print OUT $_, "\t\n"}
40 :     }
41 :     close IN;
42 :     close OUT;
43 :     }
44 :    
45 :    
46 :     =head2 ss_by_id
47 :    
48 :     Generate a list of subsystems that a peg occurs in. This is a ; separated list.
49 :     This is a wrapper that removes roles and ignores essential things
50 :    
51 :     =cut
52 :    
53 :     sub ss_by_id {
54 :     my ($self, $peg)=@_;
55 :     my $ssout;
56 :     print STDERR "RAELIB Looking for ss from $peg\n";
57 :     foreach my $ss (sort $fig->subsystems_for_peg($peg))
58 :     {
59 :     next if ($$ss[0] =~ /essential/i); # Ignore the Essential B-subtilis subsystems
60 :     $ssout.=$$ss[0]."; ";
61 :     }
62 :     $ssout =~ s/; $//;
63 :     return $ssout;
64 :     }
65 :    
66 :    
67 :    
68 :    
69 :    
70 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3