[Bioperl-l] Clustal/T-Coffee to Fasta

James Wasmuth james.wasmuth at ed.ac.uk
Wed Mar 17 15:22:47 EST 2004


Hi Alberto,  taken from docs for Bio::AlignIO 
(http://doc.bioperl.org/releases/bioperl-1.4/Bio/AlignIO.html)

$inputfilename = "testaln.fasta";
    $in  = Bio::AlignIO->new(-file => $inputfilename ,
                             '-format' => 'clustal');
    $out = Bio::AlignIO->new(-file => ">out.aln.pfam" ,
                             '-format' => 'fasta');

    while ( my $aln = $in->next_aln() ) {
        $out->write_aln($aln);
    }


if you want the gaps removed then...



while ( my $aln = $in->next_aln() ) {
	$aln->map_chars('\.','')    # first arguement is whatever your gap 
character is...
	$out->write_aln($aln);
    }


-james


Alberto M R Davila wrote:

>I was looking in to the SeqIO module trying to know if it could convert
>multiple alignments done with ClustalW/X (*.aln files) or T-Coffee to
>Fasta sequences into a single file... no luck... there would be any other
>Bioperl module to do that format conversion ?
>
>Thanks, Alberto
>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Mail - More reliable, more storage, less spam
>http://mail.yahoo.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