[ensembl-dev] Extracting all GOslim-goa (or GO) annotations for every ENSG.

Magali mr6 at ebi.ac.uk
Mon Jul 8 17:41:02 BST 2013


Hi Elena,

The issue here is that the fetch_all_by_descendant_term method, and all
similar methods dealing with ontology terms, have their own API.

With the get_all_DBLinks method, you can fetch xrefs for an object, and
some of these objects can be ontology accession.
But an xref object only has limited information that does not cover all
the complexity of ontology objects.

To deal with this, we have a separate database, the ontology database,
which contains not only ontology accessions, but also the whole
definition as in GO as well as the links between ontology terms.

In your script2, goslim is still a DBEntry object (or xrefs).
To be able to access the meta information about ontologies, you need to
create an OntologyTerm object using the GO accession.

    my $accession = $goslim->display_id();
    my $go_term = $goa->fetch_by_accession($accession);

>From there on, you should be able to use methods like
fetch_all_by_descendant_term on that go term.

    $goa->fetch_all_by_descendant_term($go_term);

Note we do not need to restrict the method to a specific external_db
(like goslim_goa), because we already are in the realm of ontologies.

I hope that helps.


Regards,
Magali


On 06/07/13 09:10, Elena Grassi wrote:
> I'm sorry to bother you but I'm puzzled (again) by the comparisons
> between the query-script v1-script with ancenstors results (apart from
> the difference in time...the query is almost instantaneous while the
> perl script are really slow).
>
> Number of line resulting from the first script, the version that calls
> fetch_all_by_parent_term and the SQL query:
> data at tungsteno:/rogue/bioinfotree/prj/expr_evol/local/src$ sort
> goslim_api.tsv | uniq | wc -l
> 216713
> data at tungsteno:/rogue/bioinfotree/prj/expr_evol/local/src$ sort
> goslim_inclusive_api.tsv | uniq | wc -l
> 216713
> data at tungsteno:/rogue/bioinfotree/prj/expr_evol/local/src$ sort
> goslim_api.tsv | uniq | wc -l
> 216713
>
> They are all the same!
>
> script1 relevant part:
>
>         foreach my $gene (@$genes) {
>                 print_DBEntries($gene->get_all_DBLinks('goslim_goa'),
> $gene->stable_id());
>         }
>
> sub print_DBEntries
> {
>     my $db_entries = shift;
>     my $gene = shift;
>
>     foreach my $dbe ( @{$db_entries} ) {
>         print $gene . "\t" . $dbe->display_id() . "\t" .
> $dbe->description() . "\n";
>     }
> }
>
> script2:
>         foreach my $gene (@$genes) {
>                 my $goslims = $gene->get_all_DBLinks('goslim_goa');
>                 foreach my $goslim (@$goslims) {
>                         bless $goslim, 'Bio::EnsEMBL::OntologyTerm';
>                         if (!defined($ancestors{$goslim})) {
>                                 my $goa = $registry->get_adaptor(
> 'Multi', 'Ontology', 'OntologyTerm' );
>                                 $ancestors{$goslim} =
> $goa->fetch_all_by_descendant_term($goslim, 'goslim_goa');
>                         }
>                         bless $goslim, 'Bio::EnsEMBL::DBEntry';
>                         print $gene->stable_id() . "\t" .
> $goslim->display_id() . "\t" . $goslim->description() . "\n";
>                         foreach my $ancestor (@{ $ancestors{$goslim} }) {
>                                 print $gene->stable_id() . "\t" .
> $ancestor->display_id() . "\t" . $ancestor->description() . "\n";
>                         }
>                 }
>
>         }
>
> SQL:
> select g.stable_id,x.dbprimary_acc,x.description from xref as x,
> object_xref as o, transcript as t, translation as tr, gene as g where
> x.external_db_id = "12700" AND o.xref_id=x.xref_id and g.gene_id =
> t.gene_id AND t.transcript_id = tr.transcript_id AND tr.translation_id
> = o.ensembl_id;
>
> Thanks,
> E.
>
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> Posting guidelines and subscribe/unsubscribe info: http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20130708/b9fa832e/attachment.html>


More information about the Dev mailing list