[Bio] / FigKernelPackages / Observation.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Observation.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Wed Jun 13 17:56:35 2007 UTC revision 1.6, Mon Jun 18 16:20:45 2007 UTC
# Line 5  Line 5 
5    
6  use strict;  use strict;
7  use warnings;  use warnings;
8    use Table;
9    
10  1;  1;
11    
# Line 335  Line 336 
336    # read identical proteins list of sequences    # read identical proteins list of sequences
337    get_identical_proteins($fid,\@matched_datasets);    get_identical_proteins($fid,\@matched_datasets);
338    
339      # read functional coupling
340      get_functional_coupling($fid,\@matched_datasets);
341    
342    # read sims + bbh (enrich BBHs with sims coordindates etc)    # read sims + bbh (enrich BBHs with sims coordindates etc)
343    # read pchs    # read pchs
344    # read figfam match data from 48hr directory (BobO knows how do do this!)    # read figfam match data from 48hr directory (BobO knows how do do this!)
# Line 537  Line 541 
541    
542      foreach my $id (@maps_to) {      foreach my $id (@maps_to) {
543          my ($tmp, $who);          my ($tmp, $who);
544          if (($id ne $fid) && ($tmp = $fig->function_of($fid))) {          if (($id ne $fid) && ($tmp = $fig->function_of($id))) {
545              if ($id =~ /^fig\|/)           { $who = "FIG" }              if ($id =~ /^fig\|/)           { $who = "FIG" }
546              elsif ($id =~ /^gi\|/)            { $who = "NCBI" }              elsif ($id =~ /^gi\|/)            { $who = "NCBI" }
547              elsif ($id =~ /^^[NXYZA]P_/)      { $who = "RefSeq" }              elsif ($id =~ /^^[NXYZA]P_/)      { $who = "RefSeq" }
# Line 570  Line 574 
574    
575  }  }
576    
577    =head3 get_functional_coupling() (internal)
578    
579    This methods retrieves the functional coupling of a protein given a peg ID
580    
581    =cut
582    
583    sub get_functional_coupling{
584    
585        my ($fid,$datasets_ref) = (@_);
586        my $fig = new FIG;
587        my @funcs = ();
588    
589        # initialize some variables
590        my($sc,$neigh);
591    
592        # set default parameters for coupling and evidence
593        my ($bound,$sim_cutoff,$coupling_cutoff) = (5000, 1.0e-10, 4);
594    
595        # get the fc data
596        my @fc_data = $fig->coupling_and_evidence($fid,$bound,$sim_cutoff,$coupling_cutoff,1);
597    
598        # retrieve data
599        my @rows = map { ($sc,$neigh) = @$_;
600                         [$sc,$neigh,scalar $fig->function_of($neigh)]
601                      } @fc_data;
602    
603        my ($dataset);
604        foreach my $row (@rows){
605            my $id = $row->[1];
606            my $score = $row->[0];
607            my $description = $row->[2];
608            $dataset = [ { name => 'class', value => "FC" },
609                         { name => 'score' , value => $score},
610                         { name => 'id', value => "$id"} ,
611                         { name => 'description' , value => $description}
612                         ];
613            push (@{$datasets_ref} ,$dataset);
614        }
615    }
616    
617  =head3 get_sims_and_bbhs() (internal)  =head3 get_sims_and_bbhs() (internal)
618    
# Line 695  Line 738 
738      return $self->{database};      return $self->{database};
739  }  }
740    
741    #package Observation::Identical;
742    #1;
743    #
744    #our @ISA = qw(Observation);  # inherits all the methods from Observation
745    
746    =head3 display_identical()
747    
748    If available use the function specified here to display the "raw" observation.
749    This code will display a table for the identical protein
750    
751    
752    B<Please note> that URL linked to in display_method() is an external component and needs to added to the code for every class of evidence.
753    
754    =cut
755    
756    sub display_identical {
757        my ($self, $fid, $cgi) = @_;
758    
759        my $content;
760        my $array=Observation->get_objects($fid);
761    
762        my $all_domains = [];
763        my $count_identical = 0;
764        foreach my $thing (@$array) {
765            next if ($thing->class ne "IDENTICAL");
766            my $single_domain = [];
767            push(@$single_domain,$thing->class);
768            my $id = $thing->id;
769            $count_identical++;
770            push(@$single_domain,&HTML::set_prot_links($cgi,$id));
771            push(@$single_domain,$thing->organism);
772            push(@$single_domain,$thing->database);
773            push(@$single_domain,$thing->description);
774            push(@$all_domains,$single_domain);
775        }
776    
777        if ($count_identical >0){
778            my $table_component = $self->application->component('DomainTable');
779    
780            $table_component->columns ([ { 'name' => 'Name', 'filter' => 1 },
781                                         { 'name' => 'ID' },
782                                         { 'name' => 'Organism' },
783                                         { 'name' => 'Database' },
784                                         { 'name' => 'Assignment' }
785                                         ]);
786            $table_component->data($all_domains);
787            $table_component->show_top_browse(1);
788            $table_component->show_bottom_browse(1);
789            $table_component->items_per_page(50);
790            $table_component->show_select_items_per_page(1);
791            $content .= $table_component->output();
792        }
793        else{
794            $content = "<p>This PEG does not have any essentially identical proteins</p>";
795        }
796        return ($content);
797    }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3