[Bioperl-l] CGI Perl and Bioperl

hafiz hafiz khufaz83 at yahoo.com
Wed Nov 3 01:10:15 EST 2004

i have writing source code to searching sequence with
SeqIO used CGI perl but it don't running in Internet
Exploxer . but it can running on IE while don't have
SeqIO in my source code . why? 
for information, i have installed apache in our

my source code: search.cgi

#use lib '/disk3/local/lib/perl5/site_perl';
#use lib '/home/database/swiss-prot/release';
use CGI qw/:standard :html3/;
use Bio::DB::GenBank;
use File::Temp;
use FileHandle;
use Bio::DB::SwissProt;
use File::Temp;
use FileHandle;
use Bio::Root::IO;
use Bio::SeqIO;
use Bio::Seq;

use Bio::PrimarySeq;
use Location;

print header,
  start_html(-title => 'find subsequence of large
SwissProt entries',-author => 
'  ');
print_form()    unless param;
print_results() if param;

sub print_results {   
$database = SwissProt;
$input = param('input');
$fileName = param('fileName');
$format = swiss;
#Load  module Location.pm into an array
@filelocation = Location::filelocation ("sprot42.dat",

#Access directory path that resides in second element
of array @filelocation
my $location = $filelocation[1];

#Open the directory that are returned by Location.pm
 opendir (DIR, $location)|| die "Couldn't open
directory or directory not found\n";

 #recieve input from user

  print "====>>Enter sequence:$input";
#  $input = <STDIN>;
  chomp $input;
  print "\n";

  #Read the drectory and store its content in an array
  @file = readdir (DIR);

foreach $file(@file) {
   if ($file eq "sprot42.dat") {

#Open sprot42.dat file for reading

$file .="/sprot42.dat";

open (FILE,$file) || die "Couldn't open file\n";
    #Method from Bioperl module-Bio::SeqIO
    #Create a sequence object and store it in scalar
    $in = Bio::SeqIO->new(-file
      #Loop untill the end of the sequence object
      while (my $seq = $in->next_seq()) {

         #Read sequence in file   
         my $sequence = $seq->seq;
         #Test if sequence exist in the file
         if ($sequence =~ /$input/) {


#Access sequence ID and store it in a scalar variable

  $fileName = $seq->id;         

print "Matching sequence found in $fileName\n\n";

           #Store $fileName in @foundfile array
           push (@foundfile,$fileName);
           #Increase counter of found
           $found = $found + 1;

         }# End second if loop

	}#End while loop

   }#End first if loop
}#End foreach loop


sub print_form {

print start_form,table(
			 Tr(td("Enter your sequence"),td(textfield(-name =>
'input',-size => 20)))),
    submit ("Find my subsequence");


Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 

More information about the Bioperl-l mailing list