[Bioperl-l] bioperl-db troubles

Dmitry Vl. Samborsky dsambor@niisi.msk.ru
Tue, 30 Jul 2002 13:16:19 +0400


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