AmiGO development

From GO Wiki
Jump to: navigation, search


This is a page for developers hash out API specs and other development issues.

AmiGO Layer

It would be nice to start working out common returns classes for the AmiGO layer functions. We could stash them all in and have them be the currency for everything below. These would be able to be dropped into a template (or other rendering interface) and need as little additional attention as possible.

Off the top of may head from things displayed in AmiGO so far and ignoring tree stuff, we'd need:

  • A term-like class
  • An association-like class
  • A list thingy that would have a main value, an ordering value, and a flexible number of additional informational fields (maybe lists)

I'm not sure where would be the best place to put URL creation in all of this.

AmiGO::Session (?)

A layer between filesystem session storage (should be migratable to mod_perl) and AmiGO top-level. An example of use might be:

## Init.
my $session = AmiGO::Session->new();

## Get the one that the user wanted or start another to a default state.
$session->create() if ! $session->success;
## Collect some rendering information to be passed later.
my $page_size = $session->get_element('pref_pagesize');
## Work with a more complicated piece.
my $cart_array = $session->get_element('object_gocart');
push @{$cart_array}, $new_item;
$session->store_element('object_gocart', $cart_array);


A layer between go-perl and AmiGO top-level for handling IO.

Currently, because of the way that GO::Parser is implemented, it requires its input to be a file (even though Data::Stag::BaseGenerator doesn't require it). To get around this, the filehandle is written out and and passed in via a temporary file, thus the need to initialize with a scratch directory. Kludge.

An example of use might be:

my $reader = AmiGO::Reader->new('go_ids', 'sessions/scratch'); # create a go_ids reader
my $fh = new IO::Scalar \$slim_list; # convert to filehandle
my $graph = $reader->readh($fh); # convert to graph
die_template("Failed on term input ($type): " . $reader->error_message)
   if ! $reader->success;

The API as it stands now:

my @EXPORT = qw(new readh success error_message);
## Takes GO::Parser handler strings and a scratch directory as
## arguements.
my $reader = AmiGO::Reader->new($wanted_go_handler, $writable_directory);
## Convert the filehandle into a graph.
my $graph = $reader->readh($fh);
## Return 1 or 0 for all operations.
## Returns the reason for the above error.


The API as it stands now:

my @EXPORT = qw(new success error_message
                get_ontology_mappings get_association_mappings
                get_counts get_columns add_graph);
my @EXPORT_OK = qw(map_to_subset);
## Takes an ontology graph, slim graph, and a binary argument for
## whether or not to use buckets.
my $slimmer = AmiGO::Slimmer->new($ont_graph, $slim_graph, $use_bucket_p)
## Adds a graph to the Slimmer object. Probably from a go_assoc file.
## Returns an array ref to an array of hashes containing data like:
## acc, name, counts, obsolete_p, bucket_term_p, etc.
## Returns an array of arrays containing columns for a new gene association file.
## Not a good method. Not sure what a more appropriate return
## system should be.
## The returning data structures are an array ref of hashes where:
##    array[0]{ACC} == <acc>
##    array[0]{LEAVES} == <a ref to an array of the leaf accs>
##    array[0]{ALL} == <a ref to an array of the all accs>
## Returns an array ref to an array of two array refs. The first is an
## array of the slim terms to which the $acc hits first while climbing
## the tree. The second is all ancestors in the slim.
## Returns 1 or 0 after all operations
## Returns an error message related to the reason for failure for
## all operations.


TODO (done but session interface, needs to be cleaned and posted) -sjc