[ensembl-dev] Bio::LocatableSeq::end warning message

Chris Fields cjfields at illinois.edu
Tue Mar 8 18:12:43 GMT 2011


On Mar 8, 2011, at 11:38 AM, Giuseppe G. wrote:

> On 08/03/11 17:23, Chris Fields wrote:
>> I don't think so, but it should be easy enough to find by setting verbose to 2 (which converts warnings to errors with stack trace).  Similarly, to squash warnings one can set verbose to -1.
>> 
> 
> Hi Chris,
> 
> sorry which verbose flag are you referring to?

Normally, one just has to set the verbose flag with a new instance, or set verbosity using the verbose() method:

  Bio::SeqIO->new(
    -format => 'fasta',
    -verbose => 1  # turns on debugging
  );

  # or...
  
  # turn off warnings for this instance
  $bio_obj->verbose(-1);

However, the above works mainly for top-level instances (the Bio::SimpleAlign in this case).  Verbosity may or may not be passed on to contained objects, and in the case of SimpleAlign it does not pass this on to any contained LocatableSeqs.  However, one can globally change the verbosity for any BioPerl objects/classes (the use of $DEBUG flag is a bit hacky, but it works with bioperl 1.6.1):

use strict;
use warnings;
use Bio::EnsEMBL::Registry;

# globally turn off BioPerl warnings
use Bio::Root::Root;
$Bio::Root::Root::DEBUG = -1;

Bio::EnsEMBL::Registry->load_registry_from_db(
-HOST => 'mysql.ebi.ac.uk',-PORT => 4157, -USER => 'anonymous',
-DB_VERSION => 61,
);
my $dba = Bio::EnsEMBL::Registry->get_DBAdaptor('pan_homology',
'compara');
my $ha = $dba->get_HomologyAdaptor();
my $ma = $dba->get_MemberAdaptor();
my $stable_id = 'ESTEXT_FGENESH1_KG.C_4000003';
my $member = $ma->fetch_by_source_stable_id('ENSEMBLGENE', $stable_id);
my $homologies = $ha->fetch_all_by_Member($member);

foreach my $h (@{$homologies}) {
    my $sa = $h->get_SimpleAlign();
    warn $sa->overall_percentage_identity();
}


chris



More information about the Dev mailing list