[Bioperl-l] patch to Bio::Location::Split - split locations whose strand is -1 don't print with complement when only one sublocation present

Cook, Malcolm MEC at stowers-institute.org
Fri Dec 9 00:25:57 EST 2005


Jason,

When a "split location" really isn't, and has only one sublocation, the 'complement' was missing from the string produced by to_FTstring. 

So,  I moved the code that wraps the FTstring in 'complement' outside of the test for number for sublocations and it works, at least better for me in my hands.

Fix is below.

I'm tracking the head.

sub to_FTstring {
    my ($self) = @_;
    my @strs;
    my $strand;
    if( ($strand = ($self->strand || 0)) < 0 ) {
	$self->flip_strand; # this will recursively set the strand
	                    # to +1 for all the sub locations
    }
    foreach my $loc ( $self->sub_Location()  ) {		
	my $str = $loc->to_FTstring();
	# we only append the remote seq_id if it hasn't been done already
	# by the sub-location (which it should if it knows it's remote)
	# (and of course only if it's necessary)
	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;
    }
    $self->flip_strand if $strand < 0;
    my $str;
    if( @strs == 1 ) {
	($str) = @strs;
    } elsif( @strs == 0 ) {
	$self->warn("no Sublocations for this splitloc, so not returning anything\n");

    } else { 
	$str = sprintf("%s(%s)",lc $self->splittype, join(",", @strs));
    }

    if( $strand < 0 ) {  # wrap this in a complement if it was unrolled
      $str = sprintf("%s(%s)",'complement',$str);
    }				# mec fixed: had erroneously not occured previously when @srs == 0 !!! !

    return $str;
}



Also, while we're here, what do you understand the semantics of strand in split sublocations to be?  Your logic of termporarily flipping the sublocations strand seems to suggest that you expect that the strand of the sublocation should in practice agree with that of the superiour split location.  I'm building split locations 'by hand' and seem forced to set the strand in both the parent and all subs.  Is this what you expect?  thanks.

As an aside but related issue, I've got a the bioperl source head cvs checked out as anonymous with a bunch of edits (such as this) that I'd like now to commit given that I now have privs (I'm user mcook).  Do you now a way to edit my source tree to change them to be checked out by mcook instead of anonymous.  Or do I have to recheck out a fresh source tree and make my edits there for commit?  Thanks

Cheers,

Malcolm Cook - mec at stowers-institute.org - 816-926-4449
Database Applications Manager - Bioinformatics
Stowers Institute for Medical Research - Kansas City, MO  USA 








More information about the Bioperl-l mailing list