#!/usr/bin/perl ################################################################################ # # Right, so this broke *years* ago and no one bothered to fix it or tell # me how to. Vadim's replacement for this is now on MolMovDB, so I'm just # going to make a redirect to that and leave the rest of this crap alone # for now. It might be nice to resurrect the full original version for # the two or three people who care, but this is a lower priority and we'd # ultimately rather just distribute the standalone program. # -Nat # print "Content-Type: text/html\n\n"; print qq(); exit; # # Unmodified original script follows. ################################################################################ use File::Path; use lib "."; require 'cgi-lib.pl'; #morph.cgi #Copyright 1997 Werner G. Krebs. All Rights Reserved. #Unpubished Work. Contact author for permission to use or modify. #Last Revision Werner Krebs 97/8/4 #required because we are running setuid. $ENV{PATH} = "/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin"; $ENV{IFS}=""; $anonftpdir = "/net/aragorn/u6/ftp/pub/SeCrEt"; $top = "/u1/htdocs/align/structal"; $home = $top; $cgi = "$home/cgi-bin"; $uploads = "$home/uploads"; $BINDIR = $home; $log = "/Net/durin/u1/log/server.cgi.log"; use lib "/u1/htdocs/align"; require "werner2.pl"; $nconfs = 2; $ID = &gen_ID; #Every request should have an ID for logging purposes. # Spool the files to directory with same name as ID if (&MethPost or &MethGet) { $LOGFILE = "$uploads/$ID/test.log"; umask 000; mkdir "$uploads/$ID", 0777 or severeError("Server side error: Can't create upload directory!"); chdir("$uploads/$ID") or severeError("Server side error: Can't cd to upload directory!"); $cgi_lib::writefiles = "$uploads/$ID"; # Limit upload size to avoid using too much memory $cgi_lib::maxdata = 3000000; } # Read and parse the data. # Retreive the data, the filenames, and the content-type $ret = &ReadParse(\%cgi_data,\%cgi_cfn,\%cgi_ct,\%cgi_sfn); $nconfs = $cgi_data{nconfs} if ($cgi_data{nconfs}); $nconfs = 2; $| = 1; #required for cgidie. open LOG,">>$log" or die "Couldn't open log file!\n"; $date = `date` ; $date =~ s/\n//g ; print LOG "$date \| $id \| $ENV{'REMOTE_HOST'} \| $ENV{'REMOTE_ADDR'} \| $ENV{'H TTP_USER_AGENT'} \| $ENV{'URL_FROM'} \| $$\n"; foreach $key (sort keys cgi_data) { print LOG "$key = $cgi_data{$key} | "; } print LOG "\n"; close LOG; &CgiDie("Range of two to ten conformations _only_ allowed!") if ($nconfs > 10 or $nconfs < 2); if ((&MethPost and !$cgi_data{submit}) or (&MethGet and !$cgi_data{ID1} and !$cgi_data{ID2}) or (!&MethPost and !&MethGet)) { #Remove directory. do_form(); chdir(".."); rmtree("$uploads/$ID",0,0) if $ID; exit(0); } for($i=$nconfs;$i>=1;$i--) { #Emulate XOR if (!$cgi_data{"ID$i"} and !(-s $cgi_data{"input_file$i"})) { if($i==$nconfs) {$nconfs--;next;} else {&CgiDie("Please specify a PDB identifier _or_ a filename for file $i."); ;}} if ($cgi_data{"ID$i"} and -s $cgi_data{"input_file$i"}) {&CgiDie("Please specify _either_ a PDB identifier _or_ a filename for file $i."); } } $|=1; print "Content-type: text/html", "\n\n"; #delete any files with zero size foreach $file (%cgi_sfn) { -s $file or unlink($file); } $cmdline=""; for($i=1;$i<=$nconfs;++$i) { if(length($cgi_data{"ID$i"}) > 4) { #Submitted by client via upload or via anon ftp. my $id = untaint($cgi_data{"ID$i"}); if (substr($id,0,3) eq "ftp") { #ftp. my $file = "$anonftpdir/" . substr($id,3,length($id)-3); my $file2 = $id; $file2 .= ".pdb" if (substr($file2,length($id)-4) ne ".pdb"); #we need to copy rather than symlink to prevent hanky-panky by #the user in the anon ftp dir. # print ("$file2\n$file\n"); # system("ls $anonftpdir"); die ("Invalid ID: Anon FTP file " . substr($id,3,length($id)-3) . " not found!\n") if (! -e $file); system ("cp -- $file $file2"); # unlink ($file); #done by client $pfile[$i-1] = $file2; # print"FILE: $file2\n"; } else { die "Invalid ID length or syntax.\n"; } } elsif($cgi_data{"ID$i"}) { $pfile[$i-1] = getpdb(untaint($cgi_data{"ID$i"})); unlink(untaint2($cgi_data{"input_file$i"})) if $cgi_data{"input_file$i"}; } else { link(untaint2($cgi_sfn{"input_file$i"}),"webupload$i.pdb"); unlink($cgi_sfn{"input_file$i"}); $pfile[$i-1] = "webupload$i.pdb"; } if(! ( -s $pfile[$i-1] ) ) {die "Zero-length input file $i\n Upload structure is either empty or a PDB ID is invalid.\n Contact pmdb\@bioinfo.mbb.yale.edu is problem persists.\n";} #PDB retrieval presumably failed. #default chain is A because our programs ignore chain ids for PDB files #that do not use chains. $cgi_data{"chain$i"}= "A" if (!$cgi_data{"chain$i"} or $cgi_data{"chain$i"} eq " "); my $chain = uc untaint($cgi_data{"chain$i"}); die "Chain id $i must not be more than one character.\n" if (length($chain > 1)); $cmdline.="$pfile[$i-1] $chain "; } $< = $>; #prevent test.cgi from thinking it is setuid. $nconfs = untaint($nconfs); $ENV{xold} = 1 if ($cgi_data{xold}) ; $ENV{xnew} = 1 if ($cgi_data{xnew}) ; die "Must specify two structures\n" if ( !$pfile[0] or !$pfile[1] ); print "Yale Structure Alignment Server Output\n"; if ( ! $cgi_data{ID2} or ! $cgi_data{ID1} ) { print " Generate a morph movie of these structures via the Yale Protein Morphing Server

"; } else { print <Yale Protein Morphing Server:

Email this address when done:
EOF } print "
One moment please, alignment running....

\n";


open PIPE, "$BINDIR/structal.pl $cmdline|" or die "$BINDIR/structal.pl $cmdline failed: $!\n \n Did you supply valid structures and specify cores correctly?\nIf problem presists, contact pmdb\@bioinfo.mbb.yale.edu\n ";

while () {
print "$_";}

close PIPE;
print "
"; chdir(".."); rmtree("$uploads/$ID"); exit 0; sub do_form{ print "Content-type: text/html", "\n\n"; print < Yale Structure Alignment Server

Yale Structure Alignment Server

Enter IDs to be fetched (directly from the PDB) or upload your structures and they will be structurally aligned. Be sure to specify chains for multi-chain structures. (Example input is "4hhb" with "A" chain and "1mbd".)
EOF for ( $i=1; $i<=$nconfs; $i++) { print < Structure $i :  
Chain:   PDB ID: OR PDB File:                .  

EOF } print <Dump rotated original coordinates
Dump aligned coordinates


[help] [home]
Copyright (C) 1998-1999 Werner Krebs and Mark Gerstein.
All Rights Reserved.
 pmdb\@bioinfo.csb.yale.edu
EOF } sub mkrbox { my $i; my $option; my $checked; for($i=0;$i $option\n"; } } #