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

Diff of /Sprout/RHLocations.pm

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

revision 1.2, Wed Jul 25 16:19:26 2007 UTC revision 1.3, Mon Aug 20 23:21:03 2007 UTC
# Line 133  Line 133 
133  Find a nearby feature for this hit location. If the hit location is a protein  Find a nearby feature for this hit location. If the hit location is a protein
134  location (i.e. inside a known feature), then the feature is returned without  location (i.e. inside a known feature), then the feature is returned without
135  preamble. If the hit location is on a contig, the feature chosen will be the  preamble. If the hit location is on a contig, the feature chosen will be the
136  one whose begin point or end point is closest to the location's midpoint.  one whose midpoint is closest to the location's midpoint.
137    
138  This method is used by the run-time-value methods, so there will not be  This method is used by the run-time-value methods, so there will not be
139  a copy of the current record available.  a copy of the current record available.
# Line 186  Line 186 
186          my @features = $sprout->GeneDataInRegion($targetObjectName, $wideLocObj->Left, $wideLocObj->Right);          my @features = $sprout->GeneDataInRegion($targetObjectName, $wideLocObj->Left, $wideLocObj->Right);
187          # Get the midpoint of the hit location.          # Get the midpoint of the hit location.
188          my $hitMidpoint = ($hitLocObj->Begin + $hitLocObj->EndPoint) / 2;          my $hitMidpoint = ($hitLocObj->Begin + $hitLocObj->EndPoint) / 2;
189          # Search for the best choice. This will be a feature whose start or end point is closest to our          # Search for the best choice. This will be a feature whose midpoint is closest to our
190          # mid point.          # mid point.
191          my $bestFeature;          my $bestFeature;
192          my $bestDistance = INT_MAX;          my $bestDistance = INT_MAX;
# Line 195  Line 195 
195              my @locList = split /\s*,\s*/, $feature->PrimaryValue('Feature(location-string)');              my @locList = split /\s*,\s*/, $feature->PrimaryValue('Feature(location-string)');
196              for my $featureLoc (@locList) {              for my $featureLoc (@locList) {
197                  my $currentLoc = BasicLocation->new($featureLoc);                  my $currentLoc = BasicLocation->new($featureLoc);
198                  for my $point ($currentLoc->Begin, $currentLoc->EndPoint) {                  my $midPoint = ($currentLoc->Begin + $currentLoc->EndPoint) / 2;
199                      my $newDistance = abs($point - $hitMidpoint);                  my $newDistance = abs($midPoint - $hitMidpoint);
200                      Trace("Distance is $newDistance. Best is $bestDistance.") if T(4);                      Trace("Distance is $newDistance. Best is $bestDistance.") if T(4);
201                      # Now we determine whether or not this feature is better than the best one so far.                      # Now we determine whether or not this feature is better than the best one so far.
202                      my $better = 0;                      my $better = 0;
# Line 213  Line 213 
213                      }                      }
214                  }                  }
215              }              }
         }  
216          # Return the feature with the best distance.          # Return the feature with the best distance.
217          $retVal = $bestFeature;          $retVal = $bestFeature;
218      }      }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3