[Bioperl-l] Copying features
Marc Logghe
Marc.Logghe at devgen.com
Sun May 11 16:44:57 EDT 2003
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
>
More information about the Bioperl-l
mailing list