#!c:/wamp/apps/Perl/bin/perl.exe use Restrictionmap; use Rebase; use SeqFileIO; use CGI qw/:standard/; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use CGI qw/:standard start_table/; print header, start_html('Restriction Map'), ('Draw Restriction Maps'), start_multipart_form, i,b('
'), '', '
' , '', '', h3(" For Multiple Sequence Click here"),'|', h3(" Restriction enzyme(s) [case sencetive] "), textfield('enzyme'),p, h3(" Sequence filename (fasta or raw format): "), filefield(-name=>'fileseq', -default=>'starting value', -size=>50, -maxlength=>200, ), p, strong(em("or")), h3("Type sequence: "), textarea( -name=>'typedseq', -rows=>10, -columns=>60, -maxlength=>1000, ), p, h3,("View Format :"), 'PNG', 'JPG', 'TEXT[ For large sequence Only ]
', ,p, h3(" Make restriction map:"), submit , p, '
', '', hr, end_form; if (param( )) { my $sequence = ''; # must have exactly one of the two sequence input methods specified if(param('typedseq') and param('fileseq')) { print "You have given a file AND typed in sequence: do only one!", hr; exit; }elsif(not param('typedseq') and not param('fileseq')) { print "You must give a sequence file OR type in sequence!", hr; exit; }elsif(param('typedseq')) { $sequence = param('typedseq'); }elsif(param('fileseq')) { my $fh = upload('fileseq'); while (<$fh>) { /^\s*>/ and next; # handles fasta file headers $sequence .= $_; } } if(not param('format')){ print "You must give a Format name!", hr; exit; } # strip out non-sequence characters $sequence =~ s/\s//g; $sequence = uc $sequence; my $rebase = Rebase->new( #omit "bionetfile" attribute to avoid recalculating the DBM file dbmfile => 'BIONET', mode => '0444', ); my $restrict = Restrictionmap->new( enzyme => param('enzyme'), rebase => $rebase, sequence => $sequence, graphictype =>param('format'), ); print "

Your requested enzyme(s): ",em(param('enzyme')),p, "

\n"; # table start print '\n"; # teable header print "\n"; # header row start foreach my $head ('Restriction Enzyme','Restriction Site','Total No. of Fragments') { print "\n"; # header cell } print "\n"; # header row end # table content (my $paramenzyme = param('enzyme')) =~ s/,/ /g; # printing table rows within the circle foreach my $enzyme (split(" ", $paramenzyme)) { # define the values for columns here as # $restr_enzyme, $restr_site, $count $restr_enzyme => param('enzyme'); $restr_site=> $restrict->get_enzyme_map($enzyme); $count=> join ' ', $restrict->get_enzyme_map($enzyme)+1, "\n"; # then print the table row print "\n"; # row start foreach my $value ( $seq_name, $restr_enzyme, $restr_site, $count ){ print "\n"; # data cell } print "\n"; # row end } # finish the table print "
$head
$value
\n"; } # lets store the image in the images subfolder # (relating to the script location) my $img_path = 'images/'; mkdir $img_path unless -d $img_path; # lets create the image name using the extension # taken from the object. the result should be 'images/tmp.png' $img_path .= 'tmp.' . param('format'); # storing the image my $img_binary = $restrict->get_graphic(); open( IMG, "> $img_path" ) || die "can not write to $img_path: $!"; binmode IMG; print IMG $img_binary; close IMG; print qq||, "\n\n"; print "
"; "
\n";
exit;
}