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

Iain Wallace iain.wallace at ucd.ie
Thu Nov 20 06:21:53 EST 2003


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



More information about the Bioperl-l mailing list