[Bioperl-l] Copying features
Hilmar Lapp
hlapp at gnf.org
Mon May 12 13:43:14 EDT 2003
We've had this debate quite a while ago, also wrt features (and
annotation) being retained/processed when you revcomp(), trunc(), or
translate() a PrimarySeqI.
What you really want is a deep clone. Storable.pm provides a dclone(),
which I think is what we were going to settle on, since Storable comes
standard from perl 5.6.x on.
The more difficult exercise is to process the annotation and features
correctly after a revcomp()/trunc()/translate(). Massaging the
coordinates will need to be aware of fuzzy and split locations if it
shall be provided by the toolkit. Also, features may be nested, so the
processing needs to be recursive. I'd be glad if someone steps up to the
plate, writes a comprehensive test case that tests all reasonably
possible scenarios and code that passes all those tests. It's more than
a quick fix for the generic case, believe me. Otherwise it would have
been in there since years.
-hilmar
> -----Original Message-----
> From: Marc Logghe [mailto:Marc.Logghe at devgen.com]
> Sent: Sunday, May 11, 2003 6:45 AM
> To: 'redwards at utmem.edu'
> Cc: Bioperl (E-mail)
> Subject: RE: [Bioperl-l] Copying features
>
>
> Hi Rob,
> wanted to do something similar a while ago.
> I have solved it by writing the features to gff and reading
> them in again to create a new feature with the same
> attributes. Suppose you want to copy $sf1 to $sf2: my $sf2 =
> $sf1->new( -gff_string => $sf1->gff_string ); Then you can
> add the feature to the seq object. Probably not the most
> efficient way, but it worked. HTH, Marc
>
> > -----Original Message-----
> > From: Rob Edwards [mailto:redwards at utmem.edu]
> > Sent: Sunday, May 11, 2003 4:21 AM
> > To: bioperl-l at bioperl.org
> > Subject: [Bioperl-l] Copying features
> >
> >
> > Is there a way to copy a feature from one sequence to
> > another, but have the
> > recipient sequence get a new feature.
> >
> > For example, if you do this:
> >
> > my $newseqobj=$seqobj;
> > my @feats=$seqobj->get_SeqFeatures;
> > foreach my $feat (@feats) {
> > $newseqobj->add_SeqFeature($feat);
> > }
> > my @newfeats=$newseqobj->get_SeqFeatures;
> >
> > Then @newfeats and @feats are the same features, and if you
> change an
> > attribute in one of the features it changes the other.
> >
> > One way to do this is obviously to read all the feature tags
> > and make a new
> > feature with those tags on the new sequence, but I was
> > wondering if this had
> > already been coded and I have missed it in the docs.
> >
> > Thanks
> >
> > Rob
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at bioperl.org
> > http://pw600a.bioperl.org/mailman/listinfo/bioperl-l
> >
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://pw600a.bioperl.org/mailman/listinfo/> bioperl-l
>
More information about the Bioperl-l
mailing list