[Bioperl-l] Newbie question: Removing sequences from alignment

Brian Osborne brian_osborne at cognia.com
Thu Nov 20 07:42:48 EST 2003


Iain,

That $aln that you're getting from AlignIO is a SimpleAlign object, so what
you want to do is take a look at the SimpleAlign documentation:

http://doc.bioperl.org/releases/bioperl-1.2/Bio/SimpleAlign.html

You mentioned both adding and subtracting sequences from the alignment. You
probably want to do the latter since adding sequences simply adds them, it
doesn't align them. See that page for more detail.

Brian O.

-----Original Message-----
From: bioperl-l-bounces at portal.open-bio.org
[mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Iain Wallace
Sent: Thursday, November 20, 2003 6:22 AM
To: bioperl-l at bioperl.org
Subject: [Bioperl-l] Newbie question: Removing sequences from alignment

Hi all,

I am quite new to all this and was wondering if anyone could help me.
I am trying to create a new alignment file from an old one excluding some
sequences and am not sure how to do it?

This is the script I am trying to modify ; which writes from one alignment
file to another. I just don't know how to add new sequences to the new
alignment.

Thanks for any help

Iain

use Bio::AlignIO;

my $alignio = new Bio::AlignIO(-format => 'clustalw',
                               -file => '/home/iain/alignment1.aln');

my $alignnew = new Bio::AlignIO->new(-format => 'clustalw',
                               -file => '>/home/iain/alignment2.aln');

while( my $aln = $alignio->next_aln ) {
 print "len=", $aln->length,
 " # residures=", $aln->no_residues, " ",
 " percent id=", $aln->percentage_identity, "\n";
 print "seqs are :\n";
 foreach my $seq ($aln->each_seq) {
     print "\t '", $seq->display_id(), "'\n";
 }
 print "---\n";
 $alignnew->write_aln($aln);

}


____________
Virus checked by G DATA AntiVirusKit
Version: AVK 12.0.594 from 19.09.2003
Virus news: www.antiviruslab.com

_______________________________________________
Bioperl-l mailing list
Bioperl-l at portal.open-bio.org
http://portal.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list