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

Diff of /FigKernelPackages/FIG.pm

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

revision 1.199, Tue Jan 11 18:59:39 2005 UTC revision 1.200, Wed Jan 12 20:08:30 2005 UTC
# Line 15  Line 15 
15  use Subsystem;  use Subsystem;
16  use SeedDas;  use SeedDas;
17  use Construct;  use Construct;
18    use FIGRules;
19    
20  #  #
21  # Conditionally evaluate this in case its prerequisites are not available.  # Conditionally evaluate this in case its prerequisites are not available.
# Line 2920  Line 2921 
2921  sub by_alias {  sub by_alias {
2922      my($self,$alias,$genome) = @_;      my($self,$alias,$genome) = @_;
2923      my($rdbH,$relational_db_response,$peg);      my($rdbH,$relational_db_response,$peg);
2924        my ($peg, $flag) = FIGRules::NormalizeAlias($alias);
2925      if ($alias =~ /^fig\|\d+\.\d+\.peg\.\d+$/) { return $alias }          if ($flag) {
2926      if ($alias =~ /^\d+$/)                     { $alias = "gi|" . $alias }                  return $peg;
2927      if ($alias =~ /^[A-Z0-9]{6}$/)             { $alias = "uni|" . $alias }          } else {
   
2928      my $genomeQ = $genome ? quotemeta $genome : "";      my $genomeQ = $genome ? quotemeta $genome : "";
   
2929      $rdbH = $self->db_handle;      $rdbH = $self->db_handle;
2930      if (($relational_db_response = $rdbH->SQL("SELECT id FROM ext_alias WHERE ( alias = ? )", undef, $alias)) &&  
2931          (@$relational_db_response > 0))      if (($relational_db_response = $rdbH->SQL("SELECT id FROM ext_alias WHERE ( alias = ? )", undef, $peg)) &&
2932      {                  (@$relational_db_response > 0)) {
2933          if (@$relational_db_response == 1)  
2934          {                  if (@$relational_db_response == 1) {
2935              $peg = $relational_db_response->[0]->[0];              $peg = $relational_db_response->[0]->[0];
2936              return wantarray() ? ($peg) : $peg;              return wantarray() ? ($peg) : $peg;
2937          }                  } elsif (wantarray()) {
         elsif (wantarray())  
         {  
2938              return map { $_->[0] } @$relational_db_response;              return map { $_->[0] } @$relational_db_response;
2939          }                  } else {
         else  
         {  
2940              return wantarray() ? () : "";              return wantarray() ? () : "";
2941          }          }
2942    
2943      }      }
2944  }  }
2945    
# Line 2982  Line 2978 
2978    
2979      if ($loc = $self->feature_location($feature_id))      if ($loc = $self->feature_location($feature_id))
2980      {      {
2981          my $genome = &genome_of($feature_id);          my $genome = $self->genome_of($feature_id);
2982          my ($contig,$beg,$end) = &boundaries_of($loc);          my ($contig,$beg,$end) = $self->boundaries_of($loc);
2983          if ((! $self->near_end($genome,$contig,$beg)) && (! $self->near_end($genome,$contig,$end)))          if ((! $self->near_end($genome,$contig,$beg)) && (! $self->near_end($genome,$contig,$end)))
2984          {          {
2985              return 0;              return 0;
# Line 3046  Line 3042 
3042      {      {
3043          return undef;          return undef;
3044      }      }
3045            my $locations = $self->feature_location($feature_id);
3046      my($contig,$beg,$end) = &FIG::boundaries_of($self->feature_location($feature_id));      my($contig,$beg,$end) = $self->boundaries_of($locations);
3047      if (! $contig) { return () }      if (! $contig) { return () }
3048    
3049      ($neighbors,undef,undef) = $self->genes_in_region(&genome_of($feature_id),      ($neighbors,undef,undef) = $self->genes_in_region($self->genome_of($feature_id),
3050                                                        $contig,                                                        $contig,
3051                                                        &min($beg,$end) - $bound,                                                        &min($beg,$end) - $bound,
3052                                                        &max($beg,$end) + $bound);                                                        &max($beg,$end) + $bound);

Legend:
Removed from v.1.199  
changed lines
  Added in v.1.200

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3