[Bioperl-l] How to find fuzzy locations?

Jason Stajich jason.stajich at gmail.com
Sun Jan 9 07:39:25 UTC 2011


You can test by virtue of inheritance:
if( $location->isa('Bio::Location::FuzzyLocationI') ) {
  # location is 'fuzzy'
}

Or, if you want to know if the start or end coordinates are fuzzy you do 
this - testing if the start, end, and location joining is exact:
if( $location->start_pos_type ne 'EXACT' ||   $location->end_pos_type ne 
'EXACT' &&
  $location->location_type ne 'EXACT' ) {
  # location is 'fuzzy'
}

You will want to look at the perldoc for Bio::LocationI and look at the 
documentation for location_type, start_pos_type, end_pos_type

I cut and paste unformatted here:

=head2 location_type

   Title   : location_type
   Usage   : my $location_type = $location->location_type();
   Function: Get location type encoded as text
   Returns : string ('EXACT', 'WITHIN', 'IN-BETWEEN')
   Args    : none

=cut

=head2 start_pos_type

   Title   : start_pos_type
   Usage   : my $start_pos_type = $location->start_pos_type();
   Function: Get start position type encoded as text

             Known valid values are 'BEFORE' (<5..100), 'AFTER' (>5..100),
             'EXACT' (5..100), 'WITHIN' ((5.10)..100), 'BETWEEN', (5^6), 
with
             their meaning best explained by their GenBank/EMBL location 
string
             encoding in brackets.

   Returns : string ('BEFORE', 'AFTER', 'EXACT','WITHIN', 'BETWEEN')
   Args    : none

=cut





Tao Zhu wrote:
> Hello, everyone!
> In BioPerl HOWTO:Feature-Annotation, Location_Objects
> http://www.bioperl.org/wiki/HOWTO:Feature-Annotation#Location_Objects ,
> it says that we could fetch location objects from a SeqFeature::Generic
> object like this,
> ----------------------------------------
>        # polyA_signal    1811..1815
>        #                          /gene="NDP"
>
>     my $start = $feat_object->location->start;
>     my $end = $feat_object->location->end;
> ----------------------------------------
>
> Location object is a Range object but it has additional capabilities
> designed to handle inexact or "fuzzy" locations, where the "start" and
> "end" of a particular sub-sequence themselves have start and end
> positions, or are not precisely defined. So in the following example we
> could still fetch location objects like this,
> ----------------------------------------
>        # polyA_signal<1811..>1815
>
>     #             /gene="NDP"
>     my $start = $feat_object->location->start;
>     my $end = $feat_object->location->end;
> ----------------------------------------
> Then we'll get $start=1811 and $end=1815 too.
>
> But how should I do if I just want to exclude such "fuzzy" locations? Is
> there any method in BioPerl that could detect such "fuzzy" locations and
> then I could exculde them? Thank you!
>
>
>

-- 
Jason Stajich





More information about the Bioperl-l mailing list