seedlot upload with accession synonyms. seedlot upload works to update existing seedlots
[sgn.git] / lib / SGN / Controller / AJAX / TeaApi.pm
blobcf4a46b778e6a7345521e07acb9305cf5bcae125
2 package SGN::Controller::AJAX::TeaApi;
4 use Moose;
6 BEGIN { extends 'Catalyst::Controller::REST' }
8 __PACKAGE__->config(
9 default => 'application/json',
10 stash_key => 'rest',
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
20 # my @errors;
22 # my @gene_array;
23 # my %descriptions;
24 # my %gene_ids;
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);
33 # } else {
34 # push(@gene_array, $gene_name);
35 # }
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(),
44 # });
46 # $gene_ids{$gene_name} = $feature->feature_id();
47 # $descriptions{$gene_name} = $fp->value();
48 # }
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};
54 # return;
55 # }
56 # else {
57 # $c->stash->{rest} = {
58 # gene_id=>\%gene_ids,
59 # description=>\%descriptions
60 # };
61 # }
62 # }