[Bioperl-l] about retreive alinged sequence

Nathan S. Haigh n.haigh at sheffield.ac.uk
Wed Oct 11 14:00:33 UTC 2006


Dear Zhuocheng

I'm not familiar with the aa_to_dna_al method but it appears that from 
your code that it returns an alignment object. Please find comments 
inserted below - hope they help!

Nathan

zhuocheng Hou wrote:
> Hello,everyone,
>
> I am a new user of Bioperl. I want to align mutiple DNA sequences based on translated proteins by using clustalw. However, I don't know how to retreive aligned sequences out.
>
> The codes as follows (from the tutorials of HOWTOPAML):
>
>          #
>          # These codes run  and can find the screen print out of clustalw
>          .......
>          my $aa_aln = $aln_factory->align(\@prots, at params);
>          # project the protein alignment back to CDS coordinates
>          my $dna_aln = aa_to_dna_aln($aa_aln, \%seqs);  
>   
$dna_aln should be a Bio::AlignIO object so all you need to do is setup 
the output stream to write the alignment object similar to what you 
wrote below. i.e.

my $out = Bio::AlignIO->new(-file => ">out.msf" ,
                                   -format => 'msf');

Then simply write the input alignment ($dna_aln) to the output stream 
with this:

my $out->write_aln($dna_aln);


>          my @each = $dna_aln->each_seq();         
>          
>          # The following codes were writed by me. However, it doesn't work. I want to get teh $dna_aln contents and write it to files. 
>
>
>          my $in  = Bio::AlignIO->newFh(-Fh=>\$dna_aln,-format => 'fasta');
>          my $aln=$dna_aln;
>          my $out = Bio::AlignIO->new(-file => ">out.msf" ,
>                                    -format => 'msf');
>          #print $out $_ while <$in>; 
>          while ($aln = $in->next_aln() ) {
>                my $out->write_aln($aln);
>          }
>          
>
> Best regards,
>
> Zhuocheng
> CAU
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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