[ensembl-dev] Problem with Compara

Javier Herrero jherrero at ebi.ac.uk
Wed Dec 15 22:44:09 GMT 2010


Hi Daniel

The problem is that you are using a method that expects a 
Bio::EnsEMBL::Compara::Member object and you are passing an undef value.

The sanity check in the API might look like an annoyance, but the lack of 
check or silently ignoring the error might create more serious problems in the 
long run.

In this case, I would recommend to check that $member is defined before you try 
to fetch the homologues:

foreach $stable_id (@list_of_stable_ids) {

  my $member = $member_adaptor->fetch_by_source_stable_id(undef, $stable_id);

  next if (!$member); # will avoid the error

  my $homologies = $homology_adaptor->fetch_all_by_....(...,$member,...);

}

I hope this helps

Javier

On Wednesday 15 Dec 2010 09:36:07 Daniel Murphy wrote:
> Hi there,
> 
> I have a slight problem with a script I've written to find orthologs for a
> list of mouse genes using the Ensembl Compara database. I have a large list
> of genes and whenever I run the script I get an error message at some point
> saying:
> 
> Can't call method "isa" on an undefined value at
> /Network/.../Bio/EnsEMBL/Compara/DBSQL/HomologyAdaptor.pm
> line 185
> 
> When I remove the offending gene id from the list I'll get the error again
> because of some other gene. This has happened to me before because of genes
> no longer being in a new version of EnsEMBL, in this case however the genes
> are in the latest EnsEMBL version but they aren't in the compara database,
> perhaps because some of them may be predicted. The problem is whenever the
> script comes across one of these genes the program exits instead of just
> ignoring the gene and going to the next one. Rather than going through my
> entire list of genes and manually removing any that aren't in the compara
> database I'd like to just be able to skip any of the genes that aren't
> found, so rather than the program exiting once it comes across a gene that
> isn't in the database I'd like it to just continue with the next gene.
> Is there any way to go about this? I appreciate any suggestions you might
> have.
> 
> Regards,
> 
> Daniel Murphy

-- 
Javier Herrero, PhD
Ensembl Compara Project Leader
European Bioinformatics Institute (EMBL-EBI)
Wellcome Trust Genome Campus, Hinxton
Cambridge - CB10 1SD - UK




More information about the Dev mailing list