[Bioperl-l] Bio::Tools::Genscan

Pan, Youlian Youlian.Pan@nrc.ca
Thu, 31 May 2001 12:25:05 -0300


Dear Jason and all,

Thank you very much for those who responsed to my enquiry. My problem was
file permission mode. I appreciate the function of the list. I not only
solved my problem and also learnt much more. I appreciate your speedy
response.

Have a good day.

Youlian 

-----Original Message-----
From: Jason Stajich [mailto:jason@chg.mc.duke.edu]
Sent: Wednesday, May 30, 2001 11:19 PM
To: Hilmar Lapp
Cc: Pan, Youlian; 'bioperl-l@bioperl.org'
Subject: Re: [Bioperl-l] Bio::Tools::Genscan


On Wed, 30 May 2001, Hilmar Lapp wrote:

> "Pan, Youlian" wrote:
> > 
> > Hello,
> > 
> > I am new to Bioperl and writing-up a parser using some of Bioperl
modules
> > for my thesis work at Canadian Bioinformatics Resource in Halifax.  I
have
> > used Bio::Tools::Genscan, it worked fine when I invoke my perl script on
> > command line in Unix, but when I try to print to a web browser (IE or
> > netscape), I am not able to see anything after I use
Bio::Tools::Genscan.
> > 
> > Follow are part of my code:
> > 
> > ##########################################################
> > 
> > ..............
> > 
> > print "Content-type: text/html\n\n";
> > print "this is a test\n";
> > @exons =  get_exons();
> > 
> > ........................
> > 
> > sub get_exons {
> >     print "<br>I am in the get exons\n";
> >     $genscan = Bio::Tools::Genscan->new(-file => 'result.genscan');
> >     print "<br> I am after Genscan<br>\n";
> > ..................
> > 
> >     return @exons;
> > }
> > 
> > Print out on browser:
> >            this is a test
> >            I am in the get exons
> > 
> > Print out at UNIX:
> >             Content-type: text/html
> > 
> >             this is a test
> >             I am in the get exons
> >             I am after Genscan
> >             ..................
> > 
> > ############################################################
> > 
> > Could anyone explain this discrepancy?
> 
> The cgi-script probably cannot find or cannot access the
> 'result.genscan' file. Note that a cgi-script usually will run under
> another user, usually 'nobody'. It may also need directory information
> in order to find it.
> 
> I guess what happens is that the Genscan->new() call fails with an
> exception because the file cannot be found or not opened. The
> exception message is printed to STDERR, which why you don't see it in
> the browser (depending on the server's settings, you should still find
> it in the httpd error-log), and after that the script terminates.
> 
> You can enclose the call in an eval {} and examine $@ after the eval
> (eval will catch the exception). You can also test for existence and
> readability like in
> 
> 	if(-r 'somefile') {
> 		print "file is readable (and therefore also exists)\n";
> 	} else {
> 		print "file is not readable, open with Genscan will fail\n";
> 	}
> 
> Hilmar

or use CGI::Carp with fatalsToBrowser. Also you probably want to make sure
that Bio::Tools::Genscan is in your system perl lib or that you have set
PERL5LIB to include bioperl.


> -- 
> -------------------------------------------------------------
> Hilmar Lapp                            email: lapp@gnf.org
> GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
> -------------------------------------------------------------
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
> 

Jason Stajich
jason@chg.mc.duke.edu
Center for Human Genetics
Duke University Medical Center 
http://www.chg.duke.edu/