RE: [Bioperl-l] Bio::Index::Fasta return object problem

Jason Stajich jason at cgt.mc.duke.edu
Mon Apr 28 11:06:41 EDT 2003


and what does
% grep "Q977F6" fastafilename
return

On Mon, 28 Apr 2003, [iso-8859-1] david vilanova wrote:

> Here it is...
>
> # Complete code for making an index for several
> # fasta files
> use lib '/usr/local/psu/bioperl-live';
> use Bio::Index::Fasta;
> use strict;
>
> my ($Index_File_Name,$Fasta_File) = @ARGV;
> my $inx = Bio::Index::Fasta->new(
> '-filename' => $Index_File_Name,
> '-write_flag' => 1);
> $inx->make_index($Fasta_File);
>
> # Print out several sequences present in the index
> # in Fasta format
>
> my $out = Bio::SeqIO->new('-format' => 'Fasta','-fh' => \*STDOUT);
> my @ids = qw( Q977F6 Q9V306 );
> foreach my $id (@ids) {
> my $seq = $inx->fetch($id); # Returns Bio::Seq object
> $out->write_seq($seq);
> }
>
>
> > David,
> >
> > Hmm. Can you show us the code after you made the change I suggested?
> >
> > Thanks again,
> >
> > Brian O.
> >
> >
> > -----Original Message-----
> > From: david vilanova [mailto:danova at andorra.ad]
> > Sent: Monday, April 28, 2003 10:09 AM
> > To: brian_osborne at cognia.com
> > Cc: bioperl-l at bioperl.org
> > Subject: RE: [Bioperl-l] Bio::Index::Fasta return object problem
> >
> > Hi brian,
> > doesn't work for me. Still give the same problem exception. I picked up
> > the code from the Bio::Index::Fasta module documentation which comes
> > with the last bioperl release and costumised a little bit.
> >
> >
> >> David,
> >>
> >> Your loop doesn't look right to me. Try something like:
> >>
> >> my @ids = qw( AC1111 B45455 );
> >>
> >> foreach my $id (@ids) {
> >>  my $seq = $inx->fetch($id); # Returns Bio::Seq object
> >>  $out->write_seq($seq);#requires a valid Bio::PrimarySeqI object
> >> }
> >>
> >> Is your code derived from some example code?
> >>
> >> Brian O.
> >>
> >>
> >> -----Original Message-----
> >> From: bioperl-l-bounces at bioperl.org
> >> [mailto:bioperl-l-bounces at bioperl.org]On Behalf Of david vilanova
> >> Sent: Monday, April 28, 2003 9:47 AM
> >> To: bioperl-l at bioperl.org
> >> Subject: [Bioperl-l] Bio::Index::Fasta return object problem
> >>
> >> Dear all,
> >> I have some problems when I try to retreive sequences from an indexed
> >> file. The Index::Fasta  seems to return a Bio::Seq object however the
> >> method write_seq requires a valid Bio::PrimarySeqI object. How can I
> >> can go through this problem.
> >>
> >> Thanks
> >> ------------- EXCEPTION  -------------
> >> MSG: Did not provide a valid Bio::PrimarySeqI object
> >> STACK Bio::SeqIO::fasta::write_seq
> >> /usr/local/psu/bioperl-live/Bio/SeqIO/fasta.pm:175
> >> STACK toplevel fasta.pl:21
> >>
> >>
> >> use Bio::Index::Fasta;
> >> use strict;
> >>
> >> my ($Index_File_Name,$Fasta_File) = @ARGV;
> >> my $inx = Bio::Index::Fasta->new(
> >> '-filename' => $Index_File_Name,
> >> '-write_flag' => 1);
> >> $inx->make_index($Fasta_File);
> >>
> >> # Print out several sequences present in the index
> >> # in Fasta format
> >>
> >> my $out = Bio::SeqIO->new('-format' => 'Fasta','-fh' => \*STDOUT);
> >>
> >> foreach my $id ($Index_File_Name) {
> >> my $seq = $inx->fetch($id); # Returns Bio::Seq object
> >> $out->write_seq($seq);#requires a valid Bio::PrimarySeqI object
> >> }
> >>
> >>
> >> _______________________________________________
> >> Bioperl-l mailing list
> >> Bioperl-l at bioperl.org
> >> http://bioperl.org/mailman/listinfo/bioperl-l
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list