[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 17:36:46 EDT 2005


Jason,

Okay.  I'll stick with my workaround of giving the HMMER
factory package scope.  If you get time later to look at
the filehandle issue, please let me know.  I'm happy to
help, but feel out of my depth doing this one alone.

Thanks for taking care of the CVS check-in for hmmalign
execution.

Scott

Jason Stajich wrote:

> The errors I get seem to be with the sequence file not being filled 
> prior to running as I am getting FATAL errors from hmmalign - but I'm 
> really not sure why this would happen.
> 
> FATAL: Failed to read any sequences from file /tmp/yHY9rwASfV/SyE1fpOHIM
> Can't call method "consensus_string" on an undefined value at 
> /home/jason/scott_hmmrun.pl line 14.
> 
> I don't have time to really debug - but you are probably right that a 
> cleanup method is getting called, I am just not sure how.
> 
> -- 
> Jason Stajich
> jason.stajich at duke.edu
> http://www.duke.edu/~jes12/
> 
> On Apr 18, 2005, at 4:59 PM, Scott Markel wrote:
> 
>> 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
>>
> 
> 

-- 
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