[Bioperl-l] bioperl-db troubles
Hilmar Lapp
hlapp@gnf.org
Tue, 30 Jul 2002 10:09:11 -0700
If Bio::DB::Seq doesn't implement Bio::SeqI that's a bug.
As for full support for SwissProt roundtripping, I'm not sure what the status is. Generally, there seem to be very few people left meanwhile whose use case is actually round-tripping, so if that's your primary goal, be prepared to patch the code. (Ewan? I thought swissprot round-tripping is tested and worked?)
Which versions of bioperl and bioperl-db are you using? You need to use bioperl-live for the time being (developer's release to be out within the next days, otherwise use the CVS snapshot). Also, bioperl-db is actively changing; there's no stable release at this time (I believe; Jason?). Occasionally tests in CVS snapshots may even fail (right now they all pass).
I definitely don't want to discourage you from working with it, but please appreciate the fact that it's not of the same stability and code quality as bioperl itself.
-hilmar
> -----Original Message-----
> From: Dmitry Vl. Samborsky [mailto:dsambor@niisi.msk.ru]
> Sent: Tuesday, July 30, 2002 2:16 AM
> To: bioperl-l@bioperl.org
> Subject: [Bioperl-l] bioperl-db troubles
>
>
> Hi All,
>
> Being new to this project, I read the bptutorial.txt and
> have tried to use bioperl/bioperl-db for my application.
>
> I found the bioperl project very useful to me, however I
> had some problems using bioperl-db.
>
> So my questions are:
>
> 1. How do I replace bioentry stored in BioSQL DB by bioperl-db
> interface (i.e. in a correct way)?
> One can try:
>
> $seq = $seqadp->fetch_by_dbID('...');
> $seq->seq($new_str);
> $seqadp->store($seq);
>
> But it does not work since $seqadp->fetch_by_dbID returns
> Bio::DB::Seq though $seqadp->store expects Bio::SeqI object.
>
> Alternatively, I can try to make explicit SQL query to
> 'biosequence' table but this seems kind of tricky.
>
> 2. I have tried to save sequences from BioSQL to
> SWISS file format and find a trouble.
> I chose sequence 12S2_ARATH from SWISS-PROT
> and ran simple script:
>
> ################## Test script #########################
> use Bio::SeqIO;
> use Bio::DB::SQL::DBAdaptor;
> use Bio::DB::SQL::SeqAdaptor;
>
> # Note: The script uses biosql database 'test_bio_db', so
> create it or set
> # $dbname properly.
>
> my $dbname = 'test_bio_db';
> my $db = Bio::DB::SQL::DBAdaptor->new(
> -user => 'user',
> -dbname => $dbname,
> -host => 'localhost',
> -driver => 'mysql',
> );
>
> my $seqadp = $db->get_SeqAdaptor();
>
> my $dbid =
> $db->get_BioDatabaseAdaptor->fetch_by_name_store_if_needed($dbname);
>
> open OUTPUT, '>seq.out';
> my $out = Bio::SeqIO->new('-format' => 'swiss','-fh' => \*OUTPUT);
> my $in = Bio::SeqIO->new('-format' => 'swiss','-file' => 'seq.orig');
>
> my $orig_seq = $in->next_seq();
>
> my $dbID = $seqadp->store($dbid, $orig_seq);
>
> my $db_seq = $seqadp->fetch_by_dbID($dbID);
>
> # Get wrong SWISS-PROT output:
> $out->write_seq($db_seq);
>
> # Alternatively, it works well:
> #$out->write_seq($orig_seq);
> ################## End Test script End ###################
>
> File 'seq.orig' should contain 12S2_ARATH description
> from SWISS-PROT.
>
> So I have got file 'seq.out' where lines GN, OX, RT, RP, RC were gone.
>
> Does anyone have a good way to store bioentries in swiss format?
>
> 3. Bioperl-db still generates warning in BioDatabaseAdaptor.pm
> and debug output in SeqAdaptor.pm.
>
> I'd suggest the patch to fix these minory bugs:
>
> diff -Naur bioperl/db/Bio/DB/SQL/BioDatabaseAdaptor.pm
> bioperl.patched/db/Bio/DB/SQL/BioDatabaseAdaptor.pm
> --- bioperl/db/Bio/DB/SQL/BioDatabaseAdaptor.pm Tue Jul 9
> 05:50:02 2002
> +++ bioperl.patched/db/Bio/DB/SQL/BioDatabaseAdaptor.pm Mon Jul 22
> 01:20:02 2002
> @@ -369,7 +369,7 @@
> }
>
> # delete the parent
> - my $sth = $self->prepare("DELETE FROM biodatabase WHERE
> name = ?");
> + $sth = $self->prepare("DELETE FROM biodatabase WHERE name = ?");
> my $num_del = $sth->execute($name);
> $sth->finish();
>
> diff -Naur bioperl/db/Bio/DB/SQL/SeqAdaptor.pm
> bioperl.patched/db/Bio/DB/SQL/SeqAdaptor.pm
> --- bioperl/db/Bio/DB/SQL/SeqAdaptor.pm Thu Jul 11 10:12:48 2002
> +++ bioperl.patched/db/Bio/DB/SQL/SeqAdaptor.pm Mon Jul 22
> 00:47:46 2002
> @@ -263,7 +263,7 @@
> my @ids = map {$_->[0]} @$rows;
> my @seqs =
> map {
> - print "ID=$_\n";
> + #print "ID=$_\n";
> $self->fetch_by_dbID($_);
> } @ids;
> return @seqs;
>
> Sorry for the newbie questions.
> Thanks!
>
> -Dmitry
>
> --
> Dmitry Samborsky
> dsambor@niisi.msk.ru
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>