Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

Fwd: Help

Danny Yoo danny.yoo at gmail.com
Mon Aug 2 11:31:50 PDT 2004


[Forgot to keep gofriends at genome.stanford.edu in CC; sorry about that]


---------- Forwarded message ----------
From: Danny Yoo <danny.yoo at gmail.com>
Date: Mon, 2 Aug 2004 18:30:30 +0000
Subject: Re: Help
To: "Benoist, Christophe" <christophe.benoist at joslin.harvard.edu>

On Mon, 2 Aug 2004 08:01:52 -0400, Benoist, Christophe
<christophe.benoist at joslin.harvard.edu> wrote:
> Help !
> We are trying to obtain lists of all GO numbers that are children or grandchildren of a given GO number (list below, if anyone is tempted). Can't find any such function on any of the sites. Any suggestions as how to proceed, and/or strategy that would do the trick?


Hi Christophe,

Using the GO API might be a good way to do this.  For example:

###
#!/usr/bin/perl -w

## Small program to print out the descendents of a particular term.
## Arguments: argv[0]:  acc number

use strict;
use warnings;
use GO::AppHandle;
use GO::Parser;

my $graph = getGraph();
my $term = $graph->get_term({acc=>$ARGV[0]});
printChildren($graph, $term);

## Note: to make this faster, use the database instead of the flat
## files as a source.
sub getGraph {
    my $parser = GO::Parser->new({handler => "obj"});
    $parser->parse("component.ontology");
    my $graph = $parser->handler->graph;
    return $graph;
}

## Prints a list of a term's descendents
sub printDescendents {
    my ($graph, $term) = @_;
    my $iter = $graph->create_iterator($term);
    while (my $t = $iter->next_node) {
        print $t->{name}, "\t", $t->acc, "\n";
    }
}
###

This program is written to read off the flat files, but you can easily
change it to read from the MySQL database instead.  Here's a sample of
what it does:

###
[dyoo at tesuque ontology]$ perl find_children.pl GO:0048196
extracellular matrix (sensu Magnoliophyta)      GO:0048196
primary cell wall       GO:0009530
cellulose microfibril   GO:0009549
glycoprotein network    GO:0048222
hemicellulose network   GO:0048223
pectic matrix   GO:0048217
secondary cell wall     GO:0009531
Casparian strip GO:0048226
cellulose microfibril   GO:0009549
hemicellulose network   GO:0048223
lignin network  GO:0048224
pectic matrix   GO:0048217
suberin network GO:0048225
###

See:

    http://www.godatabase.org/dev/

for more details about the perl-api module.  Hope this helps!

--
This message is from the GOFriends moderated mailing list.  A list of public
announcements and discussion of the Gene Ontology (GO) project.
Problems with the list?           E-mail: owner-gofriends at geneontology.org
Subscribing   send   "subscribe"   to   gofriends-request at geneontology.org
Unsubscribing send   "unsubscribe"  to  gofriends-request at geneontology.org
Web:          http://www.geneontology.org/



More information about the go-friends mailing list