[Bioperl-l] I can't access clustalw from my cgi perl program...

Thomas Sharpton sharpton at berkeley.edu
Wed May 21 18:51:14 UTC 2008


Hi Nisa,

Looks to me like you need to add BioPerl to your PERL5LIB environmental 
variable.  Until you set this up, Perl doesn't know where on your 
machine to find the Bioperl code.  On a UNIX/Linux/Mac OSX based system, 
the fix is as follows:

 From http://www.bioperl.org/wiki/Using_Subversion :

Tell perl where to find BioPerl (assuming you checked out the code in 
$HOME/src; set this in your .bash_profile, .profile, or .cshrc):

bash: $ export PERL5LIB="$HOME/src/bioperl-live:$PERL5LIB"
tcsh: $ setenv PERL5LIB "$HOME/src/bioperl-live:$PERL5LIB"

On a windows machine, you can either environmental variables through 
autoexec.bat or via the Control Panel.

Feel free to back channel me if you need help.

Cheers,
Tom


nisa_dar wrote:
> Hi,
>
> My multiple alignment program works fine from command line but when i put
> the
> same piece of code in my cgi perl program, it gives me the same error, which
> is,
>
> Can't locate Bio/Tools/Run/Alignment/Clustalw.pm in @INC (@INC contains:
> /export/share/iNquiry/perl/lib/5.8.5/x86_64-linux-thread-multi
> /export/share/iNquiry/perl/lib/5.8.5
> /export/share/iNquiry/perl/lib/x86_64-linux-thread-multi
> /export/share/iNquiry/perl/lib/5.8.4 /export/share/iNquiry/perl/lib/5.8.3
> /export/share/iNquiry/perl/lib/5.8.2 /export/share/iNquiry/perl/lib/5.8.1
> /export/share/iNquiry/perl/lib/5.8.0 /export/share/iNquiry/perl/lib
> /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/5.8.5
> /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi
> /usr/lib64/perl5/site_perl/5.8.4/x86_64-linux-thread-multi
> /usr/lib64/perl5/site_perl/5.8.3/x86_64-linux-thread-multi
> /usr/lib64/perl5/site_perl/5.8.2/x86_64-linux-thread-multi
> /usr/lib64/perl5/site_perl/5.8.1/x86_64-linux-thread-multi
> /usr/lib64/perl5/site_perl/5.8.0/x86_64-linux-thread-multi
> /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4
> /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2
> /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl
> /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi
> /usr/lib64/perl5/vendor_perl/5.8.4/x86_64-linux-thread-multi
> /usr/lib64/perl5/vendor_perl/5.8.3/x86_64-linux-thread-multi
> /usr/lib64/perl5/vendor_perl/5.8.2/x86_64-linux-thread-multi
> /usr/lib64/perl5/vendor_perl/5.8.1/x86_64-linux-thread-multi
> /usr/lib64/perl5/vendor_perl/5.8.0/x86_64-linux-thread-multi
> /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4
> /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2
> /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0
> /usr/lib/perl5/vendor_perl .) at
> /export/share/iNquiry/www/cgi-bin/bipod/nisa/snpfinder.cgi line 14.
> BEGIN failed--compilation aborted at
> /export/share/iNquiry/www/cgi-bin/bipod/nisa/snpfinder.cgi line 14.
>
>
>
> Here is my cgi perl program
>
> #!/usr/bin/perl -w
>
> use strict;
> use CGI qw(:standard);
> use CGI::Carp qw/fatalsToBrowser/;
> use Bio::SeqIO;
> use Bio::Align::AlignI; 
> use Bio::AlignIO;
> use Bio::AlignIO::msf;
> use Bio::SimpleAlign;
> use Bio::PrimarySeq;
> use Bio::Tools::Run::Alignment::Clustalw;
> use Bio::PrimarySeqI;
> use Bio::Root::IO;
> use Bio::Seq;
> use Bio::TreeIO;
> use Bio::Root::Root Bio::Tools::Run::WrapperBase;
> use Bio::LocatableSeq;
>
>
> BEGIN {
> 	$ENV{CLUSTALDIR} = '/opt/Bio/bin/clustalw';
> }
> print"Content-type: text/html\n\n";
>
>
> if (param()){ #condition if user supplied some data
> 	my $new_seq=param("sequence"); #to store sequence from text box of form
> 	my $selection=param("size");#to store drop down menu selection for
> translation type
> 	my $file1=param("uploadfile");#variable for name of the file
> 	my $address=param("email");#variable to hold e.mail address
>
> 	if ($file1=~/.+/) {#test condition, if user supplied a file
> 	
> 		my $R_FH = upload("uploadfile");#get file handle
> 		
> 				
> 		
>
> 		my  $in  = Bio::AlignIO->new(-file   => $file1 ,
> 					-format => 'fasta');
> 		my $out = Bio::AlignIO->new(-file   => ">out.aln.pfam" ,
> 					-format => 'pfam');
> 		
> 		while ( my $aln1 = $in->next_aln() ) {
> 			$out->write_aln($aln1);
> 		}
> 		
> 		close $R_FH;
> 		open FH, "out.aln.pfam" || die "Alignment file doesn't exist\n";
> 		while(<FH>){
> 		
> 		print $_,"\n";
> 		}
> 		close FH;
>
> 		#To send results through e.mail
> 			$report=~s/<br \/>/\n/g;#change new line character
> 			$report=~s/(<.+?>)//g;#remove html tags
> 			$report=~s/(&nbsp;)/ /g;#change space character
> 			open(MAIL, "|/usr/sbin/sendmail -t") or die"can't compose an e.mail";
> 			print MAIL "To:$address\n";
> 			print MAIL "From: nisa\n";
> 			print MAIL "Subject: results of $file1\n";
> 			print MAIL  "\n$report\n";
> 			close(MAIL);#close mail
> 			
>
> 	}else{#error message if no file name is entered
> 		print "<html><head><h3>Error: </h3></head><body>You did not enter a file
> name,please upload a file<br /></body></html>";
> 		
> 	}
>
> }
>
> Please let me know what should I do, because clustalw is there and my other
> programs (non web-based) are working.
>
> Thanks
> Nisa
>   


-- 
Thomas Sharpton
PhD Candidate - UC Berkeley
Search smarter: www.siphs.com




More information about the Bioperl-l mailing list