Bio::EnsEMBL::Pipeline::SeqFetcher FileIndex
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
  Bio::EnsEMBL::Pipeline::SeqFetcher::Pfetch
Package variables
No package variables defined.
Included modules
Bio::DB::RandomAccessI
Bio::EnsEMBL::Root
Bio::SeqIO
Inherit
Bio::DB::RandomAccessI Bio::EnsEMBL::Root
Synopsis
    my $obj = Bio::EnsEMBL::Pipeline::SeqFetcher::Pfetch->new(
-executable => $exe
);
my $seq = $obj->get_Seq_by_acc($acc);
Description
  Object to retrieve sequences as Bio::Seq, using pfetch.
Methods
get_Seq_by_accDescriptionCode
list_all_ids
No description
Code
new
No description
Code
seqfile
No description
Code
Methods description
get_Seq_by_acccode    nextTop
  Title   : get_Seq_by_acc
Usage : $self->get_eq_by_acc($accession);
Function: Does the sequence retrieval
Returns : Bio::Seq
Args :
Methods code
get_Seq_by_accdescriptionprevnextTop
sub get_Seq_by_acc {
  my ($self, $acc) = @_;
  
  if (!defined($acc)) {
    $self->throw("No accession input");
  }  
  
  if (defined($self->{_seqhash}{$acc})) {
     return $self->{_seqhash}{$acc};
  } else {
     $self->throw("Could not fetch sequence for [$acc]\n");
  }
}
list_all_idsdescriptionprevnextTop
sub list_all_ids {
  my ($self) = @_;

  my @ids = keys %{$self->{_seqhash}};

  return\@ ids;
}

1;
}
newdescriptionprevnextTop
sub new {
  my ($class, @args) = @_;
  my $self = bless {}, $class;

  my ($seqfile) = $self->_rearrange(['SEQFILE'], @args);

  if (defined($seqfile)) {
    $self->seqfile($seqfile);
  } else {
    $self->throw("Need a sequence file");
  }
  
  return $self; # success - we hope!
}
seqfiledescriptionprevnextTop
sub seqfile {
  my ($self,$file) = @_;


  if (defined($file)) {
    open (INDEX,"<$file") || $self->throw("Can't open $file");
    
    my $seqio = new Bio::SeqIO(-fh =>\* INDEX, -format => 'fasta');
    
    while (my $seq = $seqio->next_seq) {
      $self->{_seqhash}{$seq->id} = $seq;
    }
    
    close(INDEX);
  } else {
    $self->throw("Must supply a seqfile to Bio:EnsEMBL::Pipeline::SeqFetcher::FileIndex");
  }
}
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 _