Bio::EnsEMBL::Pipeline::SeqFetcher Getz
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
  Bio::EnsEMBL::Pipeline::SeqFetcher::Getz
Package variables
No package variables defined.
Included modules
Bio::DB::RandomAccessI
Bio::EnsEMBL::Root
Bio::Seq
Bio::SeqIO
Inherit
Bio::DB::RandomAccessI Bio::EnsEMBL::Root
Synopsis
    my $obj = Bio::EnsEMBL::Pipeline::SeqFetcher::Getz->new(
'-executable' => $exe,
'-library' => $lib,
);
my $seq = $obj->get_Seq_by_acc($acc);
Description
  Object to retrieve sequences as Bio::Seq, using getz.
Methods
batch_fetchDescriptionCode
executableDescriptionCode
get_Seq_by_accDescriptionCode
get_Seq_by_idDescriptionCode
libraryDescriptionCode
new
No description
Code
Methods description
batch_fetchcode    nextTop
  Title   : batch_fetch
Usage : $self->batch_fetch(@accs);
Function: Retrieves batches of sequences
Returns : listref of Bio::Seq
Args :
executablecodeprevnextTop
  Title   : executable
Usage : $self->executable('/path/to/executable');
Function: Get/set for the path to the executable being used by the module. If not set, the executable is looked for in $PATH.
Returns : string
Args : string
get_Seq_by_acccodeprevnextTop
  Title   : get_Seq_by_acc
Usage : $self->get_Seq_by_acc($accession);
Function: Does the sequence retrieval via getz
Returns : Bio::Seq
Args :
get_Seq_by_idcodeprevnextTop
  Title   : get_Seq_by_id
Usage : $self->get_Seq_by_id($id);
Function: Does the sequence retrieval via getz
Returns : Bio::Seq
Args :
librarycodeprevnextTop
  Title   : library
Usage : $self->library('embl');
Function: Get/set for a library/libraries to search in
Returns : string
Args : string
Methods code
batch_fetchdescriptionprevnextTop
sub batch_fetch {
  my ($self, @accs) = @_;

  my @seqs;

  while (@accs){

    push @seqs, $self->get_Seq_by_acc(shift @accs);

  }

  return\@ seqs
}


1;
}
executabledescriptionprevnextTop
sub executable {
  my ($self, $exe) = @_;
  if ($exe)
    {
      $self->{'_exe'} = $exe;
    }
  return $self->{'_exe'};
}
get_Seq_by_accdescriptionprevnextTop
sub get_Seq_by_acc {
  my ($self, $acc) = @_;
  my $libs = $self->library;

  if (!defined($acc)) {
    $self->throw("No id input");
  }  

  if (!defined($libs)) {
    $self->throw("No search libs specified");
  }  
  
  my $seqstr;
  my $seq;
  my $getz     = $self->executable;
  
  open(IN, "$getz  -d -sf fasta '[libs={$libs}-AccNumber:$acc]' |") 
    or $self->throw("Error running getz for id [$acc]: $getz");
  
  my $format = 'fasta';
  
  my $fh = Bio::SeqIO->new(-fh   =>\* IN, "-format"=>$format);
  
  $seq = $fh->next_seq();
  close IN;

  $self->throw("Could not getz sequence for [$acc]\n") unless defined $seq;
  $seq->display_id($acc);
  $seq->accession_number($acc);

  return $seq;
}
get_Seq_by_iddescriptionprevnextTop
sub get_Seq_by_id {
  my ($self, $id) = @_;
  my $libs = $self->library;

  if (!defined($id)) {
    $self->throw("No id input");
  }  

  if (!defined($libs)) {
    $self->throw("No search libs specified");
  }  
  
  my $seqstr;
  my $seq;
  my $getz     = $self->executable;
  
  open(IN, "$getz  -d -sf fasta '[libs={$libs}-ID:$id]' |") 
    or $self->throw("Error running getz for id [$id]: $getz");
  
  my $format = 'fasta';
  
  my $fh = Bio::SeqIO->new(-fh   =>\* IN, "-format"=>$format);
  
  $seq = $fh->next_seq();
  close IN;

  $self->throw("Could not getz sequence for [$id]\n") unless defined $seq;
  $seq->display_id($id);
  $seq->accession_number($id);

  return $seq;
}
librarydescriptionprevnextTop
sub library {
  my ($self, $lib) = @_;
  if ($lib) {
      $self->{'_lib'} = $lib;
    }
  return $self->{'_lib'};
}
newdescriptionprevnextTop
sub new {
  my ($class, @args) = @_;
  my $self = bless {}, $class;

  my ($exe, $lib) = $self->_rearrange([
				       'EXECUTABLE', 
				       'LIBRARY'], @args);

  if (!defined $exe) {
    $exe = 'getz';
  }
  $self->executable($exe);
  
  
  if (defined $lib) {
    $self->library($lib);
  }  
  return $self; # success - we hope!
}
General documentation
CONTACTTop
Describe contact details here
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _