4 # Copyright (C) 2007-2008 Martin A. Hansen.
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # http://www.gnu.org/copyleft/gpl.html
23 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
26 # Routines for manipulation Solid sequence files with di-base encoding.
29 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
32 use vars qw( @ISA @EXPORT_OK );
36 @ISA = qw( Exporter );
39 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> CONSTANTS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
43 'A0' => 'A', 'AA' => 0,
44 'A1' => 'C', 'AC' => 1,
45 'A2' => 'G', 'AG' => 2,
46 'A3' => 'T', 'AT' => 3,
47 'C0' => 'C', 'CA' => 1,
48 'C1' => 'A', 'CC' => 0,
49 'C2' => 'T', 'CG' => 3,
50 'C3' => 'G', 'CT' => 2,
51 'G0' => 'G', 'GA' => 2,
52 'G1' => 'T', 'GC' => 3,
53 'G2' => 'A', 'GG' => 0,
54 'G3' => 'C', 'GT' => 1,
55 'T0' => 'T', 'TA' => 3,
56 'T1' => 'G', 'TC' => 2,
57 'T2' => 'C', 'TG' => 1,
58 'T3' => 'A', 'TT' => 0,
73 sub define_color_code {
107 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SUBROUTINES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
112 # Martin A. Hansen, April 2008.
114 # Converts a di-base encoded Solid sequence to
117 my ( $seq_cs, # di-base encode sequence
122 my ( @codes, $base, $i, $seq );
124 @codes = split //, $seq_cs;
125 $base = shift @codes;
128 for ( $i = 0; $i < @codes; $i++ )
130 $base = $CONVERT_HASH{ $base . $codes[ $i ] };
140 # Martin A. Hansen, April 2008.
142 # Converts a sequence to di-base encoded Solid sequence.
144 my ( $seq, # sequence
151 $seq_cs = substr $seq, 0, 1;
153 for ( $i = 0; $i < length( $seq ) - 1; $i++ ) {
154 $seq_cs .= $CONVERT_HASH{ substr( $seq, $i, 2 ) };
161 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<