PrimarySeqI.pm patch [was Re: [Bioperl-l] Copying features]
Heikki Lehvaslaiho
heikki at ebi.ac.uk
Mon May 12 08:48:14 EDT 2003
Rob,
Looks good. It should go into Bio::SeqI, though. PrimarySeqs do not know
about features. Could you write a test code for this into t/Seq.t,
please.
-Heikki
On Sun, 2003-05-11 at 18:08, Rob Edwards wrote:
> 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);
> < }
> <
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://pw600a.bioperl.org/mailman/listinfo/bioperl-l
--
______ _/ _/_____________________________________________________
_/ _/ http://www.ebi.ac.uk/mutations/
_/ _/ _/ Heikki Lehvaslaiho heikki_at_ebi ac uk
_/_/_/_/_/ EMBL Outstation, European Bioinformatics Institute
_/ _/ _/ Wellcome Trust Genome Campus, Hinxton
_/ _/ _/ Cambs. CB10 1SD, United Kingdom
_/ Phone: +44 (0)1223 494 644 FAX: +44 (0)1223 494 468
___ _/_/_/_/_/________________________________________________________
More information about the Bioperl-l
mailing list