[Bioperl-l] How can I change only one letter of Bio::Seq object without making another object?

Jason Stajich jason at bioperl.org
Sat May 12 16:50:10 UTC 2007


You can get/set the seq data via the seq() method.

use Bio::Seq;
my $seq = Bio::Seq->new(-seq => 'ACGT');

my $str = $seq->seq;
print $str, "\n";

substr($str,3,1,'A');
$seq->seq($str);
print $seq->seq, "\n";

On May 12, 2007, at 8:21 AM, Sang Chul Choi wrote:

> Hi,
>
> One Bio::Seq's sequence is "ACGT" and I want this object to have
> "ACGA" by changing the fouth letter from T to A. I thought I could do
> this by reading sequence string through the method of seq(), changing
> the string by perl's general function, and generating another Bio::Seq
> object with the new string. This seems to be silly, a little bit.
>
> Is there any simple way to do this? Or, is there any method of
> Bio::Seq to do this: to change one letter at a particular position, or
> additionally to change letters with some range?
>
> Thank you,
>
> Sang Chul
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

--
Jason Stajich
jason at bioperl.org
http://jason.open-bio.org/





More information about the Bioperl-l mailing list