[Bioperl-l] possible filehandle out of scope bug between Bio::AlignIO and Bio::Tools::Run::Hmmer

Scott Markel smarkel at scitegic.com
Mon Apr 18 16:59:21 EDT 2005


Jason,

I'm pretty sure I was using -q.  I specifically add that
option at the beginning of the hmmalign elsif block in
Bio::Tool::Run::Hmmer's _run subroutine.  While I was
debugging, the contents of the filehandle were just the
Stockholm formatted alignment file - no hmmalign header.

Scott

Scott

Jason Stajich wrote:

> i think it has more to do with not passing -q into hmmalign which causes 
> AlignIO to barf since the first few lines are header from hmmalign.
> 
> I checked in your changes with some tweaks.  It seems to work for me -- 
> added a test and all.
> 
> -jason
> -- 
> Jason Stajich
> jason.stajich at duke.edu
> http://www.duke.edu/~jes12/
> 
> On Apr 18, 2005, at 3:17 PM, Scott Markel wrote:
> 
>> Note: The context for this message assumes the code change
>> to Bio::Tools::Run::Hmmer that I just sent to the mailing
>> list.
>>
>> I'm running BioPerl-1.4 on both Windows XP (Perl 5.8.0) and
>> cygwin (Perl 5.8.5).  I get the same behavior when I use
>> BioPerl-1.5.
>>
>> When I run the following code, I get the error message
>>
>>   Can't call method "consensus_string" on an undefined value
>>   at runHmmAlign.pl line 14.
>>
>> If I change $factory to $::factory, so that it doesn't go out
>> of scope when the subroutine is done, then everything is fine.
>>
>> My Perl debugging skills aren't what they should be, so I'm
>> not sure how to verify the following, but it looks like the
>> destructor for Bio::Tools::Run::Hmmer clobbers the filehandle
>> in Bio::AlignIO.  Similar code involving Bio::Tools::Run::Hmmer
>> and Bio::SearchIO (for hmmsearch) does not have this problem.
>>
>> I checked the bug list, but didn't find anything for AlignIO
>> and filehandle.
>>
>> Scott
>>
>> ==============================
>> use strict;
>> use warnings;
>>
>> use Bio::Tools::Run::Hmmer;
>>
>> my $hmmFile = shift;
>> my $sequenceFile = shift;
>>
>> my $in = Bio::SeqIO->new(-file => $sequenceFile , -format => "fasta");
>> my $sequence = $in->next_seq();
>>
>> my $hmmResults = runHmmAlign($hmmFile, $sequence);
>> my $alignment = $hmmResults->next_aln();
>> my $consensusString = $alignment->consensus_string();
>> print("$consensusString\n");
>>
>> sub runHmmAlign
>> {
>>     my ($hmmFile, $sequence) = @_;
>>
>>     my $hmmResults;
>>
>>     eval
>>     {
>>         my $factory = Bio::Tools::Run::Hmmer->new("program" => 
>> "hmmalign",
>>                                                   "hmm"     => $hmmFile);
>>         $hmmResults = $factory->run($sequence);
>>     };
>>
>>     if ($@)
>>     {
>>         die("hmmalign failed: $@\n");
>>     }
>>
>>     return $hmmResults;
>> }
>> ==============================
>>
>> -- 
>> Scott Markel, Ph.D.
>> Principal Bioinformatics Architect  email:  smarkel at scitegic.com
>> SciTegic Inc.                       mobile: +1 858 205 3653
>> 9665 Chesapeake Drive, Suite 401    voice:  +1 858 279 8800, ext. 253
>> San Diego, CA 92123                 fax:    +1 858 279 8804
>> USA                                 web:    http://www.scitegic.com
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at portal.open-bio.org
>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>
> 
> 

-- 
Scott Markel, Ph.D.
Principal Bioinformatics Architect  email:  smarkel at scitegic.com
SciTegic Inc.                       mobile: +1 858 205 3653
9665 Chesapeake Drive, Suite 401    voice:  +1 858 279 8800, ext. 253
San Diego, CA 92123                 fax:    +1 858 279 8804
USA                                 web:    http://www.scitegic.com



More information about the Bioperl-l mailing list