[Bioperl-l] Difference between Bio::SimpleAlign Object andBio::Align::AlignI Object

Mark A. Jensen maj at fortinbras.us
Sat Feb 21 23:55:49 UTC 2009


Hi Warren-
The problem here is that aa_to_dna_aln() is not an object method; it is
a "plain function" in Bio::Align::Utilities. You have a couple options; do

 my $dna_align = Bio::Align::Utilities::aa_to_dna_aln($prot_align, 
\%nucseq_hash);

or

 use Bio::Align::Utilities qw(aa_to_dna_aln);
 #...
 my $dna_align = aa_to_dna_aln($prot_align, \%nucseq_hash);

cheers,
Mark

[The problem with using the function reference form
(Bio::Align::Utilities->aa_to_dna_aln) is that the class name
("Bio::Align::Utilities") is then made the first argument, with your args
2nd and 3rd. So when the function does the checking,
 ref($aln)
returns the empty string, since $aln is then set to "Bio::Align::Utilities"
on entry.]
----- Original Message ----- 
From: "Warren Gallin" <wgallin at ualberta.ca>
To: "BioPerl List" <Bioperl-l at lists.open-bio.org>
Sent: Saturday, February 21, 2009 5:59 PM
Subject: [Bioperl-l] Difference between Bio::SimpleAlign Object 
andBio::Align::AlignI Object


> The following code snippet returns a Bio::SimpleAlign Object
>
>
> my $stream = Bio::AlignIO->new(-file => $infile, -format => "fasta");
>
> my $prot_align = $stream -> next_aln;
>
>
> However, later on I want to use $prot_align to align the codons from  the 
> nucleic acid sequence
>
> my $dna_align = Bio::Align::Utilities -> aa_to_dna_aln($prot_align, \ 
> %nucseq_hash);
>
>
> gives me the following error message:
>
> Must provide a valid Bio::Align::AlignI object as the first argument  to 
> aa_to_dna_aln, see the documentation for proper usage and the  method 
> signature at 090220Make_NA_Align_from_AA_Align.pl line 66
>
> So my question is, how do I create a Bio::Align::AlignI object from  the 
> Bio::SimpleAlign object?
>
> I suspect that I am missing some subtlety here, but I haven't been  able to 
> find any documentation that matches these two up.
>
> Warren Gallin
> _______________________________________________
> 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