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

Diff of /FigKernelPackages/SeedUtils.pm

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

revision 1.15, Tue Nov 24 19:23:36 2009 UTC revision 1.16, Tue Nov 24 19:50:47 2009 UTC
# Line 26  Line 26 
26      use base qw(Exporter);      use base qw(Exporter);
27      our @EXPORT = qw(hypo boundaries_of parse_fasta_record create_fasta_record      our @EXPORT = qw(hypo boundaries_of parse_fasta_record create_fasta_record
28                       rev_comp genome_of min max sims verify_dir between translate                       rev_comp genome_of min max sims verify_dir between translate
29                       standard_genetic_code);                       standard_genetic_code parse_location);
30    
31  =head1 SEED Utility Methods  =head1 SEED Utility Methods
32    
# Line 107  Line 107 
107      return ($contig, $min, $max);      return ($contig, $min, $max);
108  }  }
109    
110    =head3 parse_location
111    
112        my ($contig, $begin, $end) = parse_location($locString);
113    
114    Return the contigID, start offset, and end offset for a specified
115    location string (see L<SAP/Location Strings>).
116    
117    =over 4
118    
119    =item locString
120    
121    Location string to parse.
122    
123    =item RETURN
124    
125    Returns a three-element list containing the contig ID from the location
126    string, the starting offset of the location, and the ending offset. If
127    the location string is not valid, the values returned will be C<undef>.
128    
129    =back
130    
131    =cut
132    
133    sub parse_location {
134        # Get the parameters.
135        my ($locString) = @_;
136        # Declare the return variables.
137        my ($contig, $begin, $end);
138        # Parse the location string.
139        if ($locString =~ /^(.+)_(\d+)([+-])(\d+)$/) {
140            # Pull out the contig ID and the begin location.
141            $contig = $1;
142            $begin = $2;
143            # Compute the ending location from the direction and length.
144            if ($3 eq '+') {
145                $end = $begin + $4 - 1;
146            } else {
147                $end = $begin - $4 + 1;
148            }
149        }
150        # Return the results.
151        return ($contig, $begin, $end);
152    }
153    
154    
155  =head3 max  =head3 max
156    
157      my $max = max(@nums);      my $max = max(@nums);

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3