1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
package Bio::GMOD::Bulkfiles::MySplitLocation;
use strict;
=head1 Bio::GMOD::Bulkfiles::MySplitLocation
patch for Bio::Location::Split for error in strand usage
=cut
use base qw(Bio::Location::Split);
## REV COMP NOT WORKING! LargeSeq looks ok ... Bio::Location::Split is bad for strand !
use Bio::Root::Root;
use Bio::Location::SplitLocationI;
use Bio::Location::Atomic;
use Bio::Location::Split;
sub new {
my ($class, @args) = @_;
## Atomic doing strange things which throws## my $self = $class->SUPER::new(@args);
my $self = {};
bless $self,$class;
$self->{'_sublocations'} = [];
$self->splittype('JOIN');
return $self;
}
=item strand
Bio::Location::Split IS DOING WRONG THING HERE
it should do same as Simple/Atomic location, and
PrimarySeq handler then properly reverses, etc. all of location
Title : strand
Usage : $strand = $loc->strand();
Function: get/set the strand of this range
Returns : the strandidness (-1, 0, +1)
Args : optionaly allows the strand to be set
: using $loc->strand($strand)
=cut
sub strand {
my $self = shift;
if ( @_ ) {
my $value = shift;
if ( defined($value) ) {
if ( $value eq '+' ) { $value = 1; }
elsif ( $value eq '-' ) { $value = -1; }
elsif ( $value eq '.' ) { $value = 0; }
elsif ( $value != -1 && $value != 1 && $value != 0 ) {
$self->throw("$value is not a valid strand info");
}
$self->{'_strand'} = $value;
}
}
# do not pretend the strand has been set if in fact it wasn't
return $self->{'_strand'};
}
## this is also bad in split - forgot strand
sub to_FTstring {
my ($self) = @_;
my @strs;
foreach my $loc ( $self->sub_Location() ) {
my $str = $loc->to_FTstring();
if( (! $loc->is_remote) &&
defined($self->seq_id) && defined($loc->seq_id) &&
($loc->seq_id ne $self->seq_id) ) {
$str = sprintf("%s:%s", $loc->seq_id, $str);
}
push @strs, $str;
}
my $spt= lc $self->splittype;
if( defined $self->strand && $self->strand == -1 ) {
$spt = "complement";
}
my $str = sprintf("%s(%s)",$spt, join(",", @strs));
return $str;
}
1;
|