added some POD.
[sgn.git] / cgi-bin / content / sgn_data.pl
blob3dc898093737c98e201067ee5e1a3a3c0140a84d
1 use strict;
3 use CXGN::Page;
5 use CXGN::Chado::Organism;
6 use CXGN::DB::DBICFactory;
9 # Script to display the major data content of sgn
10 # Naama Menda, April 2010
14 my $page = CXGN::Page->new("SGN data overview page", "Naama");
15 #my ($force) = $page->get_encoded_arguments("force");
18 my $schema = CXGN::DB::DBICFactory
19 ->open_schema( 'Bio::Chado::Schema',
20 search_path => ['public'],
25 my $type = 'web visible'; # we want only the leaf organisms with 'web visible' organismprop
26 my $cvterm = $schema->resultset("Cv::Cvterm")->search( { name => $type } )->first();
29 my $sol=();
30 my $rub=();
31 my $planta=();
34 if ($cvterm) {
35 my $cvterm_id = $cvterm->get_column('cvterm_id');
37 my @organisms= $schema->resultset("Organism::Organismprop")->search(
38 { type_id => $cvterm_id } )->search_related('organism');
40 foreach my $organism(@organisms) {
42 my $species = $organism->get_column('species');
43 my $genus= $organism->get_column('genus');
44 my $organism_id = $organism->get_column('organism_id');
45 my $o=CXGN::Chado::Organism->new($schema, $organism_id);
46 my $root_tax=$o->get_organism_by_tax('family');
47 if ($root_tax) {
48 my $family = $root_tax->species();
49 $sol->{$species}= $organism_id if $family eq 'Solanaceae' ;
50 $rub->{$species}= $organism_id if $family eq 'Rubiaceae' ;
51 $planta->{$species}= $organism_id if $family eq 'Plantaginaceae' ;
55 ##########
57 $c->forward_to_mason_view("/content/sgn_data.mas" , schema=>$schema, sol=>$sol, rub=>$rub, planta=>$planta );