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

Diff of /FigKernelPackages/FFserver.pm

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

revision 1.13, Thu Jun 4 21:23:01 2009 UTC revision 1.14, Fri Jun 19 17:30:02 2009 UTC
# Line 1  Line 1 
1    
2  package FFserver;  package FFserver;
3    
4    #
5    # This is a SAS Component
6    #
7    
8  use LWP::UserAgent;  use LWP::UserAgent;
9  use Data::Dumper;  use Data::Dumper;
10  use YAML;  use YAML;
# Line 18  Line 22 
22          server_url => $server_url,          server_url => $server_url,
23          ua => LWP::UserAgent->new(),          ua => LWP::UserAgent->new(),
24      };      };
25      $self->{ua}->timeout(10 * 60);      $self->{ua}->timeout(20 * 60);
26    
27      return bless $self, $class;      return bless $self, $class;
28  }  }
# Line 225  Line 229 
229          form_vars => $form_vars ? $form_vars : [],          form_vars => $form_vars ? $form_vars : [],
230          req_bytes => ($req_bytes ? $req_bytes : 16000),          req_bytes => ($req_bytes ? $req_bytes : 16000),
231      };      };
232        $self->{ua}->timeout(20 * 60);
233      return bless $self, $class;      return bless $self, $class;
234  }  }
235    
# Line 348  Line 353 
353  use strict;  use strict;
354  use base 'SequenceWorkQueue';  use base 'SequenceWorkQueue';
355  use FileHandle;  use FileHandle;
 use FIG;  
356    
357  sub new  sub new
358  {  {
# Line 375  Line 379 
379  {  {
380      my($self) = @_;      my($self) = @_;
381    
382      my($id, $seqp, $com) = &FIG::read_fasta_record($self->{fh});      my($id, $seqp, $com) = read_fasta_record($self->{fh});
383      return defined($id) ? ($id, $com, $seqp) : ();      return defined($id) ? ($id, $com, $seqp) : ();
384  }  }
385    
386    sub read_fasta_record {
387        my ($file_handle) = @_;
388        my ($old_end_of_record, $fasta_record, @lines, $head, $sequence, $seq_id, $comment, @parsed_fasta_record);
389    
390        if (not defined($file_handle))  { $file_handle = \*STDIN; }
391    
392        $old_end_of_record = $/;
393        $/ = "\n>";
394    
395        if (defined($fasta_record = <$file_handle>)) {
396            chomp $fasta_record;
397            @lines  =  split( /\n/, $fasta_record );
398            $head   =  shift @lines;
399            $head   =~ s/^>?//;
400            $head   =~ m/^(\S+)/;
401            $seq_id = $1;
402            if ($head  =~ m/^\S+\s+(.*)$/)  { $comment = $1; } else { $comment = ""; }
403            $sequence  =  join( "", @lines );
404            @parsed_fasta_record = ( $seq_id, \$sequence, $comment );
405        } else {
406            @parsed_fasta_record = ();
407        }
408    
409        $/ = $old_end_of_record;
410    
411        return @parsed_fasta_record;
412    }
413    
414  package SequenceListWorkQueue;  package SequenceListWorkQueue;
415  use strict;  use strict;
416  use base 'SequenceWorkQueue';  use base 'SequenceWorkQueue';

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3