[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.146, Fri Aug 27 18:32:07 2004 UTC revision 1.147, Fri Aug 27 21:55:57 2004 UTC
# Line 2252  Line 2252 
2252  sub close_genes {  sub close_genes {
2253      my($self,$fid,$dist) = @_;      my($self,$fid,$dist) = @_;
2254    
2255    #   warn "In close_genes, self=$self, fid=$fid";
2256    
2257      my $loc = $self->feature_location($fid);      my $loc = $self->feature_location($fid);
2258      if ($loc)      if ($loc)
2259      {      {
# Line 2268  Line 2270 
2270      return ();      return ();
2271  }  }
2272    
2273    sub adjacent_genes
2274    {
2275        my ($self, $fid, $dist) = @_;
2276        my (@close, $strand, $i);
2277    
2278    #   warn "In adjacent_genes, self=$self, fid=$fid";
2279    
2280        my ($left_neighbor, $right_neighbor) = ("", "");
2281    
2282        $strand = $self->strand_of($fid);
2283    
2284        $dist   = $dist || 2000;
2285        @close  = $self->close_genes($fid, $dist);
2286        for ($i=0; $i < @close; ++$i) { last if ($close[$i] eq $fid); }
2287    
2288        if ($i > 0)
2289        {
2290            if ($self->strand_of($close[$i-1]) eq $strand) { $left_neighbor  = $close[$i-1]; }
2291        }
2292    
2293        if ($i < $#close)
2294        {
2295            if ($self->strand_of($close[$i+1]) eq $strand) { $right_neighbor = $close[$i+1]; }
2296        }
2297    
2298        # ...return genes in transcription order...
2299        if ($strand eq '-')
2300        {
2301            ($left_neighbor, $right_neighbor) = ($right_neighbor, $left_neighbor);
2302        }
2303    
2304        return ($left_neighbor, $right_neighbor) ;
2305    }
2306    
2307    
2308  =pod  =pod
2309    
# Line 2290  Line 2326 
2326      my($self,$feature_id) = @_;      my($self,$feature_id) = @_;
2327      my($relational_db_response,$locations,$location);      my($relational_db_response,$locations,$location);
2328    
2329    #   warn "In feature_location, self=$self, fid=$feature_id";
2330    
2331      if ($self->is_deleted_fid($feature_id)) { return undef }      if ($self->is_deleted_fid($feature_id)) { return undef }
2332    
2333      $locations = $self->cached('_location');      $locations = $self->cached('_location');
# Line 2310  Line 2348 
2348      return undef;      return undef;
2349  }  }
2350    
2351    sub contig_of
2352    {
2353        my ($self, $locus) = @_;
2354    
2355        $locus =~ m/^([^,])_\d+_\d+/;
2356    
2357        return $1;
2358    }
2359    
2360    sub beg_of
2361    {
2362        my ($self, $locus) = @_;
2363    
2364        $locus =~ m/^[^,]_(\d+)_\d+/;
2365    
2366        return $1;
2367    }
2368    
2369    sub end_of
2370    {
2371        my ($self, $locus) = @_;
2372    
2373        $locus =~ m/\S+_\d+_(\d+)$/;
2374    
2375        return $1;
2376    }
2377    
2378    sub strand_of
2379    {
2380        my ($self, $fid) = @_;
2381        my ($beg, $end);
2382    
2383    #   warn "In strand_of, self=$self, fid=$fid";
2384    
2385        (undef, $beg, $end) = $self->boundaries_of($self->feature_location($fid));
2386    
2387        if ($beg < $end) { return '+'; } else { return '-'; }
2388    }
2389    
2390    
2391    
2392  =pod  =pod
2393    
2394  =head1 boundaries_of  =head1 boundaries_of

Legend:
Removed from v.1.146  
changed lines
  Added in v.1.147

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3