2 package SGN
::Controller
::AJAX
::TeaApi
;
6 BEGIN { extends
'Catalyst::Controller::REST' }
9 default => 'application/json',
11 map => { 'application/json' => 'JSONP', 'text/html' => 'JSONP' },
15 # API to get the functional description for an array of genes
16 # sub get_gene :Path('/api/tea') :Args(0) {
17 # my ($self, $c) = @_;
19 # # to store erros as they happen
26 # # get variables from catalyst object
27 # my $gene_name = $c->req->param("gene_name");
29 # print STDERR "genes: $gene_name\n";
31 # if ($gene_name =~ /\,/) {
32 # @gene_array = split(/,/, $gene_name);
34 # push(@gene_array, $gene_name);
37 # foreach my $gene_name (@gene_array) {
38 # my $schema = $c->dbic_schema("Bio::Chado::Schema");
39 # my $feature = $schema->resultset("Sequence::Feature")->find( { uniquename=> { like => 'mRNA:'.$gene_name.'%' } });
40 # my $cv = $schema->resultset("Cv::Cvterm")->find( { name=> 'Note' } );
41 # my $fp = $schema->resultset("Sequence::Featureprop")->find({
42 # feature_id=> $feature->feature_id(),
43 # type_id=>$cv->cvterm_id(),
46 # $gene_ids{$gene_name} = $feature->feature_id();
47 # $descriptions{$gene_name} = $fp->value();
50 # # Send error message to the web if something is wrong
51 # if (scalar (@errors) > 0){
52 # my $user_errors = join("<br />", @errors);
53 # $c->stash->{rest} = {error => $user_errors};
57 # $c->stash->{rest} = {
58 # gene_id=>\%gene_ids,
59 # description=>\%descriptions