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

Diff of /FigKernelPackages/Overlap.pm

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

revision 1.1, Tue Jul 26 20:10:59 2005 UTC revision 1.4, Thu Dec 6 13:59:34 2007 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    #
3    # Copyright (c) 2003-2006 University of Chicago and Fellowship
4    # for Interpretations of Genomes. All Rights Reserved.
5    #
6    # This file is part of the SEED Toolkit.
7    #
8    # The SEED Toolkit is free software. You can redistribute
9    # it and/or modify it under the terms of the SEED Toolkit
10    # Public License.
11    #
12    # You should have received a copy of the SEED Toolkit Public License
13    # along with this program; if not write to the University of Chicago
14    # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15    # Genomes at veronika@thefig.info or download a copy from
16    # http://www.theseed.org/LICENSE.TXT.
17    #
18    
19    
20  package Overlap;  package Overlap;
21    
# Line 44  Line 61 
61    
62  =head3 new  =head3 new
63    
64  C<< my $olap = Overlap->new($loc0, $loc1); >>      my $olap = Overlap->new($loc0, $loc1);
65    
66  Construct an overlap object from two augmented locations.  Construct an overlap object from two augmented locations.
67    
# Line 60  Line 77 
77    
78  =back  =back
79    
80  C<< my $olap = Overlap->new($olapString); >>      my $olap = Overlap->new($olapString);
81    
82  Construct an overlap object from a display string.  Construct an overlap object from a display string.
83    
# Line 131  Line 148 
148    
149  =head3 CheckOverlap  =head3 CheckOverlap
150    
151  C<< my ($type, $len) = Overlap::CheckOverlap($loc0, $loc1); >>      my ($type, $len) = Overlap::CheckOverlap($loc0, $loc1);
152    
153  Check for an overlap between two locations.  Check for an overlap between two locations.
154    
# Line 140  Line 157 
157  =item loc0, loc1  =item loc0, loc1
158    
159  Location objects representing the locations for which overlap information is desired.  Location objects representing the locations for which overlap information is desired.
160    These may be B<BasicLocation>s or B<FullLocation>s.
161    
162  =item RETURN  =item RETURN
163    
# Line 157  Line 175 
175      my ($loc0, $loc1) = @_;      my ($loc0, $loc1) = @_;
176      # Declare the return variables.      # Declare the return variables.
177      my ($type, $len) = (undef, 0);      my ($type, $len) = (undef, 0);
178        # If these are full locations, get the bounds.
179        if ($loc0->isa('FullLocation')) {
180            ($loc0, undef, undef) = $loc0->GetBounds();
181        }
182        if ($loc1->isa('FullLocation')) {
183            ($loc1, undef, undef) = $loc1->GetBounds();
184        }
185      # Both locations must belong to the same contig.      # Both locations must belong to the same contig.
186      if ($loc0->Contig eq $loc1->Contig) {      if ($loc0->Contig eq $loc1->Contig) {
187          # Sort the locations.          # Sort the locations.
# Line 193  Line 218 
218    
219  =head3 Type  =head3 Type
220    
221  C<< my $type = $olap->Type; >>      my $type = $olap->Type;
222    
223  Return the type of this overlap.  Return the type of this overlap.
224    
# Line 208  Line 233 
233    
234  =head3 Length  =head3 Length
235    
236  C<< my $len = $olap->Length; >>      my $len = $olap->Length;
237    
238  Return the number of overlapping base pairs.  Return the number of overlapping base pairs.
239    
# Line 223  Line 248 
248    
249  =head3 Loc  =head3 Loc
250    
251  C<< my $loc = $olap->Loc($name); >>      my $loc = $olap->Loc($name);
252    
253  Return the named location. The location returned will be a location object augmented with the  Return the named location. The location returned will be a location object augmented with the
254  relevant feature ID (C<fid>) and segment index (C<index>).  relevant feature ID (C<fid>) and segment index (C<index>).
# Line 265  Line 290 
290    
291  =head3 String  =head3 String
292    
293  C<< my $olapString = $olap->String; >>      my $olapString = $olap->String;
294    
295  Return a string representation of this overlap.  Return a string representation of this overlap.
296    
# Line 286  Line 311 
311    
312  =head3 Matches  =head3 Matches
313    
314  C<< my $flag = Overlap::Matches($olapA, $olapB); >>      my $flag = Overlap::Matches($olapA, $olapB);
315    
316  Return TRUE if the two overlaps contain the same data, else FALSE.  Return TRUE if the two overlaps contain the same data, else FALSE.
317    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3