EnsEMBL/Utils/Sequence.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 2 Conditioncond n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 33 CC 2 SCAR 11.5
CC
2
Cov
0%
expand
6.0
reverse_comp
2.0
BEGIN
2.0
CRAP 3.1
1 =head1 LICENSE
2  
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5  
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9  
10 http://www.apache.org/licenses/LICENSE-2.0
11  
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17  
18 =cut
19  
20  
21 =head1 CONTACT
22  
23 Please email comments or questions to the public Ensembl
24 developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25  
26 Questions may also be sent to the Ensembl help desk at
27 <http://www.ensembl.org/Help/Contact>.
28  
29 =cut
30  
31 =head1 NAME
32  
33 Bio::EnsEMBL::Utils::Sequence - Utility functions for sequences
34  
35 =head1 SYNOPSIS
36  
37 use Bio::EnsEMBL::Utils::Sequence qw(reverse_comp expand);
38  
39 my $seq = 'ACTTTAAAGGCTATCCCAATATG';
40  
41 print "my sequence = $seq\n";
42  
43 reverse_comp( \$seq );
44  
45 print "my reverse comp = $seq\n";
46  
47 my $compressed_seq = '(AC)3';
48  
49 print "my expanded seq is = expand($compressed_seq)";
50  
51 =head1 METHODS
52  
53 =cut
54  
55  
56 package Bio::EnsEMBL::Utils::Sequence;
57 $Bio::EnsEMBL::Utils::Sequence::VERSION = '114.0.0_50'; # TRIAL
58 $Bio::EnsEMBL::Utils::Sequence::VERSION = '114.0.050';
59 use strict;
60 use warnings;
61  
62 use Exporter;
63  
64 use vars qw(@ISA @EXPORT_OK);
65  
66 @ISA = qw(Exporter);
67  
68 @EXPORT_OK = qw(&reverse_comp &expand);
69  
70  
71 =head2 reverse_comp
72  
73 Arg [1] : reference to a string $seqref
74 Example : use Bio::EnsEMBL::Utils::Sequence qw(reverse_comp);
75  
76 $seq = 'ACCTGAA';
77 reverse_comp(\$seq);
78 print $seq;
79  
80 Description: Does an in place reverse compliment of a passed in string
81 reference. The string is passed by reference
82 rather than by value for memory efficiency.
83 Returntype : none
84 Exceptions : none
85 Caller : SequenceAdaptor, SliceAdaptor
86  
87 =cut
88  
89 sub reverse_comp {
90 my $seqref = shift;
91  
92 $$seqref = reverse( $$seqref );
93 $$seqref =~
94 tr/acgtrymkswhbvdnxACGTRYMKSWHBVDNX/tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX/;
95  
96 return;
97 }
98  
99 =head2 expand
100  
101 Arg [1] : reference to a string $seqref
102 Example : use Bio::EnsEMBL::Utils::Sequence qw(expand);
103  
104 $seq = '(AC)3';
105 expand(\$seq);
106 print $seq;
107
108  
109 Description: Expands a genomic sequence. The string is passed by reference
110 rather than by value for memory efficiency.
111 Returntype : none
112 Exceptions : none
113 Caller : SequenceAdaptor, SliceAdaptor
114  
115 =cut
116  
117 sub expand {
118 my $seq_ref = shift;
119 $$seq_ref =~ s/(\w*)\((\w+)\)(\d+)/$1.$2 x $3/eg if ($$seq_ref =~ /\(/);#expressions with parenthesis, expand the alleles
120 return;
121 }
122  
123  
124 1;