stash analysis logfile data for histogram construction
[sgn.git] / cgi-bin / phenome / individual_browser.pl
blob49000f2a9805c82c0cddc36845a0cbd00e78b005
1 use strict;
2 use warnings;
4 use CXGN::Scrap::AjaxPage;
5 use CXGN::Login;
6 use JSON;
8 my $doc = CXGN::Scrap::AjaxPage->new();
9 $doc->send_http_header();
10 my ($stock_name, $locus_id, $type, $allele_id, $stock_id) = $doc->get_encoded_arguments("stock_name", "locus_id", "type", "allele_id" , "stock_id");
12 my $dbh = CXGN::DB::Connection->new();
14 my($login_person_id, $login_user_type)=CXGN::Login->new($dbh)->verify_session();
16 if ($login_user_type eq 'curator' || $login_user_type eq 'submitter' || $login_user_type eq 'sequencer') {
18 if ($type eq 'browse') {
19 my $query = $dbh->prepare("SELECT stock_id, name, description FROM public.stock WHERE stock.name ilike ? ");
20 $query->execute("\%$stock_name\%");
21 my $available_stocks;
22 while ( my ($stock_id, $name, $desc) = $query->fetchrow_array() ) {
23 $available_stocks .= "$stock_id*$name--$desc|";
25 print "$available_stocks";
27 #search from the allele page. Fiter only the existing individuals associated with $allele.
28 #obsolete individual-allele association
29 elsif ($type eq 'obsolete') {
30 eval {
31 my $query = "delete from phenome.stock_allele WHERE stock_id = ? AND allele_id = ? ";
32 my $sth= $dbh->prepare($query);
33 $sth->execute($stock_id, $allele_id);
35 if ($@) {
36 warn "stock-allele obsoletion failed! " . $@ ;