cv for average = 0
[sgn.git] / cgi-bin / chado / organism_query.pl
blob36c30e7a39c8d73c47706119122e216e5547d8e1
1 use Bio::Chado::Schema;
2 use strict;
3 use warnings;
4 use JSON;
5 use CXGN::Scrap::AjaxPage;
7 use CatalystX::GlobalContext '$c';
9 my $doc = CXGN::Scrap::AjaxPage->new();
10 $doc->send_http_header();
12 my ($species) = $doc->get_encoded_arguments("species");
14 my $json = JSON->new();
16 my $schema = $c->dbic_schema('Bio::Chado::Schema', 'sgn_chado');
18 my $org_rs = $schema->resultset("Organism::Organism")->search({species=>{'ilike'=>'%'.$species.'%'}});
20 my %species;
22 while (my $org = $org_rs->next){
23 $species{$org->organism_id()}=$org->species();
26 my $jobj = $json->encode(\%species);
27 print "$jobj";