Bioperl: Creating a SeqIO object

gert thijs gert.thijs@esat.kuleuven.ac.be
Mon, 29 May 2000 16:35:46 +0200


I tried to use this pseudo-filehandle, but I got the following error message:

"Not a GLOB reference at /users/sista/thijs/perl/lib/Bio/SeqIO.pm line 511."

Here's how I wrote it: 

my $seqs = $query->param('seq');
my $fhs = new IO::Scalar \$seqs;
my $inSeq = new Bio::SeqIO(-fh=>$fhs, -format=>'fasta');
while ( $seqO = $inSeq->next_seq() ){
  $seq = $seqO->seq();
  if ( $seq =~ /[^ACGT]/ ) {
    exec "echo 'There are non ACGT symbols in sequence $seqcount' >>
/tmp/$filename.dump";
  }else{
    print $TMPFILE $seqO->display_id();
    print $TMPFILE $seq;
  }
  ...
}


Gert



Aaron J Mackey wrote:
> 
> I think you might want to do something like this, using IO::Scalar to turn
> your string into a pseudo-filehandle:
> 
> $seqs = param('seqs'); # grab your CGI form variable.
> 
> $fh = new IO::Scalar \$seqs;
> 
> $in = new Bio::SeqIO -fh => $fh, -format => 'Fasta';
> 
> while($seq = $in->next_seq()) {
> 
>         # do stuff with each $seq.
> 
> }
> 
> -Aaron
> 
> On Fri, 26 May 2000, gert thijs wrote:
> 
> > Hello,
> >
> > I hope this is not a stupid question, but I still haven't captured all the
> > gory details of perl yet.
> > I am developping a web interface where one can enter some DNA sequences that
> > will be processed. Those DNA sequences should be in Fasta format. When I read
> > the inputs of the web interface the sequences are stored as one long string in
> > a variable $dnaseq. Now I am first writing this string to a file and then I
> > use the filehandle to read the sequences into a new SeqIO object.
> > But I was wondering if I can do this without writing $dnaseq to a file.
> >
> > tnx,
> > Gert Thijs
> >
> >
> 
> --
>  o ~   ~   ~   ~   ~   ~  o
> / Aaron J Mackey           \
> \  Dr. Pearson Laboratory  /
>  \ University of Virginia  \
>  /  (804) 924-2821          \
>  \  amackey@virginia.edu    /
>   o ~   ~   ~   ~   ~   ~  o

-- 
==========================================================
+ Gert Thijs              gert.thijs@esat.kuleuven.ac.be +
+                                                        +
+ Dept. Elektrotechniek ESAT-SISTA                       +
+ Kardinaal Mercierlaan, 94                              +
+ B-3001 HEVERLEE  Belgium                               +
+ Tel :  +32-16-32 18 84 ---- Fax : +32-16-32 19 70      +
==========================================================
=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================