4 use CXGN
::Scrap
::AjaxPage
;
5 use CXGN
::DB
::Connection
;
8 use CXGN
::People
::Person
;
11 use CXGN
::Phenome
::Locus
;
12 use CXGN
::Chado
::Cvterm
;
18 my $doc = CXGN
::Scrap
::AjaxPage
->new();
19 $doc->send_http_header();
21 my $json = JSON
->new();
23 my ($locus_id) = $doc->get_encoded_arguments("locus_id");
25 my $dbh = CXGN
::DB
::Connection
->new();
26 my ($login_person_id, $login_user_type)=CXGN
::Login
->new($dbh)->verify_session();
28 if ($login_user_type eq 'curator' || $login_user_type eq 'submitter' || $login_user_type eq 'sequencer') {
33 my $available_cvterms;
35 my $locus = CXGN
::Phenome
::Locus
->new($dbh, $locus_id);
37 my $locus_pub_ranks=$locus->get_locus_pub(); # this sets cvterm_ranks
38 my $cvterm_total_ranks=$locus->get_cvterm_ranks();
40 my @sorted_cvterms = sort{$cvterm_total_ranks->{$b} <=> $cvterm_total_ranks->{$a}} keys %$cvterm_total_ranks;
41 foreach my $cvterm_id (@sorted_cvterms) {
42 my $rank= $cvterm_total_ranks->{$cvterm_id};
43 my $cvterm=CXGN
::Chado
::Cvterm
->new($dbh, $cvterm_id);
44 my $dbxref_id=$cvterm->get_dbxref_id();
45 my $db_name=$cvterm->get_db_name();
46 my $cv_name=$cvterm->get_cv_name();
47 my $accession= $cvterm->get_accession();
48 my $cvterm_name= $cvterm->get_cvterm_name();
50 $available_cvterms .="$dbxref_id*$cv_name:$db_name:$accession--$cvterm_name ($rank)|";
51 $response{$dbxref_id}= "$cv_name:$db_name:$accession--$cvterm_name ($rank)";
56 $response{"error"} = "get_locus_cvterms failed! " . $@
;
58 $jobj = $json->objToJson(\
%response); # replaced by 'encode' but not on the old version of JSON in Rubisco!