[Bioperl-l] Bio::DB::BioDB - insert failed. Dupllicate entry	''for key 2?
    Marc Logghe 
    Marc.Logghe at DEVGEN.com
       
    Sun Mar  5 20:39:41 UTC 2006
    
    
  
> >>>> mysql> select * from biodatabase;
> >>>> +----------------+------+-----------+-------------+
> >>>> | biodatabase_id | name | authority | description |
> >>>> +----------------+------+-----------+-------------+
> >>>> |             23 |      | NULL      | NULL        |
> >>>> +----------------+------+-----------+-------------+
> >>
This is odd. The name of the namespace is missing, it should read
'bioperl'.
Have you tried explicitely setting the namespace ?
my $db = Bio::DB::BioDB->new(
        -database   => "biosql",
        -host       => 'localhost',
        -port       => 3306,
        -dbname     => 'BIOSQL', # not sure, but changed it anyhow
        -driver     => 'mysql',
        -user       => 'dbastola',
        -pass       => '-----------',
);
my $file =
"/home/dbastola/genbankSequences/GBVRL/gbvrl_2006_Jan/GB_Sequences/gbvrl
1.seq";
my $infile  = Bio::SeqIO->new(-file => $file,  -format => 'GenBank');
my $seq = $infile->next_seq();
#set namespace explicitely
$seq->namespace('VIRUS');
my $species = $seq->species;
print join " | ", $species->classification; print "\n";
my $pseq = $db->create_persistent($seq);
$pseq->create() or die "create failed";
$pseq->commit;
exit;
If you execute your select statement again, you should see VIRUS
appearing in the name field.
Don't forget to set the namespace as well in your lookup script.
HTH,
Marc
    
    
More information about the Bioperl-l
mailing list