[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.11, Thu Jun 21 21:15:23 2007 UTC revision 1.12, Fri Jun 22 00:22:32 2007 UTC
# Line 118  Line 118 
118    
119  =item PFAM (dom)  =item PFAM (dom)
120    
121  =item SIGNALP (dom)  =item SIGNALP_CELLO_TMPRED (loc)
   
 =item  CELLO(loc)  
122    
123  =item TMHMM (loc)  =item TMHMM (loc)
124    
# Line 287  Line 285 
285  }  }
286    
287    
288  =head3 display_method()  =head3 display()
   
 If available use the function specified here to display the "raw" observation.  
 In the case of a BLAST alignment of fid1 and fid2 a cgi script  
 will be called to display the results of running the command "bl2seq fid1 fid2".  
289    
290  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.  will be different for each type
291    
292  =cut  =cut
293    
# Line 411  Line 405 
405          get_functional_coupling($fid,\@matched_datasets);          get_functional_coupling($fid,\@matched_datasets);
406      }      }
407      else{      else{
         #IPR,CDD,CELLO,PFAM,SIGNALP - attribute based  
408          my %domain_classes;          my %domain_classes;
409          my $identical_flag=0;          my $identical_flag=0;
410          my $pch_flag=0;          my $pch_flag=0;
411            my $location_flag = 0;
412          my $sims_flag=0;          my $sims_flag=0;
413          foreach my $class (@$classes){          foreach my $class (@$classes){
414              if($class =~ /(IPR|CDD|PFAM)/){              if($class =~ /(IPR|CDD|PFAM)/){
# Line 428  Line 422 
422              {              {
423                  $pch_flag = 1;                  $pch_flag = 1;
424              }              }
425                elsif ($class =~/(SIGNALP_CELLO_TMPRED)/)
426                {
427                    $location_flag = 1;
428                }
429              elsif ($class eq "SIM")              elsif ($class eq "SIM")
430              {              {
431                  $sims_flag = 1;                  $sims_flag = 1;
# Line 450  Line 448 
448              get_sims_observations($fid,\@matched_datasets);              get_sims_observations($fid,\@matched_datasets);
449          }          }
450    
451          #add CELLO and SignalP later          if ($location_flag == 1)
452            {
453                get_attribute_based_location_observations($fid,\@matched_datasets);
454            }
455    
456      }      }
457    
458      foreach my $dataset (@matched_datasets) {      foreach my $dataset (@matched_datasets) {
# Line 464  Line 466 
466          if ($dataset->{'class'} eq "IDENTICAL"){          if ($dataset->{'class'} eq "IDENTICAL"){
467              $object = Observation::Identical->new($dataset);              $object = Observation::Identical->new($dataset);
468          }          }
469            if ($dataset->{'class'} eq "SIGNALP_CELLO_TMPRED"){
470                $object = Observation::Location->new($dataset);
471            }
472          if ($dataset->{'class'} eq "SIM"){          if ($dataset->{'class'} eq "SIM"){
473              $object = Observation::Sims->new($dataset);              $object = Observation::Sims->new($dataset);
474          }          }
# Line 585  Line 590 
590      }      }
591  }  }
592    
593    sub get_attribute_based_location_observations{
594    
595        my ($fid,$datasets_ref) = (@_);
596        my $fig = new FIG;
597    
598        my $location_attributes = ['SignalP','CELLO','TMPRED'];
599    
600        my $dataset = {'type' => "loc", 'class' => 'SIGNALP_CELLO_TMPRED'};
601        foreach my $attr_ref ($fig->get_attributes($fid,$location_attributes)) {
602            my $key = @$attr_ref[1];
603            my @parts = split("::",$key);
604            my $sub_class = $parts[0];
605            my $sub_key = $parts[1];
606            my $value = @$attr_ref[2];
607            if($sub_class eq "SignalP"){
608                if($sub_key eq "cleavage_site"){
609                    my @value_parts = split(";",$value);
610                    $dataset->{'cleavage_prob'} = $value_parts[0];
611                    $dataset->{'cleavage_loc'} = $value_parts[1];
612                }
613                elsif($sub_key eq "signal_peptide"){
614                    $dataset->{'signal_peptide_score'} = $value;
615                }
616            }
617            elsif($sub_class eq "CELLO"){
618                $dataset->{'cello_location'} = $sub_key;
619                $dataset->{'cello_score'} = $value;
620            }
621            elsif($sub_class eq "TMPRED"){
622                my @value_parts = split(";",$value);
623                $dataset->{'tmpred_score'} = $value_parts[0];
624                $dataset->{'tmpred_locations'} = $value_parts[1];
625            }
626        }
627    
628        push (@{$datasets_ref} ,$dataset);
629    
630    }
631    
632    
633  =head3 get_attribute_based_evidence (internal)  =head3 get_attribute_based_evidence (internal)
634    
635  This method retrieves evidence from the attribute server  This method retrieves evidence from the attribute server
# Line 1136  Line 1181 
1181      push(@$descriptions,$score);      push(@$descriptions,$score);
1182    
1183      my $link_id;      my $link_id;
1184      if ($thing->acc =~/CDD::(\d+)/){      if ($thing->acc =~/\w+::(\d+)/){
1185          $link_id = $1;          $link_id = $1;
1186      }      }
1187    
1188      my $link;      my $link;
1189        my $link_url;
1190        if ($thing->class eq "CDD"){$link_url = "http://0-www.ncbi.nlm.nih.gov.library.vu.edu.au:80/Structure/cdd/cddsrv.cgi?uid=$link_id"}
1191        elsif($thing->class eq "PFAM"){$link_url = "http://www.sanger.ac.uk/cgi-bin/Pfam/getacc?$link_id"}
1192        else{$link_url = "NO_URL"}
1193    
1194      $link = {"link_title" => $thing->acc,      $link = {"link_title" => $thing->acc,
1195               "link" => "http://0-www.ncbi.nlm.nih.gov.library.vu.edu.au:80/Structure/cdd/cddsrv.cgi?uid=$link_id"};               "link" => $link_url};
1196      push(@$links_list,$link);      push(@$links_list,$link);
1197    
1198      my $element_hash = {      my $element_hash = {
# Line 1163  Line 1213 
1213    
1214  #########################################  #########################################
1215  #########################################  #########################################
1216    package Observation::Location;
1217    
1218    use base qw(Observation);
1219    
1220    sub new {
1221    
1222        my ($class,$dataset) = @_;
1223        my $self = $class->SUPER::new($dataset);
1224        $self->{cleavage_prob} = $dataset->{'cleavage_prob'};
1225        $self->{cleavage_loc} = $dataset->{'cleavage_loc'};
1226        $self->{signal_peptide_score} = $dataset->{'signal_peptide_score'};
1227        $self->{cello_location} = $dataset->{'cello_location'};
1228        $self->{cello_score} = $dataset->{'cello_score'};
1229        $self->{tmpred_score} = $dataset->{'tmpred_score'};
1230        $self->{tmpred_locations} = $dataset->{'tmpred_locations'};
1231    
1232        bless($self,$class);
1233        return $self;
1234    }
1235    
1236    sub display {
1237        my ($thing,$gd,$fid) = @_;
1238    
1239        my $fig= new FIG;
1240        my $length = length($fig->get_translation($fid));
1241    
1242        my $cleavage_prob;
1243        if($thing->cleavage_prob){$cleavage_prob = $thing->cleavage_prob;}
1244        my ($cleavage_loc_begin,$cleavage_loc_end) = split("-",$thing->cleavage_loc);
1245        my $signal_peptide_score = $thing->signal_peptide_score;
1246        my $cello_location = $thing->cello_location;
1247        my $cello_score = $thing->cello_score;
1248        my $tmpred_score = $thing->tmpred_score;
1249        my @tmpred_locations = split(",",$thing->tmpred_locations);
1250    
1251        my $lines = [];
1252        my $line_config = { 'title' => 'Localization Evidence',
1253                            'short_title' => 'Local',
1254                            'basepair_offset' => '1' };
1255    
1256        #color is
1257        my $color = "5";
1258    
1259        my $line_data = [];
1260    
1261        if($cello_location){
1262            my $cello_descriptions = [];
1263            my $description_cello_location = {"title" => 'Best Cello Location',
1264                                              "value" => $cello_location};
1265    
1266            push(@$cello_descriptions,$description_cello_location);
1267    
1268            my $description_cello_score = {"title" => 'Cello Score',
1269                                           "value" => $cello_score};
1270    
1271            push(@$cello_descriptions,$description_cello_score);
1272    
1273            my $element_hash = {
1274                "title" => "CELLO",
1275                "start" => "1",
1276                "end" =>  $length + 1,
1277                "color"=> $color,
1278                "type" => 'box',
1279                "zlayer" => '2',
1280                "description" => $cello_descriptions};
1281    
1282            push(@$line_data,$element_hash);
1283        }
1284    
1285        my $color = "6";
1286        #if(0){
1287        if($tmpred_score){
1288            foreach my $tmpred (@tmpred_locations){
1289                my $descriptions = [];
1290                my ($begin,$end) =split("-",$tmpred);
1291                my $description_tmpred_score = {"title" => 'TMPRED score',
1292                                 "value" => $tmpred_score};
1293    
1294                push(@$descriptions,$description_tmpred_score);
1295    
1296                my $element_hash = {
1297                "title" => "transmembrane location",
1298                "start" => $begin + 1,
1299                "end" =>  $end + 1,
1300                "color"=> $color,
1301                "zlayer" => '5',
1302                "type" => 'smallbox',
1303                "description" => $descriptions};
1304    
1305                push(@$line_data,$element_hash);
1306            }
1307        }
1308    
1309        my $color = "1";
1310        if($signal_peptide_score){
1311            my $descriptions = [];
1312            my $description_signal_peptide_score = {"title" => 'signal peptide score',
1313                                                    "value" => $signal_peptide_score};
1314    
1315            push(@$descriptions,$description_signal_peptide_score);
1316    
1317            my $description_cleavage_prob = {"title" => 'cleavage site probability',
1318                                             "value" => $cleavage_prob};
1319    
1320            push(@$descriptions,$description_cleavage_prob);
1321    
1322            my $element_hash = {
1323                "title" => "SignalP",
1324                "start" => $cleavage_loc_begin - 2,
1325                "end" =>  $cleavage_loc_end + 3,
1326                "type" => 'bigbox',
1327                "color"=> $color,
1328                "zlayer" => '10',
1329                "description" => $descriptions};
1330    
1331            push(@$line_data,$element_hash);
1332        }
1333    
1334        $gd->add_line($line_data, $line_config);
1335    
1336        return ($gd);
1337    
1338    }
1339    
1340    sub cleavage_loc {
1341      my ($self) = @_;
1342    
1343      return $self->{cleavage_loc};
1344    }
1345    
1346    sub cleavage_prob {
1347      my ($self) = @_;
1348    
1349      return $self->{cleavage_prob};
1350    }
1351    
1352    sub signal_peptide_score {
1353      my ($self) = @_;
1354    
1355      return $self->{signal_peptide_score};
1356    }
1357    
1358    sub tmpred_score {
1359      my ($self) = @_;
1360    
1361      return $self->{tmpred_score};
1362    }
1363    
1364    sub tmpred_locations {
1365      my ($self) = @_;
1366    
1367      return $self->{tmpred_locations};
1368    }
1369    
1370    sub cello_location {
1371      my ($self) = @_;
1372    
1373      return $self->{cello_location};
1374    }
1375    
1376    sub cello_score {
1377      my ($self) = @_;
1378    
1379      return $self->{cello_score};
1380    }
1381    
1382    
1383    #########################################
1384    #########################################
1385  package Observation::Sims;  package Observation::Sims;
1386    
1387  use base qw(Observation);  use base qw(Observation);
# Line 1294  Line 1513 
1513  }  }
1514    
1515  sub html_enc { $_ = $_[0]; s/\&/&amp;/g; s/\>/&gt;/g; s/\</&lt;/g; $_ }  sub html_enc { $_ = $_[0]; s/\&/&amp;/g; s/\>/&gt;/g; s/\</&lt;/g; $_ }
1516    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3