[Bioperl-l] New to BioPerl ... part II

Hilmar Lapp hlapp at drycafe.net
Tue Mar 25 23:09:57 UTC 2014


Are you sure that the database was empty that you were trying to load into?

The error you're seeing means that some object wasn't found in the database
when searching for it by (compound) unique key, but then inserting the
object raised an exception, presumably due to unique key failure. Sometimes
this can happen when a sequence's component objects are manipulated by a
script. But that doesn't seem to be what you are doing, so it's not clear
to me what might be going on.

Did you run the bioperl-db tests, and if so, did they pass?

  -hilmar


On Mon, Mar 24, 2014 at 8:51 AM, Olivier BUHARD <Olivier.Buhard at inserm.fr>wrote:

> Hi,
>
> thank you a lot Christopher, Francisco and Hilmar for your great help!
>
> I followed all your propositions. Changed to Strawberry Perl (latest
> version, and I uninstalled Activeperl before) and I can now have a
> connection to the local mysql server on my computer.
> I look a bit closer in the files generated during the build process (in
> cpan utility) in the meanwhile and found as you mention below, a problem
> with the DBD::mysql that didn't take into account the connection parameters
> I pass through the Makefile.PL script. Looking further into the code, I saw
> the script asked for both user AND password... and I didn't have a password
> for that specific user accessing my biosql db... there was a function
> called "win32_config" or something like this that then generated the
> configuration for the tests with a default user 'ODBC' I don't use.
> Well, this is just for the "little story".
> Now I checked my DBI and mysql DBD, they work fine. I can retrieve data
> from another mysql database I use frequently.
>
> Then I installed BioPerl (1.6.923) and BioPerl-DB (1.006900). I had to
> force install for both because I got many exceptions, and particularly one
> in Bio::Root::IO i'm a bit worried about, I feel it's an important piece of
> the module.
> Once I finished install, I tried load_seqdatabase.pl on a truncated
> version of the same gbpri1.seq from NCBI FTP. But again it doesn't work,
> but for a different reason than before I think. I get a connection to my
> biosql database, but there is some glitch, I can't find out what happens.
> The script threw me a lot of warning messages, saying "failed to insert or
> to be found by unique key".
>
> As I forced the installation of BioPerl and BioPerl-DB, is there a chance
> I missed some critical message? It seems the problem is in the BioPerl-DB
> module but not related to the connection (when I enter a wrong user, I get
> a denied access message, so it's OK for the connection apparently).
> I'll try on a Linux install soon to verify. But if you have any idea in
> the meanwhile, I'll appreciate a lot!
>
> Below is the output from the load_seqdatabase script I get:
>
> Many thanks for your (really appreciated) help!
>
> Best regards.
>
> Olivier
> -----------------------
> C:\Perl Bio Scripts>perl load_seqdatabase.pl --dbname=biosql_hs
> --dbuser=biodb_user gbTest.seq
>
> Loading gbTest.seq ...
> Subroutine new redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 120,  <GEN0> line 98.
> Subroutine classification redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 176, <GEN0> line 98.
> Subroutine species redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line272, <GEN0> line 98.
> Subroutine genus redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 377, <GEN0> line 98.
> Subroutine sub_species redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 407, <GEN0> line 98.
> Subroutine variant redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line455, <GEN0> line 98.
> Subroutine binomial redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 490, <GEN0> line 98.
> Subroutine validate_species_name redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 530, <GEN0> line 98.
> Subroutine validate_name redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 539, <GEN0> line 98.
>
> .../...
>
> Subroutine remove_Descendant redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 604, <GEN0> line 98.
> Subroutine name redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 606, <GEN0> line 98.
> Subroutine taxon redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 619, <GEN0> line 98.
> Subroutine tree redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line 639, <GEN0> line 98.
> Subroutine DESTROY redefined at C:/strawberry/perl/site/lib/Bio\Species.pm
> line649, <GEN0> line 98.
>
> --------------------- WARNING ---------------------
> MSG: SimpleValueAdaptor::add_assoc: unexpected failure of statement
> execution: Le champ 'term_id' ne peut Ûtre vide (null)
>         name: INSERT ASSOC [2] Bio::SeqFeature::Generic;Bio::
> Annotation::SimpleValue
>         values: FK[Bio::SeqFeature::Generic]:3, FK[Bio::Annotation::SimpleValue]:,
> value:"mRNA", rank:"1"
> ---------------------------------------------------
>
> --------------------- WARNING ---------------------
> MSG: SimpleValueAdaptor::add_assoc: unexpected failure of statement
> execution: Le champ 'term_id' ne peut Ûtre vide (null)
>         name: INSERT ASSOC [2] Bio::SeqFeature::Generic;Bio::
> Annotation::SimpleValue
>         values: FK[Bio::SeqFeature::Generic]:3, FK[Bio::Annotation::SimpleValue]:,
> rank:"1", value:"Homo sapiens"
> ---------------------------------------------------
>
> --------------------- WARNING ---------------------
> MSG: SimpleValueAdaptor::add_assoc: unexpected failure of statement
> execution: Le champ 'term_id' ne peut Ûtre vide (null)
>         name: INSERT ASSOC [2] Bio::SeqFeature::Generic;Bio::
> Annotation::SimpleValue
>         values: FK[Bio::SeqFeature::Generic]:4, FK[Bio::Annotation::SimpleValue]:,
> value:"hepatocyte growth factor activator inhibitor", rank:"1"
> ---------------------------------------------------
>
> --------------------- WARNING ---------------------
> MSG: SimpleValueAdaptor::add_assoc: unexpected failure of statement
> execution: Le champ 'term_id' ne peut Ûtre vide (null)
>         name: INSERT ASSOC [2] Bio::SeqFeature::Generic;Bio::
> Annotation::SimpleValue
>         values: FK[Bio::SeqFeature::Generic]:4, FK[Bio::Annotation::SimpleValue]:,
> value:"BAA25014.1", rank:"1"
> ---------------------------------------------------
> Could not store AB000099:
> ------------- EXCEPTION -------------
> MSG: create: object (Bio::Species) failed to insert or to be found by
> unique key
> STACK Bio::DB::BioSQL::BasePersistenceAdaptor::create
> C:/strawberry/perl/site/lib/Bio/DB/BioSQL/BasePersistenceAdaptor.pm:219
> STACK Bio::DB::Persistent::PersistentObject::create
> C:/strawberry/perl/site/lib/Bio/DB/Persistent/PersistentObject.pm:257
> STACK Bio::DB::BioSQL::BasePersistenceAdaptor::create
> C:/strawberry/perl/site/lib/Bio/DB/BioSQL/BasePersistenceAdaptor.pm:182
> STACK Bio::DB::BioSQL::BasePersistenceAdaptor::store
> C:/strawberry/perl/site/lib/Bio/DB/BioSQL/BasePersistenceAdaptor.pm:264
> STACK Bio::DB::Persistent::PersistentObject::store
> C:/strawberry/perl/site/lib/Bio/DB/Persistent/PersistentObject.pm:284
> STACK (eval) load_seqdatabase.pl:630
> STACK toplevel load_seqdatabase.pl:612
> -------------------------------------
>
>
>  at load_seqdatabase.pl line 643, <GEN0> line 162.
>
>
>
>
> Le 21/03/2014 05:59, Fields, Christopher J a écrit :
>
>  Agree with Francisco, Strawberry Perl is definitely the way to go.  You
>> can do it with ActivePerl but IIRC the PPM installs were always a pain.
>>
>> chris
>>
>> On Mar 20, 2014, at 10:54 PM, Francisco J. Ossandón <
>> fossandonc at hotmail.com> wrote:
>>
>>  Hi Olivier,
>>> Currently there is no PPM package from the latest version, the last one
>>> is
>>> like 4 years old, so is better to download the latest version from CPAN
>>> (1.6.923).
>>> I have one recommendation though... unless you are very attached to
>>> ActivePerl, uninstall it and install Strawberry Perl instead
>>> (http://strawberryperl.com/).
>>>
>>> When I started to learn Bioperl several years ago I used ActivePerl too,
>>> but
>>> it always gave me trouble installing new modules from CPAN. I switched to
>>> Strawberry a few years ago and is much better because it includes by
>>> default
>>> additional libraries and compiling tools (gcc, mingw, dmake, etc) that
>>> makes
>>> easier the installation of CPAN modules (including some Bioperl
>>> dependencies)... Since the installation instructions at the wiki only
>>> considered ActivePerl, I updated the wiki a few days ago to include
>>> Strawberry Perl as an additional option
>>> (http://www.bioperl.org/wiki/Special:RecentChanges).
>>>
>>> By the way... something odd among the errors you are getting is that it
>>> says
>>> that " perl514.dll cannot be found", but if you installed 5.18 you should
>>> have perl518.dll instead... did you install 5.18 above 5.14?? Because I
>>> can
>>> tell that overwriting it can produce obscure and mysterious bugs, is
>>> better
>>> to uninstall the old one first, then delete the whole folder, and then
>>> make
>>> a clean install of the new one.
>>>
>>> Cheers and good luck,
>>>
>>> Francisco J. Ossandon
>>>
>>> -----Mensaje original-----
>>> De: bioperl-l-bounces at lists.open-bio.org
>>> [mailto:bioperl-l-bounces at lists.open-bio.org] En nombre de Hilmar Lapp
>>> Enviado el: jueves, 20 de marzo de 2014 20:49
>>> Para: Olivier BUHARD
>>> CC: BioPerl List
>>> Asunto: Re: [Bioperl-l] New to BioPerl ... part II
>>>
>>> I think the exception message appears due to the actual problem you're
>>> already describing. Bioperl-db will catch the failure and then print the
>>> error message. Since it doesn't seem to say anything about failing to
>>> connect to the database, it's either failing before or past that point
>>> for
>>> an unexpected reason. My suspicion is that it fails to load the DBD
>>> driver
>>> for Perl DBI.
>>>
>>> You can test that by writing a small script (not using Bioperl or
>>> Bioperl-DB) that simply opens a connection to the database. If that
>>> fails,
>>> that's where the problem is.
>>>
>>> You can also try that with Bioperl-db:
>>>
>>>   $conn = $dbadp->dbcontext()->dbi()->new_connection();
>>>
>>> This should give you an open DBI-compliant connection.
>>>
>>> If that part works, then the problem is somewhere with the dynamic
>>> auto-loading code.
>>>
>>> -hilmar
>>>
>>>
>>>
>>> On Wed, Mar 19, 2014 at 6:46 PM, Olivier BUHARD
>>> <Olivier.Buhard at inserm.fr>wrote:
>>>
>>>  Hi,
>>>>
>>>> thank you all for your answers. I had the (wrong) notion that windows
>>>> did ignore the shebang...
>>>>
>>>> I am using Bioperl 1.6.1... I'll try to install 1.6.923 but I can't
>>>> find it with ActivePerl ppm (I switched to 5.18), so I'll have to try
>>>> with command line ppm. I'm running windows XP... perhaps also have to
>>>> try with Linux.
>>>>
>>>> I'm getting in the doc and tutos I can find about Bioperl-db and I'm
>>>> beginning to understand how it deals with parsing and organizing the
>>>> data.
>>>> However, my first attempts to load sequences in my BioSQL db are
>>>> unsuccessful. From the gbpri1.seq I downloaded from NCBI FTP,
>>>> load_seqdatabase.pl crashes at the moment it tries to INSERT in the
>>>> db, telling me perl514.dll cannot be found, and sending a bunch of
>>>> error messages in a last breath:
>>>>
>>>> C:\tmp>perl load_seqdatabase.pl -dbname biosql_hs -dbuser biodb_user
>>>> -dbpass ******** gbpri1.seq Loading gbpri1.seq ...
>>>> UNIVERSAL->import is deprecated and will be removed in a future perl
>>>> UNIVERSAL->at
>>>> C:/Perl/site/lib/Bio/Tree/TreeFunctionsI.pm line 94.
>>>> UNIVERSAL->import is deprecated and will be removed in a future perl
>>>> UNIVERSAL->at
>>>> C:/Perl/site/lib/Bio\Tree\TreeFunctionsI.pm line 94.
>>>>
>>>> ------------- EXCEPTION -------------
>>>> MSG: failed to open connection:
>>>> STACK Bio::DB::DBI::base::new_connection
>>>> C:/Perl/site/lib/Bio/DB/DBI/ba
>>>> se.pm:267
>>>> STACK Bio::DB::DBI::base::get_connection
>>>> C:/Perl/site/lib/Bio/DB/DBI/ba
>>>> se.pm:227
>>>> STACK Bio::DB::BioSQL::BasePersistenceAdaptor::dbh
>>>> C:/Perl/site/lib/Bio/DB/BioSQL/BasePersistenceAdaptor.pm:1498
>>>> STACK Bio::DB::BioSQL::BasePersistenceAdaptor::rollback
>>>> C:/Perl/site/lib/Bio/DB/BioSQL/BasePersistenceAdaptor.pm:1417
>>>> STACK toplevel load_seqdatabase.pl:636
>>>> -------------------------------------
>>>>
>>>> I think I'm doing something wrong, but I can't find what. The mySQL
>>>> server (version 4.1.9) is on, I've installed the DBI and DBD::mySQL. I
>>>> checked the user for its privileges and password, so what can be wrong?
>>>>
>>>> I've tried writing a shorter script to get in the command that breaks
>>>> the process (below) and I found it was when it tries to ->create():
>>>>
>>>> #!perl
>>>>
>>>> use strict;
>>>> use Bio::DB::BioDB;
>>>> use Bio::SeqIO;
>>>>
>>>> my $seq_file = shift or die("GB_crawler.pl - Usage : perl
>>>> GB_crawler.pl <SEQ_FILE>\n\n");
>>>>
>>>> my $dbadp = Bio::DB::BioDB->new(    -database    => 'biosql',
>>>>                                     -host        => 'localhost',
>>>>                                     -user         => 'biodb_user',
>>>>                                     -pass        => 'THE_PASSWORD_HERE',
>>>>                                     -dbname       => 'biosql_hs',
>>>>                                     -driver       => 'mysql'
>>>> );
>>>> $dbadp->verbose(1);
>>>>
>>>> my $seqio_obj = Bio::SeqIO->new(-file => "<$seq_file", -format =>
>>>> 'genbank' ); while (my $seq_obj = $seqio_obj->next_seq()){
>>>>     print $seq_obj->display_id(),"\n";
>>>>     my $species = $seq_obj->species();
>>>>     my $seq_spec = $species->binomial();
>>>>     if ($seq_spec eq 'Homo sapiens') {    # I'm just interested in Hs
>>>> seq
>>>>         my $p_seq = $dbadp->create_persistent($seq_obj);
>>>>         $p_seq->create();
>>>>     }
>>>> }
>>>>
>>>> The output is: (I can't put all here, it' too long...)
>>>>
>>>> C:\tmp>perl GB_crawler.pl gbpri1.seq
>>>>
>>>> UNIVERSAL->import is deprecated and will be removed in a future perl
>>>> UNIVERSAL->at
>>>> C:/Perl/site/lib/Bio/Tree/TreeFunctionsI.pm line 94.
>>>> AB000095
>>>> attempting to load adaptor class for Bio::Seq::RichSeq
>>>>         attempting to load module Bio::DB::BioSQL::RichSeqAdaptor
>>>> attempting to load adaptor class for Bio::Seq
>>>>         attempting to load module Bio::DB::BioSQL::SeqAdaptor
>>>> instantiating adaptor class Bio::DB::BioSQL::SeqAdaptor
>>>>
>>>> .../...
>>>>
>>>> attempting to load adaptor class for Bio::Tree::TreeFunctionsI
>>>>         attempting to load module Bio::DB::BioSQL::
>>>> TreeFunctionsIAdaptor
>>>>         attempting to load module
>>>> Bio::DB::BioSQL::TreeFunctionsAdaptor
>>>> UNIVERSAL->import is deprecated and will be removed in a future perl
>>>> UNIVERSAL->at
>>>> C:/Perl/site/lib/Bio\Tree\TreeFunctionsI.pm line 94.
>>>> no adaptor found for class Bio::Tree::Tree no adaptor found for class
>>>> Bio::Annotation::TypeManager no adaptor found for class
>>>> Bio::DB::Taxonomy::list no adaptor found for class Bio::Tree::Tree
>>>> attempting to load adaptor class for BioNamespace
>>>>         attempting to load module Bio::DB::BioSQL::BioNamespaceAdaptor
>>>> instantiating adaptor class Bio::DB::BioSQL::BioNamespaceAdaptor
>>>> no adaptor found for class Bio::Annotation::TypeManager no adaptor
>>>> found for class Bio::DB::Taxonomy::list no adaptor found for class
>>>> Bio::Tree::Tree attempting to load driver for adaptor class
>>>> Bio::DB::BioSQL::
>>>> BioNamespaceAdaptor
>>>>
>>>> attempting to load driver for adaptor class Bio::DB::BioSQL::
>>>> BasePersistenceAdaptor
>>>> Using Bio::DB::BioSQL::mysql::BasePersistenceAdaptorDriver as driver
>>>> peer for Bio::DB::BioSQL::BioNamespaceAdaptor
>>>>
>>>> ------------- EXCEPTION -------------
>>>> MSG: failed to open connection:
>>>> STACK Bio::DB::DBI::base::new_connection
>>>> C:/Perl/site/lib/Bio/DB/DBI/ba
>>>> se.pm:267
>>>>
>>>> STACK Bio::DB::DBI::base::get_connection
>>>> C:/Perl/site/lib/Bio/DB/DBI/ba
>>>> se.pm:227
>>>>
>>>> STACK Bio::DB::BioSQL::BasePersistenceAdaptor::dbh
>>>> C:/Perl/site/lib/Bio/DB/BioSQL/BasePersistenceAdaptor.pm:1498
>>>> STACK Bio::DB::BioSQL::BaseDriver::insert_object
>>>> C:/Perl/site/lib/Bio/DB/
>>>> BioSQL/BaseDriver.pm:970
>>>> STACK Bio::DB::BioSQL::BasePersistenceAdaptor::create
>>>> C:/Perl/site/lib/Bio/DB/BioSQL/BasePersistenceAdaptor.pm:212
>>>> STACK Bio::DB::Persistent::PersistentObject::create
>>>> C:/Perl/site/lib/Bio/DB/Persistent/PersistentObject.pm:257
>>>> STACK Bio::DB::BioSQL::BasePersistenceAdaptor::create
>>>> C:/Perl/site/lib/Bio/DB/BioSQL/BasePersistenceAdaptor.pm:182
>>>> STACK Bio::DB::Persistent::PersistentObject::create
>>>> C:/Perl/site/lib/Bio/DB/Persistent/PersistentObject.pm:257
>>>> STACK toplevel GB_crawler.pl:52
>>>> -------------------------------------
>>>>
>>>> Again, the script halts asking for Perl514.dll, then the EXCEPTION MSG
>>>> appears...
>>>> Is there a chance ActivePerl 5.18 couldn't work with Bioperl-DB (I
>>>> have
>>>> 1.006000 version)?
>>>>
>>>> Thanks for any answer !
>>>>
>>>> Best regards
>>>>
>>>> Olivier
>>>>
>>>>
> --
>
> --------------------
>
> BUHARD Olivier
>
> "Instabilité de microsatellites et cancer"
> Centre de Recherche Saint Antoine
> équipe 11/INSERM UMRS 938
> Bâtiment Kourilsky,
> Hôpital Saint Antoine
> 34 rue Crozatier
> 75012 PARIS
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>



-- 
Hilmar Lapp -:- lappland.io




More information about the Bioperl-l mailing list