Skip to content
Snippets Groups Projects
Commit 147268a0 authored by Daniel Rios's avatar Daniel Rios
Browse files

Added expand function to expand sequences in the (AC)5 format

parent 016d40c8
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ Bio::EnsEMBL::Utils::Sequence - Utility functions for sequences
=head1 SYNOPSIS
use Bio::EnsEMBL::Utils::Sequence qw(reverse_comp);
use Bio::EnsEMBL::Utils::Sequence qw(reverse_comp expand);
my $seq = 'ACTTTAAAGGCTATCCCAATATG';
......@@ -18,6 +18,10 @@ Bio::EnsEMBL::Utils::Sequence - Utility functions for sequences
print "my reverse comp = $seq\n";
my $compressed_seq = '(AC)3';
print "my expanded seq is = expand($compressed_seq)";
=head1 METHODS
......@@ -35,7 +39,7 @@ use vars qw(@ISA @EXPORT_OK);
@ISA = qw(Exporter);
@EXPORT_OK = qw(&reverse_comp);
@EXPORT_OK = qw(&reverse_comp &expand);
=head2 reverse_comp
......@@ -66,5 +70,29 @@ sub reverse_comp {
return;
}
=head2 expand
Arg [1] : reference to a string $seqref
Example : use Bio::EnsEMBL::Utils::Sequence qw(expand);
$seq = '(AC)3';
expand(\$seq);
print $seq;
Description: Expands a genomic sequence. The string is passed by reference
rather than by value for memory efficiency.
Returntype : none
Exceptions : none
Caller : SequenceAdaptor, SliceAdaptor
=cut
sub expand {
my $seq_ref = shift;
$$seq_ref =~ s/(\w*)\((\w+)\)(\d+)/$1.$2 x $3/eg if ($$seq_ref =~ /\(/);#expressions with parenthesis, expand the alleles
return;
}
1;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment