[Bioperl-l] Merging fragments in a simplealign

Mark A. Jensen maj at fortinbras.us
Fri Jan 22 08:31:54 EST 2010


Here's one of my favorite tricks for this: XOR mask on gap symbol.
MAJ

use Bio::SeqIO;
use Bio::Seq;
use strict; 

my $seqio = Bio::SeqIO->new( -fh => \*DATA );

my $acc = $seqio->next_seq->seq ^ '-';
while ($_ = $seqio->next_seq ) {
    $acc ^= ($_->seq ^ '-');
}
my $mrg = Bio::Seq->new( -id => 'merged',
    -seq => $acc ^ '-' );
1;


__END__
>seq2.234     
QWERTYU-------------------
>seq2.345     
----------ASDFGH----------
>seq2.456     
-------------------ZXCVBNM

----- Original Message ----- 
From: "Albert Vilella" <avilella at gmail.com>
To: <bioperl-l at lists.open-bio.org>
Sent: Friday, January 22, 2010 8:07 AM
Subject: [Bioperl-l] Merging fragments in a simplealign


> Hi,
> 
> I would like to write a script that merges fragments in a Bio::SimpleAlign
> object on the basis of
> some $seq->display_name rule.
> 
> I basically want to start with something like this:
> 
> seq1.123     QWERTYUIOPASDFGHJKLZXCVBNM
> seq2.234     QWERTYU-------------------
> seq2.345     ----------ASDFGH----------
> seq2.456     -------------------ZXCVBNM
> 
> And end with something like this:
> 
> seq1.123     QWERTYUIOPASDFGHJKLZXCVBNM
> seq2.mrg     QWERTYU---ASDFGH---ZXCVBNM
> 
> Can people suggest any Bio::SimpleAlign methods that would help here?
> 
> Cheers,
> 
> Albert.
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
>


More information about the Bioperl-l mailing list