From e4e2fa36c5b54a65f45e3e44ef3816e36cb13d1a Mon Sep 17 00:00:00 2001 From: Tony Cox <avc@sanger.ac.uk> Date: Mon, 17 Apr 2000 07:51:15 +0000 Subject: [PATCH] Added $vc->extend_maximally(_left/right) to virtual contig code Not the prettiest way to do it but it works. --- modules/Bio/EnsEMBL/DB/VirtualContig.pm | 74 ++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/modules/Bio/EnsEMBL/DB/VirtualContig.pm b/modules/Bio/EnsEMBL/DB/VirtualContig.pm index 6277105d59..1f52557867 100755 --- a/modules/Bio/EnsEMBL/DB/VirtualContig.pm +++ b/modules/Bio/EnsEMBL/DB/VirtualContig.pm @@ -150,7 +150,7 @@ These functions are to implement the ContigI interface Title : extend Usage : $new_vc = $vc->extend(100,100); - Function: Make a new vc by entending an existing one + Function: Make a new vc by extending an existing one Example : Returns : Bio::EnsEMBL::DB::VirtualContig Args : @@ -182,6 +182,78 @@ sub extend { } +=head2 extend_maximally + + Title : extend_maximally + Usage : $new_vc = $vc->extend_maximally(); + Function: Extends an existing vc as far as possible in both directions + Example : + Returns : Bio::EnsEMBL::DB::VirtualContig + Args : + + +=cut + +sub extend_maximally { + my ($self) = @_; + + if( !ref $self || ! $self->isa('Bio::EnsEMBL::DB::VirtualContigI') ) { + $self->throw("Can only extend a VirtualContigI, Bailing out..."); + } + # based on an original idea by Ewan Birney. ;) + my $nvc = $self->extend(100000000000,100000000000); + return $nvc; +} + + +=head2 extend_maximally_left + + Title : extend_maximally_left + Usage : $new_vc = $vc->extend_maximally_left(); + Function: Extends an existing vc as far as possible in both directions + Example : + Returns : Bio::EnsEMBL::DB::VirtualContig + Args : + + +=cut + +sub extend_maximally_left { + my ($self) = @_; + + if( !ref $self || ! $self->isa('Bio::EnsEMBL::DB::VirtualContigI') ) { + $self->throw("Can only extend a VirtualContigI, Bailing out..."); + } + # based on an original idea by Ewan Birney. ;) + my $nvc = $self->extend(100000000000,0); + return $nvc; +} + + +=head2 extend_maximally_right + + Title : extend_maximally_right + Usage : $new_vc = $vc->extend_maximally_right(); + Function: Extends an existing vc as far as possible in both directions + Example : + Returns : Bio::EnsEMBL::DB::VirtualContig + Args : + + +=cut + +sub extend_maximally_right { + my ($self) = @_; + + if( !ref $self || ! $self->isa('Bio::EnsEMBL::DB::VirtualContigI') ) { + $self->throw("Can only extend a VirtualContigI, Bailing out..."); + } + # based on an original idea by Ewan Birney. ;) + my $nvc = $self->extend(0,100000000000); + return $nvc; +} + + =head2 primary_seq Title : primary_seq -- GitLab