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

Diff of /FigKernelPackages/raelib.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7, Sun Apr 3 02:15:15 2005 UTC revision 1.13, Wed May 4 03:07:23 2005 UTC
# Line 2  Line 2 
2    
3  =pod  =pod
4    
5  =head1  =head1 RAE Library
6    
7   Some routines and things that Rob uses. Please feel free to use at will and incorporate into   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.   your own code or move them into FIG.pm or elsewhere.
# Line 75  Line 75 
75    
76   The correspondence has PIR ID \t FIG ID\n, and is probably based on ftp://ftp.pir.georgetown.edu/pir_databases/pirsf/data/pirsfinfo.dat   The correspondence has PIR ID \t FIG ID\n, and is probably based on ftp://ftp.pir.georgetown.edu/pir_databases/pirsf/data/pirsfinfo.dat
77    
78     This method takes three arguments:
79       from    : pirsfinfo.dat file
80       to      : file to write information to
81       verbose : report on progress
82    
83     Returns the number of lines in the pirsinfo file that were read.
84    
85  =cut  =cut
86    
87  sub pirsfcorrespondence {  sub pirsfcorrespondence {
88   my ($self, $from, $to)=@_;   my ($self, $from, $to, $verbose)=@_;
89   die "File $from does not exist as called in $0" unless (-e $from);   unless (-e $from) {
90      print STDERR "File $from does not exist as called in $0\n";
91      return 0;
92     }
93   open (IN, $from) || die "Can't open $from";   open (IN, $from) || die "Can't open $from";
94   open (OUT, ">$to") || die "Can't write tot $to";   open (OUT, ">$to") || die "Can't write to $to";
95     my $linecount;
96   while (<IN>) {   while (<IN>) {
97      $linecount++;
98      unless ($linecount % 10000) {print STDERR "Correspondence of $linecount lines calculated\n"}
99    if (/^>/) {print OUT; next}    if (/^>/) {print OUT; next}
100    chomp;    chomp;
101    my $done;    my $done;
# Line 90  Line 103 
103     print OUT $_, "\t", $peg, "\n";     print OUT $_, "\t", $peg, "\n";
104     $done=1;     $done=1;
105    }    }
106      unless ($done) {
107       foreach my $peg ($fig->by_alias("tr|$_")) {
108        print OUT $_, "\t", $peg, "\n";
109        $done=1;
110       }
111      }
112      unless ($done) {
113       foreach my $peg ($fig->by_alias("sp|$_")) {
114        print OUT $_, "\t", $peg, "\n";
115        $done=1;
116       }
117      }
118    unless ($done) {print OUT $_, "\t\n"}    unless ($done) {print OUT $_, "\t\n"}
119   }   }
120   close IN;   close IN;
121   close OUT;   close OUT;
122     return $linecount;
123  }  }
124    
125    
# Line 173  Line 199 
199   my @return;   my @return;
200   my @attr=$fig->feature_attributes($peg);   my @attr=$fig->feature_attributes($peg);
201   foreach my $attr (@attr) {   foreach my $attr (@attr) {
202    my ($gottag, $val, $link)=@$attr;    my ($gotpeg, $gottag, $val, $link)=@$attr;
203    push @return, $val if ($gottag eq $tag);    push @return, $val if ($gottag eq $tag);
204   }   }
205   return wantarray ? @return : join "; ", @return;   return wantarray ? @return : join "; ", @return;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.13

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3