[Bioperl-l] Trying to get a mysql DB from genbank flat files

Nirav Merchant Nirav@public.arl.arizona.edu
Tue, 27 Nov 2001 13:35:00 -0700


If you use the following method you don't need to use quote() ..It handles 
just about any pesky special characters you can think of

$sth= $dbh->prepare("INSERT INTO myseqbank 
(seqname,gid,type,dir,author,sequence,length,notes,date) 
values(?,?,?,?,?,?,?,?,?)");
  $sth->execute($seqname,$gid,$type,$dir,$author,$sequence,$length,$notes,$date) 
or die "Cannot insert\n";

Works like a champ for me

regards,
Nirav




At 12:08 PM 11/27/2001 -0500, Raphael LaFrance wrote:
>Just as a heads-up... you're going to have to do it to most other string
>fields too.  I found this to be an endemic problem in most of the long
>string fields in the genbank files (feature description & keywords,
>references, comments, etc. etc.)
>
>rafe
>
>Heikki Lehvaslaiho wrote:
> >
> > Elia Stupka wrote:
> > >
> > > > quote
> > > > $sql = $dbh->quote($string);
> > > > This method escapes special characters (quotation marks, etc.) from 
> strings
> > > > and adds the required outer quotation marks. May not be able to 
> handle all
> > > > types of input (i.e binary data).
> > >
> > > Excellent, thank you guys for all the suggestions!
> > >
> > > Elia
> >
> > I ran into this same problem today trying to use bioperl-db.
> > An immunoglobulin sequence entry (D87009) has ' characters in keywords...
> >
> > I think I came up with a clean solution to this. I added quote() as a
> > shortcut into Bio::DB::SQL::BaseAdaptor and added line
> >         $kw = $self->quote($kw);
> > into Bio::DB::SeqAdaptor.
> >
> > I did the same for the description lines because I know that they sometimes
> > contain "prime" and other funny characters.
> >
> >         -Heikki
> >
> > --
> > ______ _/      _/_____________________________________________________
> >       _/      _/                      http://www.ebi.ac.uk/mutations/
> >      _/  _/  _/  Heikki Lehvaslaiho          heikki@ebi.ac.uk
> >     _/_/_/_/_/  EMBL Outstation, European Bioinformatics Institute
> >    _/  _/  _/  Wellcome Trust Genome Campus, Hinxton
> >   _/  _/  _/  Cambs. CB10 1SD, United Kingdom
> >      _/      Phone: +44 (0)1223 494 644   FAX: +44 (0)1223 494 468
> > ___ _/_/_/_/_/________________________________________________________
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l@bioperl.org
> > http://bioperl.org/mailman/listinfo/bioperl-l
>_______________________________________________
>Bioperl-l mailing list
>Bioperl-l@bioperl.org
>http://bioperl.org/mailman/listinfo/bioperl-l