[Bioperl-l] SeqIO problem

Murad Nayal murad@godel.bioc.columbia.edu
Sun, 25 Feb 2001 19:28:59 +0100



you use scalar(@array) to access the number of elements in the array.
length($string) applies to scalars returns the length of the string
representation of the scalar. see below

Cheers
Murad


"Schreiber, Mark" wrote:
> 
> Hi I seem to have a problem on my system reading fasta libraries.
> 
> Initially I thought it was the format of my fasta file however the
> seq1.fasta file from the examples directory of the bioperl distribution
> gives the same problem. Only one sequence is read from the file!
> 
> Here is the script:
> 
> #!/usr/bin/perl -w
> 
> use strict;
> use Bio::Seq;
> use Bio::SeqIO;
> 
> my $input = shift;
> 
> my $seqin  = Bio::SeqIO->new('-format' => 'Fasta',
>                              -file => "$input"
>                              );
> 
> my @seqs = ();
> while(my $sequence = $seqin->next_primary_seq() ){
>     push @seqs, $sequence
> }
> 
> print "No Seqs:\t" . length(@seqs). "\n";

                       ^^^^^^^^^^^^^

use instead             scalar(@seqs)
> 
> exit 0;
> 
> #END OF SCRIPT
> 
> The number of seqs output is always 1.
> 
> I am using bioperl 0.6.2 on a DEC Alpha with true64. Perl version 5.004_04
> built for alpha-dec_osf
> 
> Can anyone help?
> 
> Mark
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l

-- 
Murad Nayal M.D. Ph.D.
Department of Biochemistry and Molecular Biophysics
College of Physicians and Surgeons of Columbia University
630 West 168th Street. New York, NY 10032
Tel: 212-305-6884	Fax: 212-305-6926