[Bio] / Sprout / Sapling.pm Repository:
ViewVC logotype

Diff of /Sprout/Sapling.pm

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

revision 1.22, Thu Oct 29 18:31:48 2009 UTC revision 1.23, Wed Nov 25 20:37:04 2009 UTC
# Line 437  Line 437 
437      my ($self, $fid) = @_;      my ($self, $fid) = @_;
438      # Declare the return variable.      # Declare the return variable.
439      my @retVal;      my @retVal;
440        # This will contain the last location found.
441        my $lastLoc;
442      # Get this feature's locations.      # Get this feature's locations.
443      my $qh = $self->Get("IsLocatedIn",      my $qh = $self->Get("IsLocatedIn",
444                         'IsLocatedIn(from-link) = ? ORDER BY IsLocatedIn(ordinal)',                         'IsLocatedIn(from-link) = ? ORDER BY IsLocatedIn(ordinal)',
# Line 449  Line 451 
451          my $len = $resultRow->PrimaryValue('len');          my $len = $resultRow->PrimaryValue('len');
452          # Create a location from the location information.          # Create a location from the location information.
453          my $start = ($dir eq '+' ? $begin : $begin + $len - 1);          my $start = ($dir eq '+' ? $begin : $begin + $len - 1);
454          # Push it on the result list.          my $loc = BasicLocation->new($contig, $start, $dir, $len);
455          push @retVal, BasicLocation->new("${contig}_$start$dir$len");          # Check to see if this location is adjacent to the previous one.
456            if ($lastLoc && $lastLoc->Adjacent($loc)) {
457                # It is, so merge it in.
458                $lastLoc->Merge($loc);
459            } else {
460                # It isn't, so push the new one on the list.
461                $lastLoc = $loc;
462                push @retVal, $loc;
463            }
464      }      }
465      # Return the result.      # Return the result.
466      return @retVal;      return @retVal;

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3