PrimarySeqI.pm patch [was Re: [Bioperl-l] Copying features]

Rob Edwards redwards at utmem.edu
Sun May 11 13:08:35 EDT 2003


Marc's suggestion works well for duplicating a feature and is easy :) Thanks.

It seems to me that a reverse complemented sequence should still retain its 
features. 

I'd like to propose the following patch to PrimarySeqI.pm that will put new 
features on a reverse complemented sequence.

Rob

diff PrimarySeqI.pm PrimarySeqI_original.pm
424,440d423
<     foreach my $feature ($self->get_SeqFeatures) {
<        # here we are going to make a copy of the SeqFeature to put on the 
new
<        # sequence. This code was suggested by  Marc Logghe 
<Marc.Logghe at devgen.com>
<        # This way, the original feature is not altered.
<        # $rf is reverse feature
<        my $rf = Bio::SeqFeature::Generic->new(-gff_string => 
$feature->gff_string);
<
<        # now adjust the start and end positions in the new features on the 
other strand
<        # The feature is at position: length of the insertion-position. The 
-1 is required, and I think I know why, but I am not sure I can explain it
<        $rf->start($self->length-($rf->start-1));
<        $rf->end($self->length-($rf->end-1));
<        # now we have to correct the strand.
<        if ($rf->strand == '-1') {$rf->strand(1)}
<        elsif ($rf->strand == '1') {$rf->strand(-1)}
<        $out->add_SeqFeature($rf);
<     }
<


More information about the Bioperl-l mailing list