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

Elena Grassi grassi.e at gmail.com
Fri Jul 5 11:36:49 BST 2013


Hello, I've looked around in the mailing list and I did not find any
answer (or old ones not working anymore with the new APIs,
like http://lists.ensembl.org/ensembl-dev/msg03089.html).
I would like to extract all the GOslim-goa terms associated to all the
human ENSG, also considering the annotations derived from the
ontology graph (ie if termA is an ancestor of termB and gene1 is
associated with termB I would like to also get the association
gene1-termA).

I've tried with the perl API's (version 72) but without luck, the
relevant portion of the code is:

foreach my $gene (@$genes) {

print_DBEntries($gene->get_all_object_xrefs("goslim_goa",12700),
$gene->stable_id());
        }

sub print_DBEntries
{
    my $db_entries = shift;
    my $gene = shift;

    foreach my $dbe ( @{$db_entries} ) {
        print STDERR $dbe->dbname() . "\n";
        #if ($dbe->dbname()  =~ /^goslim_goa/i) {
                print $gene . "\t" . $dbe->display_id() . "\t" .
$dbe->description() . "\n";
        #}
    }
}

but this does not print anything (I tried removing the parameters in
get_all_object_xrefs with no luck...I did not
see any dbe->dbname() that resembles GO when I printed all found xrefs...).
What puzzles me is that this SQL query works (ok, it is giving me
duplicates but I don't mind at this point):

mysql> 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;

Right now I would like to know what I'm missing about the perl API and
if the results gotten with this SQL query are what I need
in term of graph traversal (it seems so looking at the data but I
would like to be sure).

Thank you very much for your help (and the tightly normalized DB with
some exceptions that spared me another join :) ).
E.

--
$ pom




More information about the Dev mailing list