#!/usr/bin/perl -w use Getopt::Std; use strict; my $debug = 0; my $spec; my $method; #1 -- use symmetry, 2 -- no symm main(); sub main { my $cmd; my ($atomdef,$residef,$stdvol,$symfile,$namfile,$outfile) = getINPUT(); if($method == 1) { $cmd = mkCMD($atomdef,$residef,$stdvol,$symfile,In2Out($symfile)); } else { $cmd = mkCMD($atomdef,$residef,$stdvol,$namfile,$outfile); } if($debug) { print STDERR $cmd,"\n"; } else { system($cmd); } if($method == 1) { $cmd = Truncate2(In2Out($symfile),$namfile,$outfile); if($debug) { print STDERR $cmd,"\n"; } else { system($cmd); } system("rm -f ".In2Out($symfile)); } print STDERR "\n\n\n\n\n$outfile created\n"; }; sub getUname { system("uname > temp.$spec"); open(TEMP, "< temp.$spec") or die; if(defined(my $line = )) { $line =~ s/\s+$//; $line =~ s/^\s+//; close(TEMP); system("rm -f temp.$spec"); return lc($line); } close(TEMP); system("rm -f temp.$spec"); return ""; } sub Truncate { my ($symfile,$infile,$outfile) = @_; my $path = getPath(); my $exefile = $path."truncate2.pl"; if(!stat($exefile)) { die; } return "perl $exefile -s $symfile -i $infile -o $outfile"; }; sub Truncate2 { my ($symfile,$infile,$outfile) = @_; my $path = getPath(); my $exefile = $path."truncate3.pl"; if(!stat($exefile)) { die; } return "perl $exefile -s $symfile -i $infile -o $outfile"; }; sub In2Out { my ($infile) = @_; my @chunks = split('/',$infile); substr($chunks[$#chunks],-4) = "-temp-$spec\.out"; return $chunks[$#chunks]; }; sub mkCMD { my ($atomdef,$residef,$stdvol,$infile,$outfile) = @_; my $path = getPath(); my $uname = getUname(); my $exefile = "/usr/local/bin/packing-eff.exe"; #my $exefile = "./packing-eff.exe.$uname"; #my $exefile = "/bh0/vossman/bin/packing-eff"; if(!stat($exefile)) { die; } return "$exefile -types-file $atomdef -residue-file $residef " ."-stdvols $stdvol -i $infile > $outfile"; }; sub getPath { use Cwd; my $dir = cwd(); $dir =~ s/$/\//; my $path = "/home/vossman/phos/"; #my $path = "/bh0/vossman/phosphate/"; if(!stat($path)) { die; } if($path eq $dir) { $path = ""; } return $path; }; sub getINPUT { my %args; my ($atomdef,$residef,$stdvol,$symfile,$namfile,$outfile); getopt("uspoarm",\%args); my $path = getPath(); $method = $args{'m'} || 1; $spec = $args{'u'} || int(rand(1000000)); $symfile = $args{s} || $path."1JJ2_sym.pdb"; $namfile = $args{p} || $path."1JJ2_nam.pdb"; if($args{r}) { my $root = $args{r}; $symfile = $path."sym/".$root."_nam.pdb.sym"; $namfile = $path."nam/".$root."_nam.pdb"; } $outfile = $args{o} || $path."getVolume.out"; $atomdef = $args{a} || $path."atom-defs.dat"; $residef = $path."resi-defs.dat"; $stdvol = $path."stdvol173.dat"; foreach my $file ($atomdef,$residef,$stdvol,$symfile,$namfile) { if(!stat($stdvol)) { die "\n$file not found\n\n"; } } return ($atomdef,$residef,$stdvol,$symfile,$namfile,$outfile); };